1 #include "../../test.h" 2 #include "../../../src/alloc.h" 3 #include "../../../src/protocol2/rabin/rconf.h" 4 #include "../../../src/protocol2/rabin/win.h" 5 tear_down(void)6static void tear_down(void) 7 { 8 alloc_check(); 9 } 10 START_TEST(test_win)11START_TEST(test_win) 12 { 13 struct rconf rconf; 14 struct win *win; 15 alloc_check_init(); 16 rconf_init(&rconf); 17 fail_unless((win=win_alloc(&rconf))!=NULL); 18 win_free(&win); 19 tear_down(); 20 } 21 END_TEST 22 START_TEST(test_win_alloc_error)23START_TEST(test_win_alloc_error) 24 { 25 struct rconf rconf; 26 struct win *win; 27 alloc_check_init(); 28 rconf_init(&rconf); 29 alloc_errors=1; 30 fail_unless((win=win_alloc(&rconf))==NULL); 31 tear_down(); 32 } 33 END_TEST 34 suite_protocol2_rabin_win(void)35Suite *suite_protocol2_rabin_win(void) 36 { 37 Suite *s; 38 TCase *tc_core; 39 40 s=suite_create("protocol2_rabin_win"); 41 42 tc_core=tcase_create("Core"); 43 44 tcase_add_test(tc_core, test_win); 45 tcase_add_test(tc_core, test_win_alloc_error); 46 suite_add_tcase(s, tc_core); 47 48 return s; 49 } 50