Skip to content

Commit 72d8814

Browse files
Cristib05cfriedt
authored andcommitted
tests: net: route_mcast: Add test for route lookup by interface
Adding test case to validate new added function, `net_route_mcast_lookup_by_iface` Signed-off-by: Cristian Bulacu <cristian.bulacu@nxp.com>
1 parent c341838 commit 72d8814

File tree

1 file changed

+18
-0
lines changed
  • tests/net/route_mcast/src

1 file changed

+18
-0
lines changed

tests/net/route_mcast/src/main.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,23 @@ static void test_route_mcast_lookup(void)
417417
zassert_equal_ptr(test_mcast_routes[3], route,
418418
"mcast lookup failed");
419419
}
420+
421+
static void test_route_mcast_lookup_by_iface(void)
422+
{
423+
struct net_route_entry_mcast *route =
424+
net_route_mcast_lookup_by_iface(&mcast_prefix_admin, iface_1);
425+
426+
zassert_not_null(route, "mcast lookup by iface failed");
427+
428+
route = net_route_mcast_lookup_by_iface(&mcast_prefix_site_local, iface_2);
429+
430+
zassert_not_null(route, "mcast lookup by iface failed");
431+
432+
route = net_route_mcast_lookup_by_iface(&mcast_prefix_site_local, iface_1);
433+
434+
zassert_is_null(route, "mcast lookup by iface should not find a route on this interface");
435+
}
436+
420437
static void test_route_mcast_route_del(void)
421438
{
422439
struct net_route_entry_mcast *route;
@@ -752,6 +769,7 @@ ZTEST(route_mcast_test_suite, test_route_mcast)
752769
test_route_mcast_scenario3();
753770
test_route_mcast_multiple_route_ifaces();
754771
test_route_mcast_lookup();
772+
test_route_mcast_lookup_by_iface();
755773
test_route_mcast_route_del();
756774
}
757775
ZTEST_SUITE(route_mcast_test_suite, NULL, NULL, NULL, NULL, NULL);

0 commit comments

Comments
 (0)