esp_netif: Update the test to exercise netif list matching APIs

This commit is contained in:
David Cermak 2021-05-21 09:44:08 +02:00
parent 5209af379a
commit c991af7ac5

View File

@ -38,6 +38,8 @@ TEST_CASE("esp_netif: get from if_key", "[esp_netif][leaks=0]")
}
// This is a private esp-netif API, but include here to test it
bool esp_netif_is_netif_listed(esp_netif_t *esp_netif);
TEST_CASE("esp_netif: create and delete multiple netifs", "[esp_netif][leaks=0]")
{
@ -54,12 +56,19 @@ TEST_CASE("esp_netif: create and delete multiple netifs", "[esp_netif][leaks=0]"
TEST_ASSERT_NOT_NULL(netifs[i]);
}
// there's no AP within created stations
TEST_ASSERT_EQUAL(NULL, esp_netif_get_handle_from_ifkey("WIFI_AP_DEF"));
// there's no AP within created netifs
TEST_ASSERT_NULL(esp_netif_get_handle_from_ifkey("WIFI_AP_DEF"));
// destroy
// check that the created netifs are correctly found by their interface keys and globally listed
for (int i=0; i<nr_of_netifs; ++i) {
TEST_ASSERT_EQUAL(netifs[i], esp_netif_get_handle_from_ifkey(if_keys[i]));
TEST_ASSERT_TRUE(esp_netif_is_netif_listed(netifs[i]));
}
// destroy one by one and check it's been removed
for (int i=0; i<nr_of_netifs; ++i) {
esp_netif_destroy(netifs[i]);
TEST_ASSERT_FALSE(esp_netif_is_netif_listed(netifs[i]));
}
}