Four macros were added : - TTAIL_CHECK_START(char *test_suite_str, char *test_case_str) - TTAIL_SET_FIXTURE(void (*setup)(), void (*teardown)()) - TTAIL_ADD_TEST( libcheck_test test) - TTAIL_CHECK_END
		
			
				
	
	
		
			39 lines
		
	
	
	
		
			866 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			39 lines
		
	
	
	
		
			866 B
		
	
	
	
		
			C
		
	
	
	
	
	
| #include <check.h>
 | |
| #include <errno.h>
 | |
| #include <stdio.h>
 | |
| #include <unistd.h>
 | |
| 
 | |
| #include "ttail_check.h"
 | |
| #include "ttail.h"
 | |
| #include "ttail_init.h"
 | |
| 
 | |
| /*
 | |
|  * ttail_set_fmt() checks
 | |
|  */
 | |
| START_TEST (test_init_fmt)
 | |
| {
 | |
| 	int ret;
 | |
| 	ret = ttail_set_fmt(ttail, "%B");
 | |
| 	ck_assert_int_eq(ret, 0);
 | |
| 	ck_assert_int_eq(ttail->flag & TTAIL_FLAG_FORMAT, TTAIL_FLAG_FORMAT);
 | |
| 	ck_assert_str_eq(ttail->fmt, "%B");
 | |
| }
 | |
| END_TEST
 | |
| 
 | |
| START_TEST (test_init_fmt_again)
 | |
| {
 | |
| 	int ret;
 | |
| 	ttail_set_fmt(ttail, "%B");
 | |
| 	ret = ttail_set_fmt(ttail, "%b");
 | |
| 	ck_assert_int_eq(ret, -1);
 | |
| 	ck_assert_int_eq(ttail->flag & TTAIL_FLAG_FORMAT, TTAIL_FLAG_FORMAT);
 | |
| 	ck_assert_str_eq(ttail->fmt, "%B");
 | |
| }
 | |
| END_TEST
 | |
| 
 | |
| TTAIL_CHECK_START("ttail init checks", "date format init checks")
 | |
| 	TTAIL_SET_FIXTURE(setup_ttail_empty, teardown_ttail);
 | |
| 	TTAIL_ADD_TEST(test_init_fmt);
 | |
| 	TTAIL_ADD_TEST(test_init_fmt_again);
 | |
| TTAIL_CHECK_END
 | |
| 
 |