MCPcopy Create free account
hub / github.com/boostorg/leaf / main

Function main

test/BOOST_LEAF_AUTO_test.cpp:72–113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70}
71
72int main()
73{
74 BOOST_TEST_EQ(f3()->x, 42);
75
76 {
77 int r = leaf::try_handle_all(
78 []() -> leaf::result<int>
79 {
80 int x = 42;
81
82 leaf::result<int> r1(x);
83 BOOST_LEAF_AUTO(rx1, r1);
84 BOOST_TEST_EQ(r1.value(), rx1);
85
86 leaf::result<int &> r2(x);
87 BOOST_LEAF_AUTO(rx2, r2);
88 BOOST_TEST_EQ(r2.value(), rx2);
89
90 return 0;
91 },
92 []
93 {
94 return 1;
95 } );
96 BOOST_TEST_EQ(r, 0);
97 }
98
99#ifndef BOOST_LEAF_NO_CXX11_REF_QUALIFIERS
100 {
101 auto r = []() -> test_res<int, test_error>
102 {
103 BOOST_LEAF_AUTO(v, ([]() -> test_res<int, test_error> { return test_error(42); }()));
104 return v;
105 }();
106 BOOST_TEST(!r);
107 BOOST_TEST(r.error().moved);
108 BOOST_TEST_EQ(r.error().value, 42);
109 }
110#endif
111
112 return boost::report_errors();
113}

Callers

nothing calls this directly

Calls 5

try_handle_allFunction · 0.85
test_errorClass · 0.85
report_errorsFunction · 0.85
f3Function · 0.70
valueMethod · 0.45

Tested by

no test coverage detected