1 /* SPDX-License-Identifier: BSD-3-Clause 2 * Copyright (C) 2017 Intel Corporation. 3 * All rights reserved. 4 */ 5 6 #include "spdk/stdinc.h" 7 8 #include "spdk_internal/cunit.h" 9 10 #include "util/crc32.c" 11 #include "util/crc32_ieee.c" 12 13 static void 14 test_crc32_ieee(void) 15 { 16 uint32_t crc; 17 char buf[] = "Hello world!"; 18 19 crc = 0xFFFFFFFFu; 20 crc = spdk_crc32_ieee_update(buf, strlen(buf), crc); 21 crc ^= 0xFFFFFFFFu; 22 CU_ASSERT(crc == 0x1b851995); 23 } 24 25 int 26 main(int argc, char **argv) 27 { 28 CU_pSuite suite = NULL; 29 unsigned int num_failures; 30 31 CU_initialize_registry(); 32 33 suite = CU_add_suite("crc32_ieee", NULL, NULL); 34 35 CU_ADD_TEST(suite, test_crc32_ieee); 36 37 38 num_failures = spdk_ut_run_tests(argc, argv, NULL); 39 40 CU_cleanup_registry(); 41 42 return num_failures; 43 } 44