]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - contrib/ntp/tests/libntp/g_atouint.cpp
Fix a regression with SA-15:24 patch that prevented NIS from
[FreeBSD/releng/10.2.git] / contrib / ntp / tests / libntp / g_atouint.cpp
1 #include "g_libntptest.h"
2
3 class atouintTest : public libntptest {
4 };
5
6 TEST_F(atouintTest, RegularPositive) {
7         const char *str = "305";
8         u_long actual;
9
10         ASSERT_TRUE(atouint(str, &actual));
11         EXPECT_EQ(305, actual);
12 }
13
14 TEST_F(atouintTest, PositiveOverflowBoundary) {
15         const char *str = "4294967296";
16         u_long actual;
17
18         ASSERT_FALSE(atouint(str, &actual));
19 }
20
21 TEST_F(atouintTest, PositiveOverflowBig) {
22         const char *str = "8000000000";
23         u_long actual;
24
25         ASSERT_FALSE(atouint(str, &actual));
26 }
27
28 TEST_F(atouintTest, Negative) {
29         const char *str = "-1";
30         u_long actual;
31
32         ASSERT_FALSE(atouint(str, &actual));
33 }
34
35 TEST_F(atouintTest, IllegalChar) {
36         const char *str = "50c3";
37         u_long actual;
38
39         ASSERT_FALSE(atouint(str, &actual));
40 }