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);
17 void test_SingleDigit(void) {
18 const char* str = "5";
21 TEST_ASSERT_TRUE(octtoint(str, &actual) );
22 TEST_ASSERT_EQUAL(5, actual);
25 void test_MultipleDigits(void){
26 const char* str = "271";
29 TEST_ASSERT_TRUE(octtoint(str, &actual) );
30 TEST_ASSERT_EQUAL(185, actual);
35 const char* str = "0";
38 TEST_ASSERT_TRUE(octtoint(str, &actual) );
39 TEST_ASSERT_EQUAL(0, actual);
43 void test_MaximumUnsigned32bit(void){
44 const char* str = "37777777777";
47 TEST_ASSERT_TRUE(octtoint(str, &actual) );
48 TEST_ASSERT_EQUAL(4294967295UL, actual);
52 void test_Overflow(void){
53 const char* str = "40000000000";
56 TEST_ASSERT_FALSE(octtoint(str, &actual) );
60 void test_IllegalCharacter(void){
61 const char* str = "5ac2";
64 TEST_ASSERT_FALSE(octtoint(str, &actual) );
68 void test_IllegalDigit(void){
69 const char* str = "5283";
72 TEST_ASSERT_FALSE(octtoint(str, &actual) );