1 #include "g_libntptest.h"
3 class octtointTest : public libntptest {
6 TEST_F(octtointTest, SingleDigit) {
10 ASSERT_TRUE(octtoint(str, &actual));
14 TEST_F(octtointTest, MultipleDigits) {
15 const char* str = "271";
18 ASSERT_TRUE(octtoint(str, &actual));
19 EXPECT_EQ(185, actual);
22 TEST_F(octtointTest, Zero) {
23 const char* str = "0";
26 ASSERT_TRUE(octtoint(str, &actual));
30 TEST_F(octtointTest, MaximumUnsigned32bit) {
31 const char* str = "37777777777";
34 ASSERT_TRUE(octtoint(str, &actual));
35 EXPECT_EQ(4294967295UL, actual);
38 TEST_F(octtointTest, Overflow) {
39 const char* str = "40000000000";
42 ASSERT_FALSE(octtoint(str, &actual));
45 TEST_F(octtointTest, IllegalCharacter) {
46 const char* str = "5ac2";
49 ASSERT_FALSE(octtoint(str, &actual));
52 TEST_F(octtointTest, IllegalDigit) {
53 const char* str = "5283";
56 ASSERT_FALSE(octtoint(str, &actual));