mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
parent
9db8d671ab
commit
1fedd456ce
@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup sys_crc_crc16_ccitt
|
||||
* @ingroup sys_checksum_crc16_ccitt
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
@ -21,7 +21,7 @@
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "crc/crc16_ccitt.h"
|
||||
#include "checksum/crc16_ccitt.h"
|
||||
|
||||
static const uint16_t _crc16_lookuptable[256] = {
|
||||
0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7,
|
@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup sys_crc CRC Cyclic redundancy checks
|
||||
* @defgroup sys_checksum Checksum
|
||||
* @ingroup sys
|
||||
* @brief CRC hashing functions
|
||||
* @brief Checksum function libraries
|
||||
*/
|
@ -7,8 +7,8 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup sys_crc_crc16_ccitt CRC16-CCITT
|
||||
* @ingroup sys_crc
|
||||
* @defgroup sys_checksum_crc16_ccitt CRC16-CCITT
|
||||
* @ingroup sys_checksum
|
||||
*
|
||||
* @brief CRC16-CCITT checksum algorithm
|
||||
* @details This implementation of CRC16 is based on the CCITT
|
1
tests/unittests/tests-checksum/Makefile.include
Normal file
1
tests/unittests/tests-checksum/Makefile.include
Normal file
@ -0,0 +1 @@
|
||||
USEMODULE += checksum
|
@ -10,9 +10,9 @@
|
||||
|
||||
#include "embUnit/embUnit.h"
|
||||
|
||||
#include "crc/crc16_ccitt.h"
|
||||
#include "checksum/crc16_ccitt.h"
|
||||
|
||||
#include "tests-crc.h"
|
||||
#include "tests-checksum.h"
|
||||
|
||||
static int calc_and_compare_crc_with_update(const unsigned char *buf,
|
||||
size_t len, size_t split, uint16_t expected)
|
||||
@ -32,7 +32,7 @@ static int calc_and_compare_crc(const unsigned char *buf, size_t len,
|
||||
return result == expected;
|
||||
}
|
||||
|
||||
static void test_crc_crc16_ccitt_sequence(void)
|
||||
static void test_checksum_crc16_ccitt_sequence(void)
|
||||
{
|
||||
/* Reference values according to
|
||||
* http://srecord.sourceforge.net/crc16-ccitt.html */
|
||||
@ -85,13 +85,13 @@ static void test_crc_crc16_ccitt_sequence(void)
|
||||
}
|
||||
}
|
||||
|
||||
Test *tests_crc_crc16_ccitt_tests(void)
|
||||
Test *tests_checksum_crc16_ccitt_tests(void)
|
||||
{
|
||||
EMB_UNIT_TESTFIXTURES(fixtures) {
|
||||
new_TestFixture(test_crc_crc16_ccitt_sequence),
|
||||
new_TestFixture(test_checksum_crc16_ccitt_sequence),
|
||||
};
|
||||
|
||||
EMB_UNIT_TESTCALLER(crc_crc16_ccitt_tests, NULL, NULL, fixtures);
|
||||
EMB_UNIT_TESTCALLER(checksum_crc16_ccitt_tests, NULL, NULL, fixtures);
|
||||
|
||||
return (Test *)&crc_crc16_ccitt_tests;
|
||||
return (Test *)&checksum_crc16_ccitt_tests;
|
||||
}
|
@ -6,9 +6,9 @@
|
||||
* directory for more details.
|
||||
*/
|
||||
|
||||
#include "tests-crc.h"
|
||||
#include "tests-checksum.h"
|
||||
|
||||
void tests_crc(void)
|
||||
void tests_checksum(void)
|
||||
{
|
||||
TESTS_RUN(tests_crc_crc16_ccitt_tests());
|
||||
TESTS_RUN(tests_checksum_crc16_ccitt_tests());
|
||||
}
|
@ -11,7 +11,7 @@
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Unittests for the ``crc`` module
|
||||
* @brief Unittests for the ``checksum`` module
|
||||
*
|
||||
* @author Ludwig Knüpfer <ludwig.knuepfer@fu-berlin.de>
|
||||
*/
|
||||
@ -28,14 +28,14 @@ extern "C" {
|
||||
/**
|
||||
* @brief The entry point of this test suite.
|
||||
*/
|
||||
void tests_crc(void);
|
||||
void tests_checksum(void);
|
||||
|
||||
/**
|
||||
* @brief Generates tests for crc/crc16_ccitt.h
|
||||
* @brief Generates tests for checksum/crc16_ccitt.h
|
||||
*
|
||||
* @return embUnit tests if successful, NULL if not.
|
||||
*/
|
||||
Test *tests_crc_crc16_ccitt_tests(void);
|
||||
Test *tests_checksum_crc16_ccitt_tests(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
@ -1 +0,0 @@
|
||||
USEMODULE += crc
|
Loading…
Reference in New Issue
Block a user