pytorch/c10/test/util/ConstexprCrc_test.cpp
cyy 3dc479e70b [1/N] Apply clang-tidy to c10/test/*cpp (#109278)
This series of PR enables clang-tidy checks in c10/test. We aim to finally add the path to lintrunner.toml
Pull Request resolved: https://github.com/pytorch/pytorch/pull/109278
Approved by: https://github.com/kit1980
2023-09-29 02:20:57 +00:00

18 lines
518 B
C++

#include <c10/util/ConstexprCrc.h>
using c10::util::crc64;
using c10::util::crc64_t;
// generic tests
static_assert(
crc64("MyTestString") == crc64("MyTestString"),
"crc64 is deterministic");
static_assert(
crc64("MyTestString1") != crc64("MyTestString2"),
"different strings, different result");
// check concrete expected values (for CRC64 with Jones coefficients and an init
// value of 0)
static_assert(crc64_t{0} == crc64(""));
static_assert(crc64_t{0xe9c6d914c4b8d9ca} == crc64("123456789"));