-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#109: modify temp tests & add test macros
- Loading branch information
1 parent
9c1abab
commit 9a54b8f
Showing
4 changed files
with
40 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,26 @@ | ||
#include "TempTests.h" | ||
|
||
static Temperature *temp = NULL; | ||
Temperature temp(TEMP_PIN, digital, "Temperature", "Celsius", 't'); | ||
|
||
void initTemperature() | ||
{ | ||
temp = new Temperature(TEMP_PIN, digital, "Temperature", "Celsius", 't'); | ||
} | ||
|
||
void cleanUp_Temperature() | ||
bool test_Temp_read() | ||
{ | ||
if (temp == NULL) | ||
return; | ||
delete temp; | ||
temp = NULL; | ||
} | ||
String read = temp.read(); | ||
String err = "0.00,"; | ||
String result = "Temperature: " + read; | ||
Serial.println(result); | ||
if (err == read) | ||
TEST_FAIL_MESSAGE("Temperature Reading Failed"); | ||
|
||
void test_Temp_read() | ||
{ | ||
if (temp == NULL) | ||
TEST_FAIL_MESSAGE("Temp Sensor did not initialize properly"); | ||
|
||
String read = temp->read(); | ||
String err = "nan,"; | ||
String print = "Temperature: " + read; | ||
Serial.println(print); | ||
if (read == err) | ||
TEST_FAIL_MESSAGE("Cannot read from Temperature Sensor"); | ||
return true; | ||
} | ||
|
||
void testTemp() | ||
{ | ||
initTemperature(); | ||
test_Temp_read(); | ||
cleanUp_Temperature(); | ||
String tag = "Temperature Sensor"; | ||
printTestStart(tag); | ||
|
||
RUN_TEST(test_Temp_read); | ||
|
||
printTestEnd(tag); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters