summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2023-08-18 09:53:37 (GMT)
committerThomas Haller <thaller@redhat.com>2023-08-18 09:57:33 (GMT)
commit09f03f29cf9d26933d2bd319bdeb63f9da9d81e8 (patch)
treea1f35cedca6506570a9fedd860ba7f104a54f9fa
parent74bffbf6181f9d5afc722ce71c9cc9e48d519dbc (diff)
downloadlibnl-09f03f29cf9d26933d2bd319bdeb63f9da9d81e8.zip
libnl-09f03f29cf9d26933d2bd319bdeb63f9da9d81e8.tar.gz
libnl-09f03f29cf9d26933d2bd319bdeb63f9da9d81e8.tar.bz2
tests: check nl_str2ip_proto()
-rw-r--r--tests/check-direct.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/check-direct.c b/tests/check-direct.c
index 8cb4932..df4933e 100644
--- a/tests/check-direct.c
+++ b/tests/check-direct.c
@@ -41,6 +41,15 @@ START_TEST(static_checks)
ck_assert_int_le(i, RTNL_LINK_STATS_MAX);
ck_assert_int_eq(i, rtnl_link_str2stat(s));
}
+
+ ck_assert_int_eq(nl_str2ip_proto(""), 0);
+ ck_assert_int_eq(nl_str2ip_proto("5"), 5);
+ ck_assert_int_eq(nl_str2ip_proto(" 13 "), -NLE_OBJ_NOTFOUND);
+ ck_assert_int_eq(nl_str2ip_proto("13"), 13);
+ ck_assert_int_eq(nl_str2ip_proto("0x13"), 0x13);
+ ck_assert_int_eq(nl_str2ip_proto("0342"), 0342);
+ ck_assert_int_eq(nl_str2ip_proto("2147483647"), 2147483647);
+ ck_assert_int_eq(nl_str2ip_proto("2147483648"), -2147483648);
}
END_TEST