diff options
-rw-r--r-- | modules/core/tests/core.cpp | 22 | ||||
-rw-r--r-- | modules/core/tests/templates.cpp | 25 |
2 files changed, 16 insertions, 31 deletions
diff --git a/modules/core/tests/core.cpp b/modules/core/tests/core.cpp index f418a07..12fc398 100644 --- a/modules/core/tests/core.cpp +++ b/modules/core/tests/core.cpp @@ -38,26 +38,4 @@ SAW_TEST("String Literal Append"){ SAW_EXPECT(c == "foobar", "CT String sum is not \"foobar\""); } - -SAW_TEST("Template Group Reduction"){ - using namespace saw; - - struct foo { - std::string name = "foo"; - }; - struct bar { - std::string name = "bar"; - }; - struct baz { - std::string name = "baz"; - }; - - using grp = tmpl_group<foo, bar, baz, foo, bar, foo>; - using red_grp = tmpl_group<baz, bar, foo>; - - using alg_red_grp = tmpl_reduce<grp>::type; - - static_assert(std::is_same_v<alg_red_grp, red_grp>, "Should be same type"); - SAW_EXPECT((std::is_same_v<alg_red_grp, red_grp>), "Should be same type"); -} } diff --git a/modules/core/tests/templates.cpp b/modules/core/tests/templates.cpp index 2a069a6..95203f9 100644 --- a/modules/core/tests/templates.cpp +++ b/modules/core/tests/templates.cpp @@ -3,18 +3,25 @@ #include "../c++/test/suite.hpp" namespace { -struct Foo{}; - -struct Bar{}; -struct Baz{}; - -SAW_TEST("Templates/Reduce tmpl_group<T...>"){ +SAW_TEST("Templates/Group Reduction"){ using namespace saw; - using DuplGrp = tmpl_group<Bar,Baz,Baz,Bar,Foo,Bar,Baz,Bar,Bar>; + struct foo { + std::string name = "foo"; + }; + struct bar { + std::string name = "bar"; + }; + struct baz { + std::string name = "baz"; + }; - using UniqGrp = tmpl_group<Foo,Baz,Bar>; + using grp = tmpl_group<foo, bar, baz, foo, bar, foo>; + using red_grp = tmpl_group<baz, bar, foo>; - SAW_EXPECT((std::is_same_v<DuplGrp,UniqGrp>), "Expected Uniquess Reduction"); + using alg_red_grp = tmpl_reduce<grp>::type; + + static_assert(std::is_same_v<alg_red_grp, red_grp>, "Should be same type"); + SAW_EXPECT((std::is_same_v<alg_red_grp, red_grp>), "Should be same type"); } } |