|
@@ -51,7 +51,7 @@ static void singleSlave() {
|
|
|
wifi::sta::onDisconnect = {[]() { TEST_FAIL(); }};
|
|
|
wifi::sta::start();
|
|
|
|
|
|
- wifi::sta::connect(TEST_SSID, WIFI_PASS);
|
|
|
+ TEST_ASSERT_TRUE(wifi::sta::connect(TEST_SSID, WIFI_PASS));
|
|
|
TEST_ASSERT_EQUAL(2, state);
|
|
|
TEST_ASSERT_TRUE(wifi::sta::connected());
|
|
|
TEST_ASSERT_EQUAL_STRING(TEST_SSID, wifi::sta::ssid().c_str());
|
|
@@ -94,7 +94,7 @@ static void asyncSlave() {
|
|
|
wifi::sta::onDisconnect = {[]() { TEST_FAIL(); }};
|
|
|
wifi::sta::start();
|
|
|
|
|
|
- wifi::sta::connect(TEST_SSID, WIFI_PASS, true);
|
|
|
+ TEST_ASSERT_TRUE(wifi::sta::connect(TEST_SSID, WIFI_PASS, true));
|
|
|
TEST_ASSERT_EQUAL(0, state);
|
|
|
|
|
|
event.waitForBit(0);
|
|
@@ -110,7 +110,7 @@ static void dualMaster() {
|
|
|
|
|
|
wifi::ap::onConnect = {[](wifi::STA &) {
|
|
|
TEST_ASSERT_EQUAL(0, state++);
|
|
|
- wifi::sta::connect(SLAVE_SSID, WIFI_PASS, true);
|
|
|
+ TEST_ASSERT_TRUE(wifi::sta::connect(SLAVE_SSID, WIFI_PASS, true));
|
|
|
}};
|
|
|
wifi::sta::onConnect = {[]() {
|
|
|
TEST_ASSERT_EQUAL(1, state++);
|
|
@@ -145,7 +145,9 @@ static void dualSlave() {
|
|
|
event.setBit(0);
|
|
|
}};
|
|
|
wifi::dual::start(SLAVE_SSID, WIFI_PASS);
|
|
|
- wifi::sta::connect(MASTER_SSID, WIFI_PASS);
|
|
|
+
|
|
|
+ // returns false because we call disconnect() before handleIp() gets called
|
|
|
+ TEST_ASSERT_FALSE(wifi::sta::connect(MASTER_SSID, WIFI_PASS));
|
|
|
|
|
|
event.waitForBit(0);
|
|
|
TEST_ASSERT_EQUAL(4, state);
|
|
@@ -180,7 +182,7 @@ static void scanSlave() {
|
|
|
}
|
|
|
TEST_ASSERT_TRUE(found);
|
|
|
|
|
|
- wifi::sta::connect(TEST_SSID, WIFI_PASS);
|
|
|
+ TEST_ASSERT_TRUE(wifi::sta::connect(TEST_SSID, WIFI_PASS, true));
|
|
|
}};
|
|
|
wifi::sta::onConnect = {[]() { event.setBit(0); }};
|
|
|
|
|
@@ -206,7 +208,7 @@ static void ipMaster() {
|
|
|
|
|
|
static void ipSlave() {
|
|
|
wifi::sta::start();
|
|
|
- wifi::sta::connect(TEST_SSID, WIFI_PASS);
|
|
|
+ TEST_ASSERT_TRUE(wifi::sta::connect(TEST_SSID, WIFI_PASS));
|
|
|
|
|
|
auto ip = wifi::sta::ip().str();
|
|
|
TEST_ASSERT_EQUAL_STRING("192.168.100.2", ip.c_str());
|
|
@@ -215,3 +217,9 @@ static void ipSlave() {
|
|
|
}
|
|
|
|
|
|
TEST_CASE_MULTIPLE_DEVICES("WiFi custom IP address", "[kbf_wifi]", ipMaster, ipSlave);
|
|
|
+
|
|
|
+TEST_CASE("WiFi connect fail", "[kbf_wifi]") {
|
|
|
+ wifi::sta::start();
|
|
|
+ TEST_ASSERT_FALSE(wifi::sta::connect("NonExistentSSID", "DefinitelyNotValid"));
|
|
|
+ wifi::stop();
|
|
|
+}
|