#include #include #include "../c++/schema.h" #include "../c++/schema_hash.h" namespace { template struct schema_hash_test { static_assert(saw::always_false, "Needs the test pair"); }; template struct schema_test_pair{}; template struct schema_hash_test> { static void check(){ using namespace saw; uint64_t hash = schema_hash::apply(); SAW_EXPECT( hash == expected, std::string{"Hash for "} + std::string{T::name.view()} + " is " + std::to_string(hash) +", but should be "+ std::to_string(expected) + "."); } }; template struct schema_hash_test_multi { template static void check_ele(){ using type = typename saw::parameter_pack_type::type; schema_hash_test::check(); if constexpr ( (i+1) < sizeof...(T)){ check_ele(); } } static void check(){ if constexpr (sizeof...(T) > 0){ check_ele<0>(); } } }; namespace schema { using namespace saw::schema; } SAW_TEST("Schema Hashes"){ using namespace saw; schema_hash_test_multi< schema_test_pair, schema_test_pair, schema_test_pair, schema_test_pair, schema_test_pair, schema_test_pair, schema_test_pair, schema_test_pair, schema_test_pair, schema_test_pair, schema_test_pair, schema_test_pair, schema_test_pair, schema_test_pair >::check(); } }