Skip to content

Commit

Permalink
packed_tuple/crc32: test all implementations
Browse files Browse the repository at this point in the history
  • Loading branch information
yumkam committed May 13, 2024
1 parent 79ee3b6 commit 2dd456a
Showing 1 changed file with 25 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,10 @@ using namespace std::chrono_literals;
static volatile bool IsVerbose = false;
#define CTEST (IsVerbose ? Cerr : Cnull)

Y_UNIT_TEST_SUITE(TestHash) {

Y_UNIT_TEST(TestCalculateCRC32) {
if (!NX86::HaveAVX2())
return;

using TTraits = NSimd::TSimdAVX2Traits;
namespace {

template <typename TTraits>
void TestCalculateCRC32_Impl() {
std::mt19937_64 rng; // fixed-seed (0) prng
std::vector<ui64> v(1024);
std::generate(v.begin(), v.end(), rng);
Expand All @@ -59,6 +55,28 @@ Y_UNIT_TEST(TestCalculateCRC32) {
}
}

Y_UNIT_TEST_SUITE(TestHash) {

Y_UNIT_TEST(TestCalculateCRC32Fallback) {
TestCalculateCRC32_Impl<NSimd::TSimdFallbackTraits>();
}

Y_UNIT_TEST(TestCalculateCRC32SSE42) {
if (NX86::HaveSSE42())
TestCalculateCRC32_Impl<NSimd::TSimdSSE42Traits>();
else
CTEST << "Skipped SSE42 test\n";
}

Y_UNIT_TEST(TestCalculateCRC32AVX2) {
if (NX86::HaveAVX2())
TestCalculateCRC32_Impl<NSimd::TSimdAVX2Traits>();
else
CTEST << "Skipped AVX2 test\n";
}

}

Y_UNIT_TEST_SUITE(TupleLayout) {
Y_UNIT_TEST(CreateLayout) {

Expand Down

0 comments on commit 2dd456a

Please sign in to comment.