Skip to content

Commit

Permalink
tests: check nl_str2ip_proto()
Browse files Browse the repository at this point in the history
  • Loading branch information
thom311 committed Aug 18, 2023
1 parent 74bffbf commit 09f03f2
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/check-direct.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 09f03f2

Please sign in to comment.