test_crc32Slow.cpp 914 B

1234567891011121314151617181920212223242526272829303132333435
  1. /*
  2. * Copyright (c) 2021 - 2024 Stefan Strobel <stefan.strobel@shimatta.net>
  3. *
  4. * This Source Code Form is subject to the terms of the Mozilla Public
  5. * License, v. 2.0. If a copy of the MPL was not distributed with this
  6. * file, You can obtain one at https://mozilla.org/MPL/2.0/.
  7. */
  8. /**
  9. * @file test_crc16Slow.h
  10. * @brief unittest implementation for crc16 slow function
  11. * @author Stefan Strobel <stefan.strobel@shimatta.net>
  12. */
  13. #include "test/framework/catch.hpp"
  14. #include <string.h>
  15. #define SHELLMATTA_TRANSPORT
  16. #define SHELLMATTA_TRANSPORT_CRC_NO_LOOKUP
  17. #include "test_crc_data.h"
  18. #include "src/shellmatta_crc.c"
  19. TEST_CASE( "shellmatta_crc crc32Slow" ) {
  20. uint32_t crc = crc32Slow((char*)"123456789", 9);
  21. REQUIRE( crc == 0xCBF43926u);
  22. }
  23. TEST_CASE( "shellmatta_crc crc32Slow - more data" ) {
  24. uint32_t crc = crc32Slow((char*)data, sizeof(data));
  25. REQUIRE(crc == data_crc_32);
  26. }