1 #include "../unittest.h"
3 #include "../../lib/strntol.h"
5 static void test_strntol_1(void)
9 long ret = strntol(s, strlen(s), &endp, 10);
11 CU_ASSERT_EQUAL(ret, 12345);
12 CU_ASSERT_NOT_EQUAL(endp, NULL);
13 CU_ASSERT_EQUAL(*endp, '\0');
16 static void test_strntol_2(void)
20 long ret = strntol(s, strlen(s), &endp, 10);
22 CU_ASSERT_EQUAL(ret, 12345);
23 CU_ASSERT_NOT_EQUAL(endp, NULL);
24 CU_ASSERT_EQUAL(*endp, '\0');
27 static void test_strntol_3(void)
31 long ret = strntol(s, strlen(s), &endp, 16);
33 CU_ASSERT_EQUAL(ret, 0x12345);
34 CU_ASSERT_NOT_EQUAL(endp, NULL);
35 CU_ASSERT_EQUAL(*endp, '\0');
38 static struct fio_unittest_entry tests[] = {
56 CU_ErrorCode fio_unittest_lib_strntol(void)
58 return fio_unittest_add_suite("lib/strntol.c", NULL, NULL, tests);