From: Tomek Mrugalski Date: Sun, 14 Jun 2015 22:42:12 +0000 (+0200) Subject: converted a bunch of test from GTest to Unity in test/libntp/ X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6c77f08ae5eec2042a354127776c2b764b0c8f03;p=thirdparty%2Fntp.git converted a bunch of test from GTest to Unity in test/libntp/ bk: 557e0344F1CQ4Ig24xMjfGms9T03eg --- diff --git a/tests/libntp/caltontp.c b/tests/libntp/caltontp.c new file mode 100644 index 000000000..9ce485440 --- /dev/null +++ b/tests/libntp/caltontp.c @@ -0,0 +1,48 @@ +#include "config.h" +#include "unity.h" +#include "ntp_calendar.h" + +void +test_DateGivenMonthDay(void) { + // 2010-06-24 12:50:00 + struct calendar input = {2010, 0, 6, 24, 12, 50, 0}; + + u_long expected = 3486372600UL; // This is the timestamp above. + + TEST_ASSERT_EQUAL_UINT(expected, caltontp(&input)); +} + +void +test_DateGivenYearDay(void) { + // 2010-06-24 12:50:00 + // This is the 175th day of 2010. + struct calendar input = {2010, 175, 0, 0, 12, 50, 0}; + + u_long expected = 3486372600UL; // This is the timestamp above. + + TEST_ASSERT_EQUAL_UINT(expected, caltontp(&input)); +} + +void +test_DateLeapYear(void) { + // 2012-06-24 12:00:00 + // This is the 176th day of 2012 (since 2012 is a leap year). + struct calendar inputYd = {2012, 176, 0, 0, 12, 00, 00}; + struct calendar inputMd = {2012, 0, 6, 24, 12, 00, 00}; + + u_long expected = 3549528000UL; + + TEST_ASSERT_EQUAL_UINT(expected, caltontp(&inputYd)); + TEST_ASSERT_EQUAL_UINT(expected, caltontp(&inputMd)); +} + +void +test_WraparoundDateIn2036(void) { + // 2036-02-07 06:28:16 + // This is (one) wrapping boundary where we go from ULONG_MAX to 0. + struct calendar input = {2036, 0, 2, 7, 6, 28, 16}; + + u_long expected = 0UL; + + TEST_ASSERT_EQUAL_UINT(expected, caltontp(&input)); +} diff --git a/tests/libntp/caltontp.cpp b/tests/libntp/g_caltontp.cpp similarity index 100% rename from tests/libntp/caltontp.cpp rename to tests/libntp/g_caltontp.cpp diff --git a/tests/libntp/msyslog.cpp b/tests/libntp/g_msyslog.cpp similarity index 100% rename from tests/libntp/msyslog.cpp rename to tests/libntp/g_msyslog.cpp diff --git a/tests/libntp/prettydate.cpp b/tests/libntp/g_prettydate.cpp similarity index 100% rename from tests/libntp/prettydate.cpp rename to tests/libntp/g_prettydate.cpp diff --git a/tests/libntp/recvbuff.cpp b/tests/libntp/g_recvbuff.cpp similarity index 100% rename from tests/libntp/recvbuff.cpp rename to tests/libntp/g_recvbuff.cpp diff --git a/tests/libntp/tstotv.cpp b/tests/libntp/g_tstotv.cpp similarity index 100% rename from tests/libntp/tstotv.cpp rename to tests/libntp/g_tstotv.cpp diff --git a/tests/libntp/vi64ops.cpp b/tests/libntp/g_vi64ops.cpp similarity index 100% rename from tests/libntp/vi64ops.cpp rename to tests/libntp/g_vi64ops.cpp diff --git a/tests/libntp/msyslog.c b/tests/libntp/msyslog.c new file mode 100644 index 000000000..5e2a1f82e --- /dev/null +++ b/tests/libntp/msyslog.c @@ -0,0 +1,137 @@ +#include "config.h" +#include "ntp_stdlib.h" +#include +#include +#include +#include "unity.h" + +#ifndef VSNPRINTF_PERCENT_M +// format_errmsg() is normally private to msyslog.c +void format_errmsg (char *, size_t, const char *, int); +#endif + + + +void test_msnprintf(void) { +#define FMT_PREFIX "msyslog.cpp ENOENT: " + char exp_buf[512]; + char act_buf[512]; + int exp_cnt; + int act_cnt; + + exp_cnt = snprintf(exp_buf, sizeof(exp_buf), FMT_PREFIX "%s", + strerror(ENOENT)); + errno = ENOENT; + act_cnt = msnprintf(act_buf, sizeof(act_buf), FMT_PREFIX "%m"); + TEST_ASSERT_EQUAL(exp_cnt, act_cnt); + TEST_ASSERT_EQUAL_STRING(exp_buf, act_buf); +} + +void +test_msnprintfLiteralPercentm(void) +{ + char exp_buf[32]; + char act_buf[32]; + int exp_cnt; + int act_cnt; + + exp_cnt = snprintf(exp_buf, sizeof(exp_buf), "%%m"); + errno = ENOENT; + act_cnt = msnprintf(act_buf, sizeof(act_buf), "%%m"); + TEST_ASSERT_EQUAL(exp_cnt, act_cnt); + TEST_ASSERT_EQUAL_STRING(exp_buf, act_buf); +} + +void +test_msnprintfBackslashLiteralPercentm(void) { + char exp_buf[32]; + char act_buf[32]; + int exp_cnt; + int act_cnt; + + exp_cnt = snprintf(exp_buf, sizeof(exp_buf), "\%%m"); + errno = ENOENT; + act_cnt = msnprintf(act_buf, sizeof(act_buf), "\%%m"); + TEST_ASSERT_EQUAL(exp_cnt, act_cnt); + TEST_ASSERT_EQUAL_STRING(exp_buf, act_buf); +} + +void +test_msnprintfBackslashPercent(void) { + char exp_buf[32]; + char act_buf[32]; + int exp_cnt; + int act_cnt; + + exp_cnt = snprintf(exp_buf, sizeof(exp_buf), "\%s", + strerror(ENOENT)); + errno = ENOENT; + act_cnt = msnprintf(act_buf, sizeof(act_buf), "\%m"); + TEST_ASSERT_EQUAL(exp_cnt, act_cnt); + TEST_ASSERT_EQUAL_STRING(exp_buf, act_buf); +} + +void +test_msnprintfHangingPercent(void) { + static char fmt[] = "percent then nul term then non-nul %\0oops!"; + char exp_buf[64]; + char act_buf[64]; + int exp_cnt; + int act_cnt; + + ZERO(exp_buf); + ZERO(act_buf); + exp_cnt = snprintf(exp_buf, sizeof(exp_buf), fmt); + act_cnt = msnprintf(act_buf, sizeof(act_buf), fmt); + TEST_ASSERT_EQUAL(exp_cnt, act_cnt); + TEST_ASSERT_EQUAL_STRING(exp_buf, act_buf); + TEST_ASSERT_EQUAL_STRING("", act_buf + 1 + strlen(act_buf)); +} + +void +test_format_errmsgHangingPercent(void) { +#ifndef VSNPRINTF_PERCENT_M + static char fmt[] = "percent then nul term then non-nul %\0oops!"; + char act_buf[64]; + + ZERO(act_buf); + format_errmsg(act_buf, sizeof(act_buf), fmt, ENOENT); + TEST_ASSERT_EQUAL_STRING(fmt, act_buf); + TEST_ASSERT_EQUAL_STRING("", act_buf + 1 + strlen(act_buf)); +#else + TEST_IGNORE_MESSAGE("VSNPRINTF_PERCENT_M is defined") +#endif +} + +void +test_msnprintfNullTarget(void) { + int exp_cnt; + int act_cnt; + + exp_cnt = snprintf(NULL, 0, "%d", 123); + errno = ENOENT; + act_cnt = msnprintf(NULL, 0, "%d", 123); + TEST_ASSERT_EQUAL(exp_cnt, act_cnt); +} + +void +test_msnprintfTruncate(void) { + char undist[] = "undisturbed"; + char exp_buf[512]; + char act_buf[512]; + int exp_cnt; + int act_cnt; + + memcpy(exp_buf + 3, undist, sizeof(undist)); + memcpy(act_buf + 3, undist, sizeof(undist)); + exp_cnt = snprintf(exp_buf, 3, "%s", strerror(ENOENT)); + errno = ENOENT; + act_cnt = msnprintf(act_buf, 3, "%m"); + TEST_ASSERT_EQUAL('\0', exp_buf[2]); + TEST_ASSERT_EQUAL('\0', act_buf[2]); + TEST_ASSERT_TRUE(act_cnt > 0); + TEST_ASSERT_EQUAL(exp_cnt, act_cnt); + TEST_ASSERT_EQUAL_STRING(exp_buf, act_buf); + TEST_ASSERT_EQUAL_STRING(exp_buf + 3, undist); + TEST_ASSERT_EQUAL_STRING(act_buf + 3, undist); +} diff --git a/tests/libntp/prettydate.c b/tests/libntp/prettydate.c new file mode 100644 index 000000000..c68dda0ed --- /dev/null +++ b/tests/libntp/prettydate.c @@ -0,0 +1,16 @@ +#include "config.h" + +#include "ntp_stdlib.h" +#include "ntp_calendar.h" +#include "ntp_fp.h" +#include "unity.h" + +void +test_ConstantDate(void) { + const u_int32 HALF = 2147483648UL; + + l_fp time = {3485080800UL, HALF}; // 2010-06-09 14:00:00.5 + + TEST_ASSERT_EQUAL_STRING("cfba1ce0.80000000 Wed, Jun 9 2010 14:00:00.500", + gmprettydate(&time)); +} \ No newline at end of file diff --git a/tests/libntp/recvbuff.c b/tests/libntp/recvbuff.c new file mode 100644 index 000000000..b4bbe2f79 --- /dev/null +++ b/tests/libntp/recvbuff.c @@ -0,0 +1,43 @@ +//#include "config.h" +#include "testcalshims.h" +#include "recvbuff.h" +#include "unity.h" + +//#include "ntp_stdlib.h" +//#include "libntptest.h" + +void +setUp(void) +{ + init_recvbuff(RECV_INIT); +} + +void +test_Initialization(void) { + TEST_ASSERT_EQUAL_UINT(RECV_INIT, free_recvbuffs()); + TEST_ASSERT_EQUAL_UINT(0, full_recvbuffs()); + TEST_ASSERT_FALSE(has_full_recv_buffer()); + TEST_ASSERT_TRUE(get_full_recv_buffer() == NULL); +} + +void +test_GetAndFree(void) { + u_long initial = free_recvbuffs(); + recvbuf_t* buf = get_free_recv_buffer(); + + TEST_ASSERT_EQUAL_UINT(initial-1, free_recvbuffs()); + freerecvbuf(buf); + TEST_ASSERT_EQUAL_UINT(initial, free_recvbuffs()); +} + + +void +test_GetAndFill(void) { + int initial = free_recvbuffs(); + recvbuf_t* buf = get_free_recv_buffer(); + + add_full_recv_buffer(buf); + TEST_ASSERT_EQUAL_UINT(1, full_recvbuffs()); + TEST_ASSERT_TRUE(has_full_recv_buffer()); + TEST_ASSERT_EQUAL_PTR(buf, get_full_recv_buffer()); +} \ No newline at end of file diff --git a/tests/libntp/run-test-caltontp.c b/tests/libntp/run-test-caltontp.c new file mode 100644 index 000000000..b7b6626bf --- /dev/null +++ b/tests/libntp/run-test-caltontp.c @@ -0,0 +1,57 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_DateGivenMonthDay(void); +extern void test_DateGivenYearDay(void); +extern void test_DateLeapYear(void); +extern void test_WraparoundDateIn2036(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + +char *progname; + + +//=======MAIN===== +int main(int argc, char *argv[]) +{ + progname = argv[0]; + Unity.TestFile = "caltontp.c"; + UnityBegin("caltontp.c"); + RUN_TEST(test_DateGivenMonthDay, 6); + RUN_TEST(test_DateGivenYearDay, 16); + RUN_TEST(test_DateLeapYear, 27); + RUN_TEST(test_WraparoundDateIn2036, 40); + + return (UnityEnd()); +} diff --git a/tests/libntp/run-test-msyslog.c b/tests/libntp/run-test-msyslog.c new file mode 100644 index 000000000..8ec7c24c6 --- /dev/null +++ b/tests/libntp/run-test-msyslog.c @@ -0,0 +1,65 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_msnprintf(void); +extern void test_msnprintfLiteralPercentm(void); +extern void test_msnprintfBackslashLiteralPercentm(void); +extern void test_msnprintfBackslashPercent(void); +extern void test_msnprintfHangingPercent(void); +extern void test_format_errmsgHangingPercent(void); +extern void test_msnprintfNullTarget(void); +extern void test_msnprintfTruncate(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + +char *progname; + + +//=======MAIN===== +int main(int argc, char *argv[]) +{ + progname = argv[0]; + Unity.TestFile = "msyslog.c"; + UnityBegin("msyslog.c"); + RUN_TEST(test_msnprintf, 15); + RUN_TEST(test_msnprintfLiteralPercentm, 31); + RUN_TEST(test_msnprintfBackslashLiteralPercentm, 46); + RUN_TEST(test_msnprintfBackslashPercent, 60); + RUN_TEST(test_msnprintfHangingPercent, 75); + RUN_TEST(test_format_errmsgHangingPercent, 92); + RUN_TEST(test_msnprintfNullTarget, 107); + RUN_TEST(test_msnprintfTruncate, 118); + + return (UnityEnd()); +} diff --git a/tests/libntp/run-test-prettydate.c b/tests/libntp/run-test-prettydate.c new file mode 100644 index 000000000..cafdad41f --- /dev/null +++ b/tests/libntp/run-test-prettydate.c @@ -0,0 +1,51 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_ConstantDate(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + +char *progname; + + +//=======MAIN===== +int main(int argc, char *argv[]) +{ + progname = argv[0]; + Unity.TestFile = "prettydate.c"; + UnityBegin("prettydate.c"); + RUN_TEST(test_ConstantDate, 9); + + return (UnityEnd()); +} diff --git a/tests/libntp/run-test-recvbuff.c b/tests/libntp/run-test-recvbuff.c new file mode 100644 index 000000000..75adc6b4c --- /dev/null +++ b/tests/libntp/run-test-recvbuff.c @@ -0,0 +1,55 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_Initialization(void); +extern void test_GetAndFree(void); +extern void test_GetAndFill(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + +char *progname; + + +//=======MAIN===== +int main(int argc, char *argv[]) +{ + progname = argv[0]; + Unity.TestFile = "recvbuff.c"; + UnityBegin("recvbuff.c"); + RUN_TEST(test_Initialization, 16); + RUN_TEST(test_GetAndFree, 24); + RUN_TEST(test_GetAndFill, 35); + + return (UnityEnd()); +} diff --git a/tests/libntp/run-test-tstotv.c b/tests/libntp/run-test-tstotv.c new file mode 100644 index 000000000..34807b319 --- /dev/null +++ b/tests/libntp/run-test-tstotv.c @@ -0,0 +1,55 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_Seconds(void); +extern void test_MicrosecondsExact(void); +extern void test_MicrosecondsRounding(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + +char *progname; + + +//=======MAIN===== +int main(int argc, char *argv[]) +{ + progname = argv[0]; + Unity.TestFile = "tstotv.c"; + UnityBegin("tstotv.c"); + RUN_TEST(test_Seconds, 7); + RUN_TEST(test_MicrosecondsExact, 19); + RUN_TEST(test_MicrosecondsRounding, 33); + + return (UnityEnd()); +} diff --git a/tests/libntp/run-test-vi64ops.c b/tests/libntp/run-test-vi64ops.c new file mode 100644 index 000000000..2deae5cd7 --- /dev/null +++ b/tests/libntp/run-test-vi64ops.c @@ -0,0 +1,55 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_ParseVUI64_pos(void); +extern void test_ParseVUI64_neg(void); +extern void test_ParseVUI64_case(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + +char *progname; + + +//=======MAIN===== +int main(int argc, char *argv[]) +{ + progname = argv[0]; + Unity.TestFile = "vi64ops.c"; + UnityBegin("vi64ops.c"); + RUN_TEST(test_ParseVUI64_pos, 7); + RUN_TEST(test_ParseVUI64_neg, 23); + RUN_TEST(test_ParseVUI64_case, 39); + + return (UnityEnd()); +} diff --git a/tests/libntp/tstotv.c b/tests/libntp/tstotv.c new file mode 100644 index 000000000..87f6ad7b8 --- /dev/null +++ b/tests/libntp/tstotv.c @@ -0,0 +1,42 @@ +#include "config.h" +#include "ntp_fp.h" +#include "timevalops.h" +#include "unity.h" + +void +test_Seconds(void) { + const l_fp input = {50, 0}; // 50.0 s + const struct timeval expected = {50, 0}; + struct timeval actual; + + TSTOTV(&input, &actual); + + TEST_ASSERT_EQUAL(expected.tv_sec, actual.tv_sec); + TEST_ASSERT_EQUAL(expected.tv_usec, actual.tv_usec); +} + +void +test_MicrosecondsExact(void) { + const u_long HALF = 2147483648UL; + const l_fp input = {50, HALF}; // 50.5 s + const struct timeval expected = {50, 500000}; + struct timeval actual; + + TSTOTV(&input, &actual); + + TEST_ASSERT_EQUAL(expected.tv_sec, actual.tv_sec); + TEST_ASSERT_EQUAL(expected.tv_usec, actual.tv_usec); + +} + +void +test_MicrosecondsRounding(void) { + const l_fp input = {50, 3865471UL}; // Should round to 50.0009 + const struct timeval expected = {50, 900}; + struct timeval actual; + + TSTOTV(&input, &actual); + + TEST_ASSERT_EQUAL(expected.tv_sec, actual.tv_sec); + TEST_ASSERT_EQUAL(expected.tv_usec, actual.tv_usec); +} \ No newline at end of file diff --git a/tests/libntp/vi64ops.c b/tests/libntp/vi64ops.c new file mode 100644 index 000000000..f1b492b5f --- /dev/null +++ b/tests/libntp/vi64ops.c @@ -0,0 +1,52 @@ +#include "config.h" +#include "ntp_stdlib.h" +#include "vint64ops.h" +#include "unity.h" + +void +test_ParseVUI64_pos(void) { + vint64 act, exp; + const char *sp; + char *ep; + + sp = "1234x"; + exp.D_s.hi = 0; + exp.D_s.lo = 1234; + act = strtouv64(sp, &ep, 0); + + TEST_ASSERT_EQUAL_HEX(exp.D_s.hi, act.D_s.hi); + TEST_ASSERT_EQUAL_HEX(exp.D_s.lo, act.D_s.lo); + TEST_ASSERT_EQUAL(*ep, 'x'); +} + +void +test_ParseVUI64_neg(void) { + vint64 act, exp; + const char *sp; + char *ep; + + sp = "-1234x"; + exp.D_s.hi = ~0; + exp.D_s.lo = -1234; + act = strtouv64(sp, &ep, 0); + + TEST_ASSERT_EQUAL_HEX(exp.D_s.hi, act.D_s.hi); + TEST_ASSERT_EQUAL_HEX(exp.D_s.lo, act.D_s.lo); + TEST_ASSERT_EQUAL(*ep, 'x'); +} + +void +test_ParseVUI64_case(void) { + vint64 act, exp; + const char *sp; + char *ep; + + sp = "0123456789AbCdEf"; + exp.D_s.hi = 0x01234567; + exp.D_s.lo = 0x89ABCDEF; + act = strtouv64(sp, &ep, 16); + + TEST_ASSERT_EQUAL_HEX(exp.D_s.hi, act.D_s.hi); + TEST_ASSERT_EQUAL_HEX(exp.D_s.lo, act.D_s.lo); + TEST_ASSERT_EQUAL(*ep, '\0'); +}