feat: add Test for sendValue
This commit is contained in:
parent
36bdb86343
commit
884169e745
@ -10,6 +10,7 @@ void setup() {
|
||||
RUN_TEST(TestWifiBeginNotConnected);
|
||||
RUN_TEST(TestConnectAPI);
|
||||
// RUN_TEST(TestConnectAPIFailed);
|
||||
RUN_TEST(TestSendValue);
|
||||
|
||||
|
||||
UNITY_END();
|
||||
|
@ -4,6 +4,7 @@
|
||||
void TestWifiBeginConnected();
|
||||
void TestWifiBeginNotConnected();
|
||||
void TestConnectAPI();
|
||||
// void TestConnectAPIFailed();
|
||||
void TestConnectAPIFailed();
|
||||
void TestSendValue();
|
||||
|
||||
#endif
|
@ -29,13 +29,21 @@ void TestConnectAPI() {
|
||||
TEST_ASSERT_EQUAL_MESSAGE(true, api->connect(), "Not Connected");
|
||||
}
|
||||
|
||||
// void TestConnectAPIFailed() {
|
||||
// API* api = new API("Carl", "toto", API_HOST);
|
||||
//FIXME: boucle inf when connection failed
|
||||
void TestConnectAPIFailed() {
|
||||
API* api = new API("Carl", "toto", API_HOST);
|
||||
|
||||
// Serial1.begin(MONITOR_SPEED);
|
||||
// api->wifiBegin(WIFI_SSID, WIFI_PASSWORD, &Serial1);
|
||||
// TEST_ASSERT_EQUAL_MESSAGE(false, api->connect(), "Connected");
|
||||
// }
|
||||
Serial1.begin(MONITOR_SPEED);
|
||||
api->wifiBegin(WIFI_SSID, WIFI_PASSWORD, &Serial1);
|
||||
TEST_ASSERT_EQUAL_MESSAGE(false, api->connect(), "Connected");
|
||||
}
|
||||
|
||||
//Testing SendValue function
|
||||
void TestSendValue() {
|
||||
API* api = new API(USER_NAME, USER_PASSWORD, API_HOST);
|
||||
|
||||
Serial1.begin(MONITOR_SPEED);
|
||||
api->wifiBegin(WIFI_SSID, WIFI_PASSWORD, &Serial1);
|
||||
TEST_ASSERT_EQUAL_MESSAGE(true, api->sendValue("30", "gdnuxl0wlgurtj3", "W", true), "Not Connected to server");
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user