static_assert( __cplusplus >= 2023'02 ); #include #include #include namespace { using namespace Alepha::Testing::exports; auto init= Alepha::Utility::enroll <=[] { "smoke test"_test <=[]( Environment test ) { using namespace Alepha::Functional::exports::composition_m; auto i= ident * ident; auto add_two= []( const int x ) { return x + 2; }; auto mult_two= []( const int x ) { return x * 2; }; auto add_two_then_mult_two= mult_two * add_two; test.expect( add_two_then_mult_two( 1 ) == 6 ); }; "compose test"_test <=[]( Environment test ) { using namespace Alepha::Functional::exports::composition_m; auto add= []( const int x, const int y ) { return x + y; }; auto mult3= []( const int x ) { return x * 3; }; test.expect( ( add >> mult3 )( 2, 1 ) == 9 ); }; }; }