Skip to content

Commit

Permalink
Merge branch 'feature/async_control' of https://github.com/psmgeelen/…
Browse files Browse the repository at this point in the history
…projecttea into feature/async_control
  • Loading branch information
omonrise committed Dec 29, 2023
2 parents 5e0bbcf + 0f8ea31 commit 4d1bab3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 250 deletions.
12 changes: 6 additions & 6 deletions controller/tea_poor/test/test_local/WaterPumpScheduler_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,17 @@ void test_pump_stops_after_given_time() {
waterPumpScheduler.start(runTimeMs, currentTimeMs);
// check status
auto status = waterPumpScheduler.status();
UNITY_TEST_ASSERT_TRUE(status.isRunning);
UNITY_TEST_ASSERT_EQUAL(status.stopTime, runTimeMs);
TEST_ASSERT_TRUE(status.isRunning);
TEST_ASSERT_EQUAL(status.stopTime, runTimeMs);

while (currentTimeMs < runTimeMs) {
waterPumpScheduler.tick(currentTimeMs);
UNITY_TEST_ASSERT_TRUE(fakeWaterPump.isRunning());
TEST_ASSERT_TRUE(fakeWaterPump.isRunning());
currentTimeMs += 100;
}
// pump should be stopped after given time
waterPumpScheduler.tick(runTimeMs + 1);
UNITY_TEST_ASSERT_FALSE(fakeWaterPump.isRunning());
TEST_ASSERT_FALSE(fakeWaterPump.isRunning());
}

// test that pump is periodically forced to stop after given time
Expand All @@ -60,14 +60,14 @@ void test_pump_is_periodically_forced_to_stop_after_given_time () {
waterPumpScheduler.start(1, currentTimeMs);
currentTimeMs += 1;
waterPumpScheduler.tick(currentTimeMs);
UNITY_TEST_ASSERT_FALSE(fakeWaterPump.isRunning()); // pump should be stopped after given time
TEST_ASSERT_FALSE(fakeWaterPump.isRunning()); // pump should be stopped after given time

for(int i = 0; i < 10; i++) {
// emulate that pump was started again
fakeWaterPump.start();
currentTimeMs += 1000;
waterPumpScheduler.tick(currentTimeMs);
UNITY_TEST_ASSERT_FALSE(fakeWaterPump.isRunning()); // pump should be stopped
TEST_ASSERT_FALSE(fakeWaterPump.isRunning()); // pump should be stopped
}
}

Expand Down
244 changes: 0 additions & 244 deletions controller/tea_poor/test/test_local/unity_config.h

This file was deleted.

0 comments on commit 4d1bab3

Please sign in to comment.