fix: Verbindungs-Timeout im WLAN-Zustandsautomaten
This commit is contained in:
@@ -155,6 +155,25 @@ static void test_error_names(void)
|
||||
TEST_ASSERT_EQUAL_STRING("not_found", nl_wifi_error_name(NL_WIFI_ERR_NOT_FOUND));
|
||||
}
|
||||
|
||||
static void test_connect_without_any_event_retries(void)
|
||||
{
|
||||
nl_wifi_sm_start(&sm, true, 0);
|
||||
TEST_ASSERT_FALSE(nl_wifi_sm_tick(&sm, 29999).connect);
|
||||
TEST_ASSERT_FALSE(nl_wifi_sm_tick(&sm, 30000).connect); /* retry scheduled at 31000 */
|
||||
TEST_ASSERT_TRUE(nl_wifi_sm_tick(&sm, 31000).connect);
|
||||
/* next timeout: 31000 + 30000 + 2000 backoff = 63000 */
|
||||
TEST_ASSERT_FALSE(nl_wifi_sm_tick(&sm, 62999).connect);
|
||||
TEST_ASSERT_TRUE(nl_wifi_sm_tick(&sm, 63000).connect);
|
||||
/* fallback after 300000 ms, and attempts continue */
|
||||
a = nl_wifi_sm_tick(&sm, 300000);
|
||||
TEST_ASSERT_TRUE(a.start_ap);
|
||||
TEST_ASSERT_EQUAL(NL_WIFI_ST_APSTA_FALLBACK, sm.state);
|
||||
TEST_ASSERT_EQUAL_STRING("apsta", nl_wifi_sm_mode(&sm));
|
||||
/* another attempt fires later */
|
||||
a = nl_wifi_sm_tick(&sm, 360000);
|
||||
TEST_ASSERT_TRUE(a.connect);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
UNITY_BEGIN();
|
||||
@@ -168,5 +187,6 @@ int main(void)
|
||||
RUN_TEST(test_onboarding_timeout);
|
||||
RUN_TEST(test_onboarding_while_connected_falls_back_to_old_credentials);
|
||||
RUN_TEST(test_error_names);
|
||||
RUN_TEST(test_connect_without_any_event_retries);
|
||||
return UNITY_END();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user