3 #include "ntp_stdlib.h"
4 #include "ntp_calendar.h"
7 void test_RegularPositive(void);
8 void test_RegularNegative(void);
9 void test_PositiveOverflowBoundary(void);
10 void test_NegativeOverflowBoundary(void);
11 void test_PositiveOverflowBig(void);
12 void test_IllegalCharacter(void);
16 void test_RegularPositive(void) {
17 const char *str = "17";
20 TEST_ASSERT_TRUE(atoint(str, &val));
21 TEST_ASSERT_EQUAL(17, val);
24 void test_RegularNegative(void) {
25 const char *str = "-20";
28 TEST_ASSERT_TRUE(atoint(str, &val));
29 TEST_ASSERT_EQUAL(-20, val);
32 void test_PositiveOverflowBoundary(void) {
33 const char *str = "2147483648";
36 TEST_ASSERT_FALSE(atoint(str, &val));
39 void test_NegativeOverflowBoundary(void) {
40 const char *str = "-2147483649";
43 TEST_ASSERT_FALSE(atoint(str, &val));
46 void test_PositiveOverflowBig(void) {
47 const char *str = "2300000000";
50 TEST_ASSERT_FALSE(atoint(str, &val));
53 void test_IllegalCharacter(void) {
54 const char *str = "4500l";
57 TEST_ASSERT_FALSE(atoint(str, &val));