]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
making better sandbox examples
authorDamir Tomic <viperus@ntp.org>
Tue, 26 May 2015 10:11:49 +0000 (10:11 +0000)
committerDamir Tomic <viperus@ntp.org>
Tue, 26 May 2015 10:11:49 +0000 (10:11 +0000)
bk: 556446e5en5rjTv_h0w5DjgF0Z2aPQ

tests/sandbox/Makefile.am
tests/sandbox/ut-2803.c

index 07f02baf544a2674f534fa71b9e1efedda32d890..6f13e1b2da83599bbab88d5b13be2bc259f52233 100644 (file)
@@ -1,11 +1,11 @@
-#AUTOMAKE_OPTIONS = foreign 1.9 subdir-objects
+#AUTOMAKE_OPTIONS = foreign 2.9 subdir-objects
 NULL =
 BUILT_SOURCES =
 CLEANFILES =
 
 run_unity =    cd $(srcdir) && ruby ../../sntp/unity/auto/generate_test_runner.rb
 
-check_PROGRAMS = bug-2803
+check_PROGRAMS = bug-2803 first-test second-test
 
 # HMS: we may not need some of these:
 LDADD =                                        \
@@ -28,12 +28,29 @@ AM_LDFLAGS = $(LDFLAGS_NTP)
 
 bug_2803_SOURCES =                     \
        bug-2803.c                      \
-       run-bug-2803.c                  \
+       run-ut-2803.c                   \
        ut-2803.c                       \
        $(NULL)
 
-$(srcdir)/run-bug-2803.c: $(srcdir)/bug-2803.c $(std_unity_list)
-       $(run_unity) bug-2803.c run-bug-2803.c
+$(srcdir)/run-ut-2803.c: $(srcdir)/ut-2803.c $(std_unity_list)
+       $(run_unity) ut-2803.c run-ut-2803.c
+
+first_test_SOURCES =                           \
+       uglydate.c                      \
+       run-first-test.c                \
+       $(NULL)
+
+$(srcdir)/run-first-test.c: $(srcdir)/uglydate.c $(std_unity_list)
+       $(run_unity) uglydate.c run-first-test.c
+
+second_test_SOURCES =                    \
+        modetoa.c                      \
+        run-second-test.c                \
+        $(NULL)
+
+$(srcdir)/run-second-test.c: $(srcdir)/modetoa.c $(std_unity_list)
+       $(run_unity) modetoa.c run-second-test.c
+
 
 # HMS: we may not need some of these:
 #noinst_HEADERS =      ntpdtest.h      \
index 885cb452c452c047193a2fa9eabf4305dae8a209..8aef448a8ef79beb5a429e407fad124839c2340b 100644 (file)
@@ -1,7 +1,8 @@
-#include "bug-2803.h"
+//#include "bug-2803.h"
 #include "unity.h"
+#include "code-2803.h"
 
-#define VERSION 3 //change this to 5 and the test wont fail.
+#define VERSION 5 //change this to 5 and the test wont fail.
 
 
 void setUp(void)
@@ -26,16 +27,54 @@ int main( void )
        return 0;
 }
 */
-int test_main( void )
+void test_main( void )
 {
        TEST_ASSERT_EQUAL(0, main2());
 }
 
-void test_custom(void)
+//VERSION defined at the top of the file
+
+void test_XPASS(void)  //expecting fail but passes, should we get an alert about that?
 {      
+       //TEST_ABORT
+       TEST_EXPECT_FAIL();
+
        if(VERSION < 4 ){       
                TEST_FAIL_MESSAGE("expected to fail");
        }
 
        else TEST_ASSERT_EQUAL(1,1);
 }
+
+void test_XFAIL(void) //expecting fail, and XFAILs
+{      
+
+       TEST_EXPECT_FAIL();
+
+       if(VERSION < 4 ){       
+               TEST_FAIL_MESSAGE("Expected to fail");
+       }
+
+       else TEST_ASSERT_EQUAL(1,2); 
+}
+
+void test_XFAIL_WITH_MESSAGE(void) //expecting fail, and XFAILs
+{      
+       //TEST_ABORT
+       TEST_EXPECT_FAIL_MESSAGE("Doesn't work on this OS");
+
+       if(VERSION < 4 ){       
+               TEST_FAIL_MESSAGE("Expected to fail");
+       }
+
+       else TEST_ASSERT_EQUAL(1,2); 
+}
+
+void test_main_incorrect(void){
+       TEST_ASSERT_EQUAL(3, main2());
+}
+
+void test_ignored(void){
+       //TEST_IGNORE();
+       TEST_IGNORE_MESSAGE("This test is being ignored!");   
+}