LCOV - code coverage report
Current view: top level - spdk/test/unit/lib/util/crc32_ieee.c - crc32_ieee_ut.c (source / functions) Hit Total Coverage
Test: Combined Lines: 15 15 100.0 %
Date: 2024-07-11 15:05:21 Functions: 2 2 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       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                 :          4 : test_crc32_ieee(void)
      15                 :            : {
      16                 :            :         uint32_t crc;
      17                 :          4 :         char buf[] = "Hello world!";
      18                 :            : 
      19                 :          4 :         crc = 0xFFFFFFFFu;
      20                 :          4 :         crc = spdk_crc32_ieee_update(buf, strlen(buf), crc);
      21                 :          4 :         crc ^= 0xFFFFFFFFu;
      22                 :          4 :         CU_ASSERT(crc == 0x1b851995);
      23                 :          4 : }
      24                 :            : 
      25                 :            : int
      26                 :          4 : main(int argc, char **argv)
      27                 :            : {
      28                 :          4 :         CU_pSuite       suite = NULL;
      29                 :            :         unsigned int    num_failures;
      30                 :            : 
      31                 :          4 :         CU_initialize_registry();
      32                 :            : 
      33                 :          4 :         suite = CU_add_suite("crc32_ieee", NULL, NULL);
      34                 :            : 
      35                 :          4 :         CU_ADD_TEST(suite, test_crc32_ieee);
      36                 :            : 
      37                 :            : 
      38                 :          4 :         num_failures = spdk_ut_run_tests(argc, argv, NULL);
      39                 :            : 
      40                 :          4 :         CU_cleanup_registry();
      41                 :            : 
      42                 :          4 :         return num_failures;
      43                 :            : }

Generated by: LCOV version 1.14