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
Revision 23:46cc7d776988, committed 2016-06-13
- Comitter:
- sbouber1
- Date:
- Mon Jun 13 13:47:33 2016 +0000
- Parent:
- 22:4b5bf1c2e1ff
- Child:
- 25:169672dbab91
- Commit message:
- update test cases
Changed in this revision
| testing.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/testing.cpp Mon Jun 13 13:25:57 2016 +0000
+++ b/testing.cpp Mon Jun 13 13:47:33 2016 +0000
@@ -15,12 +15,13 @@
}
+MOCK(salt_mock_steady, 6.1);
+MOCK(prox_mock_steady, 10.0);
+
MOCK(temp_mock1, 40.1+(t/1000.0));
-MOCK(salt_mock1, 6.1);
-MOCK(prox_mock1, 10.0);
bool testTempDangerousHighAlarm(TestCase *tc) {
- DEF_MOCKS(temp_mock1, salt_mock1, prox_mock1);
+ DEF_MOCKS(temp_mock1, salt_mock_steady, prox_mock_steady);
AlarmController alarm(false,0,&temp,&salt,&prox);
for(int i = 0; i < NUMBER_OF_SEC_BEFORE_CRITICAL_ALARM+1; i++) {
@@ -35,7 +36,7 @@
MOCK(temp_mock2, 29.9-(t/1000.0));
bool testTempDangerousLowAlarm(TestCase *tc) {
- DEF_MOCKS(temp_mock2, salt_mock1, prox_mock1);
+ DEF_MOCKS(temp_mock2, salt_mock_steady, prox_mock_steady);
AlarmController alarm(false,0,&temp,&salt,&prox);
for(int i = 0; i < NUMBER_OF_SEC_BEFORE_CRITICAL_ALARM+1; i++) {
@@ -49,7 +50,7 @@
MOCK(temp_mock3, 30+t*0.000001);
bool testTempLowRangeAlarm(TestCase *tc) {
- DEF_MOCKS(temp_mock3, salt_mock1, prox_mock1);
+ DEF_MOCKS(temp_mock3, salt_mock_steady, prox_mock_steady);
AlarmController alarm(false,0,&temp,&salt,&prox);
for(int i = 0; i < NUMBER_OF_SEC_BEFORE_DANGEROUS_ALARM+1; i++) {
@@ -64,7 +65,7 @@
MOCK(temp_mock4, 38+t*0.000001);
bool testTempHighRangeAlarm(TestCase *tc) {
- DEF_MOCKS(temp_mock4, salt_mock1, prox_mock1);
+ DEF_MOCKS(temp_mock4, salt_mock_steady, prox_mock_steady);
AlarmController alarm(false,0,&temp,&salt,&prox);
for(int i = 0; i < NUMBER_OF_SEC_BEFORE_DANGEROUS_ALARM+1; i++) {
@@ -76,11 +77,27 @@
}
+bool testTemperatureHeater(TestCase *tc) {
+ // TODO
+ return true;
+}
+
+bool testAlarmWaterOverflow(TestCase *tc) {
+ // TODO
+ return true;
+}
+
+bool testAlarmWaterLeak(TestCase *tc) {
+ // TODO
+ return true;
+}
+
int test_main() {
TestCase t1("Test if alarm is raised when temp > 40 for 30 seconds", testTempDangerousHighAlarm);
TestCase t2("Test if alarm is raised when temp < 30 for 30 seconds", testTempDangerousLowAlarm);
TestCase t3("Test if alarm is raised when temp > 30 and < 32 for 300 seconds", testTempLowRangeAlarm);
- TestCase t4("Test if alarm is raised when temp > 38 and < 40 for 300 seconds", testTempHighRangeAlarm);
+ TestCase t4("Test if alarm is raised when temp > 38 and < 40 for 300 seconds", testTempHighRangeAlarm);
+ TestCase t5("Test if heater gets enabled at < 32 and disabled at 32+", testTemperatureHeater);
return 0;
}
\ No newline at end of file