]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
Updates to bug-2803 tests
authorHarlan Stenn <stenn@ntp.org>
Sat, 16 May 2015 08:58:44 +0000 (08:58 +0000)
committerHarlan Stenn <stenn@ntp.org>
Sat, 16 May 2015 08:58:44 +0000 (08:58 +0000)
bk: 555706c4MGvzDmvwJpzI4iyr_Kj2Lg

tests/bug-2803/Makefile.am
tests/bug-2803/TestProductionCode_Runner.c [new file with mode: 0644]
tests/bug-2803/bug-2803.c
tests/bug-2803/bug-2803.h [new file with mode: 0644]
tests/bug-2803/ut-2803.c [new file with mode: 0644]

index 6c7365407bcf3bc23c945a3324d11ba7e6df76db..c16a42482eae173b9b2f2fc29e28d3e07869c75c 100644 (file)
@@ -24,8 +24,10 @@ AM_CPPFLAGS += $(CPPFLAGS_NTP)
 
 AM_LDFLAGS = $(LDFLAGS_NTP)
 
-bug_2803_SOURCES =                             \
-       bug-2803.c                              \
+bug_2803_SOURCES =                     \
+       bug-2803.c                      \
+       TestProductionCode_Runner.c     \
+       ut-2803.c                       \
        $(NULL)
 
 # HMS: we may not need some of these:
diff --git a/tests/bug-2803/TestProductionCode_Runner.c b/tests/bug-2803/TestProductionCode_Runner.c
new file mode 100644 (file)
index 0000000..969df88
--- /dev/null
@@ -0,0 +1,55 @@
+/* AUTOGENERATED FILE. DO NOT EDIT. */
+#include "unity.h"
+#include <setjmp.h>
+#include <stdio.h>
+
+char MessageBuffer[50];
+
+extern void setUp(void);
+extern void tearDown(void);
+
+extern void test_FindFunction_WhichIsBroken_ShouldReturnZeroIfItemIsNotInList_WhichWorksEvenInOurBrokenCode(void);
+extern void test_FindFunction_WhichIsBroken_ShouldReturnTheIndexForItemsInList_WhichWillFailBecauseOurFunctionUnderTestIsBroken(void);
+extern void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValue(void);
+extern void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValueAgain(void);
+extern void test_FunctionWhichReturnsLocalVariable_ShouldReturnCurrentCounter_ButFailsBecauseThisTestIsActuallyFlawed(void);
+extern void test_custom(void);
+extern void test_main(void);
+
+void resetTest(void);
+
+void resetTest(void)
+{
+  tearDown();
+  setUp();
+}
+
+
+int main(void)
+{
+  UnityBegin("test/TestProductionCode.c");
+  UnityBegin("test/test-2803.c");
+
+  /*
+  RUN_TEST(test_FindFunction_WhichIsBroken_ShouldReturnZeroIfItemIsNotInList_WhichWorksEvenInOurBrokenCode, 20);
+  RUN_TEST(test_FindFunction_WhichIsBroken_ShouldReturnTheIndexForItemsInList_WhichWillFailBecauseOurFunctionUnderTestIsBroken, 30);
+  RUN_TEST(test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValue, 41);
+  RUN_TEST(test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValueAgain, 51);
+  RUN_TEST(test_FunctionWhichReturnsLocalVariable_ShouldReturnCurrentCounter_ButFailsBecauseThisTestIsActuallyFlawed, 57);
+*/
+
+RUN_TEST(test_main);
+
+//RUN_TEST(test_FindFunction_WhichIsBroken_ShouldReturnZeroIfItemIsNotInList_WhichWorksEvenInOurBrokenCode);
+  //RUN_TEST(test_FindFunction_WhichIsBroken_ShouldReturnTheIndexForItemsInList_WhichWillFailBecauseOurFunctionUnderTestIsBroken);
+  //RUN_TEST(test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValue);
+  //RUN_TEST(test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValueAgain);
+  //RUN_TEST(test_FunctionWhichReturnsLocalVariable_ShouldReturnCurrentCounter_ButFailsBecauseThisTestIsActuallyFlawed);
+
+
+//RUN_TEST(test_FunctionWhichReturnsLocalVariable_ShouldReturnCurrentCounter_ButFailsBecauseThisTestIsActuallyFlawed);
+  RUN_TEST(test_custom);
+
+  UnityEnd();
+  return 0;
+}
index a31fccfdd1c53ca5295121b8c480a7e585524c22..1806c6d781943e0954d64ac406de64051bef6295 100644 (file)
@@ -85,7 +85,7 @@ int test_loop( long long start_sec, long start_usec,
 
 
 
-int main( void )
+int main2( void )
 {
 
        // loop from {0.0} to {1.1000000} stepping by tv_sec by 1 and tv_usec by 100000
diff --git a/tests/bug-2803/bug-2803.h b/tests/bug-2803/bug-2803.h
new file mode 100644 (file)
index 0000000..4b8469d
--- /dev/null
@@ -0,0 +1 @@
+int main2( void );
diff --git a/tests/bug-2803/ut-2803.c b/tests/bug-2803/ut-2803.c
new file mode 100644 (file)
index 0000000..885cb45
--- /dev/null
@@ -0,0 +1,41 @@
+#include "bug-2803.h"
+#include "unity.h"
+
+#define VERSION 3 //change this to 5 and the test wont fail.
+
+
+void setUp(void)
+{
+  
+}
+
+void tearDown(void)
+{
+}
+
+/*
+int main( void )
+{
+
+       // loop from {0.0} to {1.1000000} stepping by tv_sec by 1 and tv_usec by 100000
+       test_loop( 0, 0,   1,  MICROSECONDS,   1,  MICROSECONDS / 10 );
+
+       // test_loop( 0, 0,   5,  MICROSECONDS,   1,  MICROSECONDS / 1000 );
+       // test_loop( 0, 0,  -5, -MICROSECONDS,  -1, -MICROSECONDS / 1000 );
+
+       return 0;
+}
+*/
+int test_main( void )
+{
+       TEST_ASSERT_EQUAL(0, main2());
+}
+
+void test_custom(void)
+{      
+       if(VERSION < 4 ){       
+               TEST_FAIL_MESSAGE("expected to fail");
+       }
+
+       else TEST_ASSERT_EQUAL(1,1);
+}