3 #include "ntp_stdlib.h"
7 void test_SingleDigit(void) {
11 TEST_ASSERT_TRUE(octtoint(str, &actual) );
12 TEST_ASSERT_EQUAL(5, actual);
15 void test_MultipleDigits(void){
16 const char* str = "271";
19 TEST_ASSERT_TRUE(octtoint(str, &actual) );
20 TEST_ASSERT_EQUAL(185, actual);
25 const char* str = "0";
28 TEST_ASSERT_TRUE(octtoint(str, &actual) );
29 TEST_ASSERT_EQUAL(0, actual);
33 void test_MaximumUnsigned32bit(void){
34 const char* str = "37777777777";
37 TEST_ASSERT_TRUE(octtoint(str, &actual) );
38 TEST_ASSERT_EQUAL(4294967295UL, actual);
42 void test_Overflow(void){
43 const char* str = "40000000000";
46 TEST_ASSERT_FALSE(octtoint(str, &actual) );
50 void test_IllegalCharacter(void){
51 const char* str = "5ac2";
54 TEST_ASSERT_FALSE(octtoint(str, &actual) );
58 void test_IllegalDigit(void){
59 const char* str = "5283";
62 TEST_ASSERT_FALSE(octtoint(str, &actual) );