Dynamic MPMCQueue: Eliminate cases of enqueue indefinite blocking and failure in...
[folly.git] / folly / test / ChecksumTest.cpp
index 0d7bde12a20fda6bf9f6a74c4e6e124c66f20d78..16489dce970410fa9d54e974945f00671dede894 100644 (file)
@@ -17,6 +17,7 @@
 #include <folly/Checksum.h>
 
 #include <boost/crc.hpp>
+
 #include <folly/Benchmark.h>
 #include <folly/Hash.h>
 #include <folly/detail/ChecksumDetail.h>
@@ -120,6 +121,19 @@ TEST(Checksum, crc32c_hardware) {
   }
 }
 
+TEST(Checksum, crc32c_hardware_eq) {
+  if (folly::detail::crc32c_hw_supported()) {
+    for (int i = 0; i < 1000; i++) {
+      auto sw = folly::detail::crc32c_sw(buffer, i, 0);
+      auto hw = folly::detail::crc32c_hw(buffer, i, 0);
+      EXPECT_EQ(sw, hw);
+    }
+  } else {
+    LOG(WARNING) << "skipping hardware-accelerated CRC-32C tests"
+                 << " (not supported on this CPU)";
+  }
+}
+
 TEST(Checksum, crc32c_continuation_hardware) {
   if (folly::detail::crc32c_hw_supported()) {
     testCRC32CContinuation(folly::detail::crc32c_hw);