test_crc16Slow.cpp 903 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_YMODEM_CRC_NO_LOOKUP
  17. #include "test_crc_data.h"
  18. #include "src/shellmatta_crc.c"
  19. TEST_CASE("shellmatta_crc crc16Slow" ) {
  20. uint32_t crc = crc16Slow((char*)"123456789", 9);
  21. REQUIRE(crc == 0x31C3u);
  22. }
  23. TEST_CASE("shellmatta_crc crc16Slow - more data") {
  24. uint32_t crc = crc16Slow((char*)data, sizeof(data));
  25. REQUIRE(crc == data_crc_16);
  26. }