00001 00002 #include <sys/types.h> 00003 00004 #include <dnet.h> 00005 00006 #include <stdio.h> 00007 #include <stdlib.h> 00008 #include <string.h> 00009 00010 #include <check.h> 00011 00012 START_TEST(test_intf_openclose) 00013 { 00014 intf_t *i; 00015 00016 fail_unless((i = intf_open()) != NULL, "open failed"); 00017 fail_unless((i = intf_close(i)) == NULL, "closed failed"); 00018 } 00019 END_TEST 00020 00021 START_TEST(test_intf_get) 00022 { 00023 struct intf_entry ifent; 00024 intf_t *i; 00025 00026 i = intf_open(); 00027 memset(&ifent, 0, sizeof(ifent)); 00028 fail_unless(intf_get(i, &ifent) < 0, "didn't fail on empty request"); 00029 ifent.intf_len = sizeof(ifent); 00030 fail_unless(intf_get(i, &ifent) < 0, "didn't fail on empty name"); 00031 intf_close(i); 00032 } 00033 END_TEST 00034 00035 START_TEST(test_intf_get_src) 00036 { 00037 } 00038 END_TEST 00039 00040 START_TEST(test_intf_get_dst) 00041 { 00042 } 00043 END_TEST 00044 00045 START_TEST(test_intf_set) 00046 { 00047 } 00048 END_TEST 00049 00050 START_TEST(test_intf_loop) 00051 { 00052 } 00053 END_TEST 00054 00055 Suite * 00056 intf_suite(void) 00057 { 00058 Suite *s = suite_create("intf"); 00059 TCase *tc_core = tcase_create("core"); 00060 00061 suite_add_tcase(s, tc_core); 00062 tcase_add_test(tc_core, test_intf_openclose); 00063 tcase_add_test(tc_core, test_intf_get); 00064 tcase_add_test(tc_core, test_intf_get_src); 00065 tcase_add_test(tc_core, test_intf_get_dst); 00066 tcase_add_test(tc_core, test_intf_set); 00067 tcase_add_test(tc_core, test_intf_loop); 00068 00069 return (s); 00070 } 00071 00072 int 00073 main(void) 00074 { 00075 Suite *s = intf_suite(); 00076 SRunner *sr = srunner_create(s); 00077 int nf; 00078 00079 srunner_run_all (sr, CK_NORMAL); 00080 nf = srunner_ntests_failed(sr); 00081 srunner_free(sr); 00082 00083 return (nf == 0) ? EXIT_SUCCESS : EXIT_FAILURE; 00084 }