Saltware / Mbed 2 deprecated Water Play

Dependencies:   mbed DRV88255 TextLCD Ping mbed-rtos

Revision:
19:ee89eabe1fa2
Child:
21:17dd0d778bda
diff -r da84737ee427 -r ee89eabe1fa2 testing.cpp
--- /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