2 #include "../../src/netutl.h"
4 static void test_service_to_port_invalid(void **state) {
7 assert_int_equal(0, service_to_port(NULL));
8 assert_int_equal(0, service_to_port(""));
9 assert_int_equal(0, service_to_port("-1"));
10 assert_int_equal(0, service_to_port("foobar"));
13 static void test_service_to_port_valid(void **state) {
16 assert_int_equal(22, service_to_port("ssh"));
17 assert_int_equal(80, service_to_port("http"));
18 assert_int_equal(443, service_to_port("https"));
19 assert_int_equal(1234, service_to_port("1234"));
23 const struct CMUnitTest tests[] = {
24 cmocka_unit_test(test_service_to_port_invalid),
25 cmocka_unit_test(test_service_to_port_valid),
27 return cmocka_run_group_tests(tests, NULL, NULL);