test: Host-Testumgebung mit Unity, SHA256 und CRC
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
#include "unity.h"
|
||||
#include "util/nl_crc.h"
|
||||
|
||||
void setUp(void) {}
|
||||
void tearDown(void) {}
|
||||
|
||||
static void test_crc32_check_value(void)
|
||||
{
|
||||
TEST_ASSERT_EQUAL_HEX32(0xCBF43926u, nl_crc32(0, "123456789", 9));
|
||||
}
|
||||
|
||||
static void test_crc32_empty_is_zero(void)
|
||||
{
|
||||
TEST_ASSERT_EQUAL_HEX32(0u, nl_crc32(0, "", 0));
|
||||
}
|
||||
|
||||
static void test_crc32_chaining(void)
|
||||
{
|
||||
uint32_t c = nl_crc32(0, "1234", 4);
|
||||
TEST_ASSERT_EQUAL_HEX32(0xCBF43926u, nl_crc32(c, "56789", 5));
|
||||
}
|
||||
|
||||
static void test_crc8_check_value(void)
|
||||
{
|
||||
TEST_ASSERT_EQUAL_HEX8(0xF4, nl_crc8("123456789", 9));
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
UNITY_BEGIN();
|
||||
RUN_TEST(test_crc32_check_value);
|
||||
RUN_TEST(test_crc32_empty_is_zero);
|
||||
RUN_TEST(test_crc32_chaining);
|
||||
RUN_TEST(test_crc8_check_value);
|
||||
return UNITY_END();
|
||||
}
|
||||
Reference in New Issue
Block a user