3 #include "ntp_stdlib.h"
8 void test_SingleDigit(void);
9 void test_MultipleDigits(void);
11 void test_MaximumUnsigned32bit(void);
12 void test_Overflow(void);
13 void test_IllegalCharacter(void);
14 void test_IllegalDigit(void);
18 test_SingleDigit(void)
20 const char* str = "5";
23 TEST_ASSERT_TRUE(octtoint(str, &actual));
24 TEST_ASSERT_EQUAL(5, actual);
30 test_MultipleDigits(void)
32 const char* str = "271";
35 TEST_ASSERT_TRUE(octtoint(str, &actual));
36 TEST_ASSERT_EQUAL(185, actual);
44 const char* str = "0";
47 TEST_ASSERT_TRUE(octtoint(str, &actual));
48 TEST_ASSERT_EQUAL(0, actual);
54 test_MaximumUnsigned32bit(void)
56 const char* str = "37777777777";
59 TEST_ASSERT_TRUE(octtoint(str, &actual));
60 TEST_ASSERT_EQUAL(4294967295UL, actual);
68 const char* str = "40000000000";
71 TEST_ASSERT_FALSE(octtoint(str, &actual));
77 test_IllegalCharacter(void)
79 const char* str = "5ac2";
82 TEST_ASSERT_FALSE(octtoint(str, &actual));
88 test_IllegalDigit(void)
90 const char* str = "5283";
93 TEST_ASSERT_FALSE(octtoint(str, &actual));