From dfa18f7d73c6ff24c34c5630d9b6ceaf4e7ed144 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Fri, 24 Jan 2014 20:46:39 -0800 Subject: [PATCH] unit: Add simple test case for ntoh64 hton64 functions --- unit/test-lib.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/unit/test-lib.c b/unit/test-lib.c index def133a3d..8b039cb7a 100644 --- a/unit/test-lib.c +++ b/unit/test-lib.c @@ -33,6 +33,20 @@ #include "lib/sdp.h" #include "lib/sdp_lib.h" +static void test_ntoh64(void) +{ + uint64_t test = 0x123456789abcdef; + + g_assert(ntoh64(test) == be64toh(test)); +} + +static void test_hton64(void) +{ + uint64_t test = 0x123456789abcdef; + + g_assert(hton64(test) == htobe64(test)); +} + static void test_sdp_get_access_protos_valid(void) { sdp_record_t *rec; @@ -439,6 +453,9 @@ int main(int argc, char *argv[]) { g_test_init(&argc, &argv, NULL); + g_test_add_func("/lib/ntoh64", test_ntoh64); + g_test_add_func("/lib/hton64", test_hton64); + g_test_add_func("/lib/sdp_get_access_protos/valid", test_sdp_get_access_protos_valid); g_test_add_func("/lib/sdp_get_access_protos/nodata", -- 2.47.3