summaryrefslogtreecommitdiff
path: root/modules/codec/tests/schema.cpp
diff options
context:
space:
mode:
authorClaudius "keldu" Holeksa <mail@keldu.de>2024-01-18 13:03:38 +0100
committerClaudius "keldu" Holeksa <mail@keldu.de>2024-01-18 13:03:38 +0100
commitf528f24036698e2014f370f174abab286ef397b6 (patch)
tree8ac3cec9058b6a2d2392e79b43a7baf8c6c5f38f /modules/codec/tests/schema.cpp
parentfee3e3bcf2fc1d84689b09483dc98a2e73db9915 (diff)
codec: Changed hashing to crc32 and made the calculation constexpr
Diffstat (limited to 'modules/codec/tests/schema.cpp')
-rw-r--r--modules/codec/tests/schema.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/modules/codec/tests/schema.cpp b/modules/codec/tests/schema.cpp
index 871feb7..71e806d 100644
--- a/modules/codec/tests/schema.cpp
+++ b/modules/codec/tests/schema.cpp
@@ -17,7 +17,7 @@ template<typename T, uint64_t expected>
struct schema_hash_test<schema_test_pair<T,expected>> {
static void check(){
using namespace saw;
- uint64_t hash = schema_hash<T>::apply();
+ constexpr uint64_t hash = schema_hash<T>::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) + ".");
}
};
@@ -49,20 +49,20 @@ using namespace saw::schema;
SAW_TEST("Schema Hashes"){
using namespace saw;
schema_hash_test_multi<
- schema_test_pair<schema::UInt8 , 17448981058701187403u>,
- schema_test_pair<schema::UInt16, 17448981058701187400u>,
- schema_test_pair<schema::UInt32, 17448981058701187398u>,
- schema_test_pair<schema::UInt64, 17448981058701187394u>,
- schema_test_pair<schema::Int8 , 856492552766770219u>,
- schema_test_pair<schema::Int16, 856492552766770216u>,
- schema_test_pair<schema::Int32, 856492552766770214u>,
- schema_test_pair<schema::Int64, 856492552766770210u>,
- schema_test_pair<schema::Float32, 14974566471626763725u>,
- schema_test_pair<schema::Float64, 14974566471626763729u>,
- schema_test_pair<schema::SignedInteger, 17576067307413535420u>,
- schema_test_pair<schema::UnsignedInteger, 15327325027193222152u>,
- schema_test_pair<schema::FloatingPoint, 18201377588738489119u>,
- schema_test_pair<schema::String, 3005399793615731798u>
+ schema_test_pair<schema::UInt8 , 958523688>,
+ schema_test_pair<schema::UInt16, 3586362486>,
+ schema_test_pair<schema::UInt32, 147217277>,
+ schema_test_pair<schema::UInt64, 3054299356>,
+ schema_test_pair<schema::Int8 , 1991167534>,
+ schema_test_pair<schema::Int16, 2588715888>,
+ schema_test_pair<schema::Int32, 1195998331>,
+ schema_test_pair<schema::Int64, 4186165210>,
+ schema_test_pair<schema::Float32, 1968068318>,
+ schema_test_pair<schema::Float64, 3414484351>,
+ schema_test_pair<schema::SignedInteger, 2923333106>,
+ schema_test_pair<schema::UnsignedInteger, 3300532028>,
+ schema_test_pair<schema::FloatingPoint, 1860828258>,
+ schema_test_pair<schema::String, 1669061438>
>::check();
}
}