xref: /aosp_15_r20/external/pytorch/c10/test/util/ConstexprCrc_test.cpp (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1 #include <c10/util/ConstexprCrc.h>
2 
3 using c10::util::crc64;
4 using c10::util::crc64_t;
5 
6 // generic tests
7 static_assert(
8     crc64("MyTestString") == crc64("MyTestString"),
9     "crc64 is deterministic");
10 static_assert(
11     crc64("MyTestString1") != crc64("MyTestString2"),
12     "different strings, different result");
13 
14 // check concrete expected values (for CRC64 with Jones coefficients and an init
15 // value of 0)
16 static_assert(crc64_t{0} == crc64(""));
17 static_assert(crc64_t{0xe9c6d914c4b8d9ca} == crc64("123456789"));
18