summaryrefslogtreecommitdiff
path: root/src/tests/eeze/eeze_test_net.c
blob: 6d9f8589d69e2fb7d3786833912acf3575d23104 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif

#include <Eeze.h>
#include <Eeze_Net.h>

#include "eeze_suite.h"

START_TEST(eeze_test_net_list)
{
   int ret;
   Eina_List *list = NULL;

   ret = eeze_init();
   fail_if(ret != 1);

   list = eeze_net_list();
   fail_if(list == NULL);

   ret = eeze_shutdown();
   fail_if(ret != 0);
}
END_TEST

START_TEST(eeze_test_net_attr)
{
   int ret;
   int idx = 0;
   Eeze_Net *net = NULL;
   const char *tmp = NULL;

   ret = eeze_init();
   fail_if(ret != 1);

   net = eeze_net_new("lo");
   fail_if(net == NULL);

   tmp = eeze_net_mac_get(net);
   fail_if(tmp == NULL);
   tmp = NULL;

   idx = eeze_net_idx_get(net);
   fail_if(!idx);

   eeze_net_scan(net);

   tmp = eeze_net_addr_get(net, EEZE_NET_ADDR_TYPE_IP);
   fail_if(tmp == NULL);
   tmp = NULL;

   tmp = eeze_net_addr_get(net, EEZE_NET_ADDR_TYPE_BROADCAST);
   fail_if(tmp == NULL);
   tmp = NULL;

   tmp = eeze_net_addr_get(net, EEZE_NET_ADDR_TYPE_NETMASK);
   fail_if(tmp == NULL);
   tmp = NULL;

   tmp = eeze_net_attribute_get(net, "carrier");
   fail_if(tmp == NULL);
   tmp = NULL;

   tmp = eeze_net_syspath_get(net);
   fail_if(tmp == NULL);

   eeze_net_free(net);

   ret = eeze_shutdown();
   fail_if(ret != 0);
}
END_TEST

/*
#ifdef HAVE_IPV6
START_TEST(eeze_test_net_attr_ipv6)
{
   int ret;
   Eeze_Net *net = NULL;
   const char *tmp = NULL;

   ret = eeze_init();
   fail_if(ret != 1);

   net = eeze_net_new("lo");
   fail_if(net == NULL);

   tmp = eeze_net_addr_get(net, EEZE_NET_ADDR_TYPE_IP6);
   fail_if(tmp == NULL);
   tmp = NULL;

   tmp = eeze_net_addr_get(net, EEZE_NET_ADDR_TYPE_BROADCAST6);
   fail_if(tmp == NULL);
   tmp = NULL;

   tmp = eeze_net_addr_get(net, EEZE_NET_ADDR_TYPE_NETMASK6);
   fail_if(tmp == NULL);

   eeze_net_free(net);

   ret = eeze_shutdown();
   fail_if(ret != 0);
}
END_TEST
#endif
*/

void eeze_test_net(TCase *tc)
{
   tcase_add_test(tc, eeze_test_net_list);
   tcase_add_test(tc, eeze_test_net_attr);
#ifdef HAVE_IPV6
   //FIXME Figure out why we fail for the ipv6 tests here (code or test)
   //tcase_add_test(tc, eeze_test_net_attr_ipv6);
#endif
}