#include "../c++/test/suite.hpp" #include "../c++/id.hpp" #include "../c++/string_literal.hpp" #include "../c++/reduce_templates.hpp" namespace { SAW_TEST("ID functionality") { using namespace saw; struct foo {}; id a{1}; id b{1}; id c{2}; /** * The following doesn't compile, so it's commented out as an example */ /** * struct bar {}; * * id d{1}; * * SAW_EXPECT(a == d, "Shouldn't compile"); */ SAW_EXPECT(a == b, "Should be equal"); SAW_EXPECT(a != c, "Shouldn't be equal"); SAW_EXPECT(b != c, "Shouldn't be equal"); SAW_EXPECT(a.get_value() == 1, "Lost original value"); } SAW_TEST("String Literal Append"){ using namespace saw; constexpr string_literal a = "foo"; constexpr string_literal b = "bar"; constexpr string_literal c = a+b; 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; using red_grp = tmpl_group; using alg_red_grp = tmpl_reduce::type; static_assert(std::is_same_v, "Should be same type"); SAW_EXPECT((std::is_same_v), "Should be same type"); } }