Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed DRV88255 TextLCD Ping mbed-rtos
Diff: testing.cpp
- Revision:
- 19:ee89eabe1fa2
- Child:
- 21:17dd0d778bda
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing.cpp Mon Jun 13 12:33:52 2016 +0000 @@ -0,0 +1,33 @@ +#include "MockSensorController.h" +#include "AlarmController.h" +#include "testing.h" + + + +void TestCase::assertTrue(bool b, const char *error) { + if(!b) { + printf("[%s] ASSERTION FAILED: %s\r\n", this->name, error); + this->failed = true; + } +} + + +MOCK(temp_mock1, 40.1); +MOCK(salt_mock1, 4.0); +MOCK(prox_mock1, 10.0); +bool testTempDangerousHighAlarm(TestCase *tc) { + + DEF_MOCKS(temp_mock1, salt_mock1, prox_mock1); + + AlarmController alarm(false,0,&temp,&salt,&prox); + alarm.run(); + return alarm.is_error(); +} + + + +int test_main() { + TestCase t1("Test if alarm is raised when seconds when temp > 40", testTempDangerousHighAlarm); + + return 0; +} \ No newline at end of file