--- /dev/null
+#include "libntptest.h"
+
+class octtointTest : public libntptest {
+};
+
+TEST_F(octtointTest, SingleDigit) {
+ const char* str = "5";
+ u_long actual;
+
+ ASSERT_TRUE(octtoint(str, &actual));
+ EXPECT_EQ(5, actual);
+}
+
+TEST_F(octtointTest, MultipleDigits) {
+ const char* str = "271";
+ u_long actual;
+
+ ASSERT_TRUE(octtoint(str, &actual));
+ EXPECT_EQ(185, actual);
+}
+
+TEST_F(octtointTest, Zero) {
+ const char* str = "0";
+ u_long actual;
+
+ ASSERT_TRUE(octtoint(str, &actual));
+ EXPECT_EQ(0, actual);
+}
+
+TEST_F(octtointTest, MaximumUnsigned32bit) {
+ const char* str = "37777777777";
+ u_long actual;
+
+ ASSERT_TRUE(octtoint(str, &actual));
+ EXPECT_EQ(4294967295UL, actual);
+}
+
+TEST_F(octtointTest, Overflow) {
+ const char* str = "40000000000";
+ u_long actual;
+
+ ASSERT_FALSE(octtoint(str, &actual));
+}
+
+TEST_F(octtointTest, IllegalCharacter) {
+ const char* str = "5ac2";
+ u_long actual;
+
+ ASSERT_FALSE(octtoint(str, &actual));
+}
+
+TEST_F(octtointTest, IllegalDigit) {
+ const char* str = "5283";
+ u_long actual;
+
+ ASSERT_FALSE(octtoint(str, &actual));
+}
--- /dev/null
+#include "testcalshims.h"
+//#include "ntp_fp.h"
+#include "unity.h"
+
+void test_SingleDigit(void) {
+ const char* str = "5";
+ u_long actual;
+
+ TEST_ASSERT_TRUE(octtoint(str, &actual) );
+ TEST_ASSERT_EQUAL(5, actual);
+
+}
+
+void test_MultipleDigits(void){
+ const char* str = "271";
+ u_long actual;
+
+ TEST_ASSERT_TRUE(octtoint(str, &actual) );
+ TEST_ASSERT_EQUAL(185, actual);
+
+}
+
+void test_Zero(void){
+ const char* str = "0";
+ u_long actual;
+
+ TEST_ASSERT_TRUE(octtoint(str, &actual) );
+ TEST_ASSERT_EQUAL(0, actual);
+
+}
+
+void test_MaximumUnsigned32bit(void){
+ const char* str = "37777777777";
+ u_long actual;
+
+ TEST_ASSERT_TRUE(octtoint(str, &actual) );
+ TEST_ASSERT_EQUAL(4294967295UL, actual);
+
+}
+
+void test_Overflow(void){
+ const char* str = "40000000000";
+ u_long actual;
+
+ TEST_ASSERT_FALSE(octtoint(str, &actual) );
+
+}
+
+void test_IllegalCharacter(void){
+ const char* str = "5ac2";
+ u_long actual;
+
+ TEST_ASSERT_FALSE(octtoint(str, &actual) );
+
+}
+
+void test_IllegalDigit(void){
+ const char* str = "5283";
+ u_long actual;
+
+ TEST_ASSERT_FALSE(octtoint(str, &actual) );
+
+}
--- /dev/null
+/* AUTOGENERATED FILE. DO NOT EDIT. */
+
+//=======Test Runner Used To Run Each Test Below=====
+#define RUN_TEST(TestFunc, TestLineNum) \
+{ \
+ Unity.CurrentTestName = #TestFunc; \
+ Unity.CurrentTestLineNumber = TestLineNum; \
+ Unity.NumberOfTests++; \
+ if (TEST_PROTECT()) \
+ { \
+ setUp(); \
+ TestFunc(); \
+ } \
+ if (TEST_PROTECT() && !TEST_IS_IGNORED) \
+ { \
+ tearDown(); \
+ } \
+ UnityConcludeTest(); \
+}
+
+//=======Automagically Detected Files To Include=====
+#include "unity.h"
+#include <setjmp.h>
+#include <stdio.h>
+
+//=======External Functions This Runner Calls=====
+extern void setUp(void);
+extern void tearDown(void);
+extern void test_SingleDigit(void);
+extern void test_MultipleDigits(void);
+extern void test_Zero(void);
+extern void test_MaximumUnsigned32bit(void);
+extern void test_Overflow(void);
+extern void test_IllegalCharacter(void);
+extern void test_IllegalDigit(void);
+
+
+//=======Test Reset Option=====
+void resetTest()
+{
+ tearDown();
+ setUp();
+}
+
+
+//=======MAIN=====
+int main(void)
+{
+ Unity.TestFile = "octtoint.c";
+ UnityBegin("octtoint.c");
+ RUN_TEST(test_SingleDigit, 5);
+ RUN_TEST(test_MultipleDigits, 14);
+ RUN_TEST(test_Zero, 23);
+ RUN_TEST(test_MaximumUnsigned32bit, 32);
+ RUN_TEST(test_Overflow, 41);
+ RUN_TEST(test_IllegalCharacter, 49);
+ RUN_TEST(test_IllegalDigit, 57);
+
+ return (UnityEnd());
+}