xref: /netbsd-src/external/bsd/ntp/dist/tests/sandbox/ut-2803.c (revision cdfa2a7ef92791ba9db70a584a1d904730e6fb46)
1 /*	$NetBSD: ut-2803.c,v 1.2 2020/05/25 20:47:37 christos Exp $	*/
2 
3 //#include "bug-2803.h"
4 #include "unity.h"
5 //#include "code-2803.h"
6 
7 #define VERSION 5 //change this to 5 and the test wont fail.
8 
9 
setUp(void)10 void setUp(void)
11 {
12 
13 }
14 
tearDown(void)15 void tearDown(void)
16 {
17 }
18 
19 /*
20 int main( void )
21 {
22 
23 	// loop from {0.0} to {1.1000000} stepping by tv_sec by 1 and tv_usec by 100000
24 	test_loop( 0, 0,   1,  MICROSECONDS,   1,  MICROSECONDS / 10 );
25 
26 	// test_loop( 0, 0,   5,  MICROSECONDS,   1,  MICROSECONDS / 1000 );
27 	// test_loop( 0, 0,  -5, -MICROSECONDS,  -1, -MICROSECONDS / 1000 );
28 
29 	return 0;
30 }
31 */
test_main(void)32 void test_main( void )
33 {
34 	TEST_ASSERT_EQUAL(0, main2());
35 }
36 
37 //VERSION defined at the top of the file
38 
test_XPASS(void)39 void test_XPASS(void)  //expecting fail but passes, should we get an alert about that?
40 {
41 	//TEST_ABORT
42 	TEST_EXPECT_FAIL();
43 
44 	if(VERSION < 4 ){
45 		TEST_FAIL_MESSAGE("expected to fail");
46 	}
47 
48 	else TEST_ASSERT_EQUAL(1,1);
49 }
50 
test_XFAIL(void)51 void test_XFAIL(void) //expecting fail, and XFAILs
52 {
53 
54 	TEST_EXPECT_FAIL();
55 
56 	if(VERSION < 4 ){
57 		TEST_FAIL_MESSAGE("Expected to fail");
58 	}
59 
60 	else TEST_ASSERT_EQUAL(1,2);
61 }
62 
test_XFAIL_WITH_MESSAGE(void)63 void test_XFAIL_WITH_MESSAGE(void) //expecting fail, and XFAILs
64 {
65 	//TEST_ABORT
66 	TEST_EXPECT_FAIL_MESSAGE("Doesn't work on this OS");
67 
68 	if(VERSION < 4 ){
69 		TEST_FAIL_MESSAGE("Expected to fail");
70 	}
71 
72 	else TEST_ASSERT_EQUAL(1,2);
73 }
74 
test_main_incorrect(void)75 void test_main_incorrect(void){
76 	TEST_ASSERT_EQUAL(3, main2());
77 }
78 
test_ignored(void)79 void test_ignored(void){
80 	//TEST_IGNORE();
81 	TEST_IGNORE_MESSAGE("This test is being ignored!");
82 }
83