3 #include "ntp_stdlib.h"
4 #include "ntp_calendar.h"
10 void test_SingleDigit(void) {
11 const char *str = "a"; // 10 decimal
14 TEST_ASSERT_TRUE(hextoint(str, &actual));
15 TEST_ASSERT_EQUAL(10, actual);
18 void test_MultipleDigits(void) {
19 const char *str = "8F3"; // 2291 decimal
22 TEST_ASSERT_TRUE(hextoint(str, &actual));
23 TEST_ASSERT_EQUAL(2291, actual);
26 void test_MaxUnsigned(void) {
27 const char *str = "ffffffff"; // 4294967295 decimal
30 TEST_ASSERT_TRUE(hextoint(str, &actual));
31 TEST_ASSERT_EQUAL(4294967295UL, actual);
34 void test_Overflow(void) {
35 const char *str = "100000000"; // Overflow by 1
38 TEST_ASSERT_FALSE(hextoint(str, &actual));
41 void test_IllegalChar(void) {
42 const char *str = "5gb"; // Illegal character g
45 TEST_ASSERT_FALSE(hextoint(str, &actual));