From 61841561f9b6cc21a0fd6903d4e3d3add6e64554 Mon Sep 17 00:00:00 2001 From: ADAM David Alan Martin Date: Sat, 16 Oct 2021 23:27:39 -0400 Subject: [PATCH] Try eliminating a nesting depth. --- AutoRAII.test/0.cc | 42 +++++++++++++++++++----------------------- 1 file changed, 19 insertions(+), 23 deletions(-) diff --git a/AutoRAII.test/0.cc b/AutoRAII.test/0.cc index ccf42d5..17a4047 100644 --- a/AutoRAII.test/0.cc +++ b/AutoRAII.test/0.cc @@ -11,33 +11,29 @@ main( const int argcnt, const char *const argvec[] ) return Alepha::Testing::runAllTests( argcnt, argvec ); } -namespace +static auto tests= Alepha::Utility::enroll <=[] { using namespace Alepha::exports::auto_raii; - - using namespace Alepha::Utility::exports::evaluation; using namespace Alepha::Testing::exports::literals; + using Alepha::Testing::exports::TestState; - auto tests= enroll <=[] + "basic.syntax"_test <=[]( TestState test ) { - "basic.syntax"_test <=[]( TestState test ) - { - AutoRAII managed{ []{ return 42; }, []( auto ){} }; - test.expect( managed == 42 ); - }; - - "basic.functionality"_test <=[]( TestState test ) - { - bool initialized= false; - bool destroyed= false; - { - AutoRAII managed{ [&]{ initialized= true; return 0; }, [&]( auto ) { initialized= false; destroyed= true; } }; - test.expect( initialized ); - test.expect( not destroyed ); - } - test.expect( not initialized ); - test.expect( destroyed ); - }; + AutoRAII managed{ []{ return 42; }, []( auto ){} }; + test.expect( managed == 42 ); }; -} + + "basic.functionality"_test <=[]( TestState test ) + { + bool initialized= false; + bool destroyed= false; + { + AutoRAII managed{ [&]{ initialized= true; return 0; }, [&]( auto ) { initialized= false; destroyed= true; } }; + test.expect( initialized ); + test.expect( not destroyed ); + } + test.expect( not initialized ); + test.expect( destroyed ); + }; +};