[llvm-objdump] - Cleanup the error reporting.
[llvm-complete.git] / unittests / Support / CRCTest.cpp
blob71afb0a4789fc92940ff0aac6d3604864f85f8fb
1 //===- llvm/unittest/Support/CRCTest.cpp - CRC tests ----------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file implements unit tests for CRC calculation functions.
11 //===----------------------------------------------------------------------===//
13 #include "llvm/Support/CRC.h"
14 #include "gtest/gtest.h"
16 using namespace llvm;
18 namespace {
20 TEST(CRCTest, CRC32) {
21 EXPECT_EQ(0x414FA339U,
22 llvm::crc32(
23 0, StringRef("The quick brown fox jumps over the lazy dog")));
24 // CRC-32/ISO-HDLC test vector
25 // http://reveng.sourceforge.net/crc-catalogue/17plus.htm#crc.cat.crc-32c
26 EXPECT_EQ(0xCBF43926U, llvm::crc32(0, StringRef("123456789")));
29 } // end anonymous namespace