From: Damir Tomic Date: Tue, 26 May 2015 10:11:49 +0000 (+0000) Subject: making better sandbox examples X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d0f02431c3523957ff24d766c3ea1f15997e8402;p=thirdparty%2Fntp.git making better sandbox examples bk: 556446e5en5rjTv_h0w5DjgF0Z2aPQ --- diff --git a/tests/sandbox/Makefile.am b/tests/sandbox/Makefile.am index 07f02baf5..6f13e1b2d 100644 --- a/tests/sandbox/Makefile.am +++ b/tests/sandbox/Makefile.am @@ -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 \ diff --git a/tests/sandbox/ut-2803.c b/tests/sandbox/ut-2803.c index 885cb452c..8aef448a8 100644 --- a/tests/sandbox/ut-2803.c +++ b/tests/sandbox/ut-2803.c @@ -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!"); +}