atouint.c revision 1.1.1.1
1#include "config.h"
2
3#include "ntp_stdlib.h"
4#include "ntp_calendar.h"
5#include "ntp_fp.h"
6
7#include "unity.h"
8
9void test_RegularPositive() {
10	const char *str = "305";
11	u_long actual;
12
13	TEST_ASSERT_TRUE(atouint(str, &actual));
14	TEST_ASSERT_EQUAL(305, actual);
15}
16
17void test_PositiveOverflowBoundary() {
18	const char *str = "4294967296";
19	u_long actual;
20
21	TEST_ASSERT_FALSE(atouint(str, &actual));
22}
23
24void test_PositiveOverflowBig() {
25	const char *str = "8000000000";
26	u_long actual;
27
28	TEST_ASSERT_FALSE(atouint(str, &actual));
29}
30
31void test_Negative() {
32	const char *str = "-1";
33	u_long actual;
34
35	TEST_ASSERT_FALSE(atouint(str, &actual));
36}
37
38void test_IllegalChar() {
39	const char *str = "50c3";
40	u_long actual;
41
42	TEST_ASSERT_FALSE(atouint(str, &actual));
43}
44