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