9 #include <cgreen/cgreen.h>
10 #include <cgreen/mocks.h>
22 Ensure (hosts, gvm_hosts_new_never_returns_null)
29 Ensure (hosts, gvm_get_host_type_returns_host_type_ipv4)
39 Ensure (hosts, gvm_get_host_type_returns_host_type_ipv6)
46 #define TEN "0123456789"
47 #define SIXTY TEN TEN TEN TEN TEN TEN
48 #define HUNDRED TEN TEN TEN TEN TEN TEN TEN TEN TEN TEN
50 Ensure (hosts, gvm_get_host_type_returns_host_type_hostname)
70 Ensure (hosts, gvm_get_host_type_returns_host_type_cidr_block)
84 Ensure (hosts, gvm_get_host_type_returns_host_type_cidr6_block)
94 Ensure (hosts, gvm_get_host_type_returns_host_type_range_short)
116 Ensure (hosts, gvm_get_host_type_returns_host_type_range6_short)
124 Ensure (hosts, gvm_get_host_type_returns_host_type_range_long)
146 Ensure (hosts, gvm_get_host_type_returns_host_type_range6_long)
155 Ensure (hosts, gvm_get_host_type_returns_error)
184 Ensure (hosts, gvm_hosts_new_with_max_returns_success)
192 Ensure (hosts, gvm_hosts_new_with_max_returns_error)
205 Ensure (hosts, gvm_hosts_move_host_to_end)
218 assert_that (totalhosts, is_equal_to (14));
229 assert_that (hosts->
current, is_equal_to (current - 1));
246 GSList *removed = NULL;
248 hosts =
gvm_hosts_new (
"192.168.0.1,192.168.0.2,192.168.0.3");
252 assert_that (totalhosts, is_equal_to (3));
256 assert_that (totalhosts, is_equal_to (2));
257 assert_that (g_slist_length (removed), is_equal_to (1));
258 g_slist_free_full (removed, g_free);
262 assert_that (totalhosts, is_equal_to (1));
263 assert_that (g_slist_length (removed), is_equal_to (1));
264 g_slist_free_full (removed, g_free);
280 suite = create_test_suite ();
282 add_test_with_context (suite, hosts, gvm_hosts_new_never_returns_null);
283 add_test_with_context (suite, hosts,
284 gvm_get_host_type_returns_host_type_ipv4);
285 add_test_with_context (suite, hosts,
286 gvm_get_host_type_returns_host_type_ipv6);
287 add_test_with_context (suite, hosts,
288 gvm_get_host_type_returns_host_type_hostname);
289 add_test_with_context (suite, hosts,
290 gvm_get_host_type_returns_host_type_cidr_block);
291 add_test_with_context (suite, hosts,
292 gvm_get_host_type_returns_host_type_cidr6_block);
293 add_test_with_context (suite, hosts,
294 gvm_get_host_type_returns_host_type_range_short);
295 add_test_with_context (suite, hosts,
296 gvm_get_host_type_returns_host_type_range6_short);
297 add_test_with_context (suite, hosts,
298 gvm_get_host_type_returns_host_type_range_long);
299 add_test_with_context (suite, hosts,
300 gvm_get_host_type_returns_host_type_range6_long);
301 add_test_with_context (suite, hosts, gvm_get_host_type_returns_error);
303 add_test_with_context (suite, hosts, gvm_hosts_new_with_max_returns_error);
304 add_test_with_context (suite, hosts, gvm_hosts_new_with_max_returns_success);
306 add_test_with_context (suite, hosts, gvm_hosts_move_host_to_end);
310 return run_single_test (suite, argv[1], create_text_reporter ());
312 return run_test_suite (suite, create_text_reporter ());