feat: cJSON, Gerätenamen und HTTP-Parser

This commit is contained in:
Michael Sauer
2026-09-11 22:18:14 +02:00
parent 0648b3a252
commit 4a23df1b8d
12 changed files with 3829 additions and 2 deletions
+45
View File
@@ -0,0 +1,45 @@
#include "unity.h"
#include "net/nl_names.h"
void setUp(void) {}
void tearDown(void) {}
static const uint8_t MAC[6] = {0x28, 0x6D, 0xCD, 0x5C, 0x68, 0x1F};
static void test_suffix(void)
{
char s[5];
nl_names_mac_suffix(MAC, s);
TEST_ASSERT_EQUAL_STRING("681f", s);
}
static void test_hostname(void)
{
char h[24];
nl_names_hostname(MAC, h, sizeof h);
TEST_ASSERT_EQUAL_STRING("ninlight-681f", h);
}
static void test_hostname_truncates_safely(void)
{
char h[8];
nl_names_hostname(MAC, h, sizeof h);
TEST_ASSERT_EQUAL_STRING("ninligh", h);
}
static void test_mac_str(void)
{
char m[18];
nl_names_mac_str(MAC, m);
TEST_ASSERT_EQUAL_STRING("28:6d:cd:5c:68:1f", m);
}
int main(void)
{
UNITY_BEGIN();
RUN_TEST(test_suffix);
RUN_TEST(test_hostname);
RUN_TEST(test_hostname_truncates_safely);
RUN_TEST(test_mac_str);
return UNITY_END();
}