3 #include "ntp_stdlib.h"
9 int IsEqual(const vint64 expected, const vint64 actual);
10 void test_ParseVUI64_pos(void);
11 void test_ParseVUI64_neg(void);
12 void test_ParseVUI64_case(void);
17 IsEqual(const vint64 expected, const vint64 actual) {
18 if (0 == memcmp(&expected, &actual, sizeof(vint64))) {
19 printf( "%x.", expected.D_s.hi);
20 printf("%x", expected.D_s.lo);
22 printf("%x.", actual.D_s.hi);
23 printf("%x\n", actual.D_s.lo);
27 printf( "%d.", expected.D_s.hi);
28 printf("%d", expected.D_s.lo);
30 printf("%d", actual.D_s.lo);
31 printf("%d", actual.D_s.lo);
36 // ----------------------------------------------------------------------
39 test_ParseVUI64_pos(void) {
47 act = strtouv64(sp, &ep, 0);
49 TEST_ASSERT_TRUE(IsEqual(exp, act));
50 TEST_ASSERT_EQUAL(*ep, 'x');
55 test_ParseVUI64_neg(void) {
63 act = strtouv64(sp, &ep, 0);
64 TEST_ASSERT_TRUE(IsEqual(exp, act));
65 TEST_ASSERT_EQUAL(*ep, 'x');
69 test_ParseVUI64_case(void) {
74 sp = "0123456789AbCdEf";
75 exp.D_s.hi = 0x01234567;
76 exp.D_s.lo = 0x89ABCDEF;
77 act = strtouv64(sp, &ep, 16);
78 TEST_ASSERT_TRUE(IsEqual(exp, act));
79 TEST_ASSERT_EQUAL(*ep, '\0');