sglang_v0.5.2/pytorch_2.8.0/c10/test/util/ConstexprCrc_test.cpp

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"));