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(TestWifiBeginNotConnected);
|
||||||
RUN_TEST(TestConnectAPI);
|
RUN_TEST(TestConnectAPI);
|
||||||
// RUN_TEST(TestConnectAPIFailed);
|
// RUN_TEST(TestConnectAPIFailed);
|
||||||
|
RUN_TEST(TestSendValue);
|
||||||
|
|
||||||
|
|
||||||
UNITY_END();
|
UNITY_END();
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
void TestWifiBeginConnected();
|
void TestWifiBeginConnected();
|
||||||
void TestWifiBeginNotConnected();
|
void TestWifiBeginNotConnected();
|
||||||
void TestConnectAPI();
|
void TestConnectAPI();
|
||||||
// void TestConnectAPIFailed();
|
void TestConnectAPIFailed();
|
||||||
|
void TestSendValue();
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -29,13 +29,21 @@ void TestConnectAPI() {
|
|||||||
TEST_ASSERT_EQUAL_MESSAGE(true, api->connect(), "Not Connected");
|
TEST_ASSERT_EQUAL_MESSAGE(true, api->connect(), "Not Connected");
|
||||||
}
|
}
|
||||||
|
|
||||||
// void TestConnectAPIFailed() {
|
//FIXME: boucle inf when connection failed
|
||||||
// API* api = new API("Carl", "toto", API_HOST);
|
void TestConnectAPIFailed() {
|
||||||
|
API* api = new API("Carl", "toto", API_HOST);
|
||||||
|
|
||||||
// Serial1.begin(MONITOR_SPEED);
|
Serial1.begin(MONITOR_SPEED);
|
||||||
// api->wifiBegin(WIFI_SSID, WIFI_PASSWORD, &Serial1);
|
api->wifiBegin(WIFI_SSID, WIFI_PASSWORD, &Serial1);
|
||||||
// TEST_ASSERT_EQUAL_MESSAGE(false, api->connect(), "Connected");
|
TEST_ASSERT_EQUAL_MESSAGE(false, api->connect(), "Connected");
|
||||||
// }
|
}
|
||||||
|
|
||||||
//Testing SendValue function
|
//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