thermostat

Just a TDD exercise
git clone https://git.tronto.net/thermostat
Download | Log | Files | Refs | README

commit c19d6fd991cee4fd41e6127e259ef0ccb35b1b50
parent 7d79bf68b1901e62d9e9d11bed2c78ed001f1d31
Author: Sebastiano Tronto <sebastiano@tronto.net>
Date:   Sun, 28 May 2023 22:17:17 +0200

[RED] Two set points, time between them -> returns first

Diffstat:
Mthermostat.py | 8++++++++
1 file changed, 8 insertions(+), 0 deletions(-)

diff --git a/thermostat.py b/thermostat.py @@ -48,3 +48,11 @@ class ThermostatTests(unittest.TestCase): thermostat.AddSetPoint(hour, requiredTemperature) newRequiredTemperature = thermostat.GetCurrentRequiredTemperature() self.assertEqual(oldRequiredTemperature, newRequiredTemperature) + + def test_GivenTwoSetPoints_WhenTimeIsBetweenThem_ThenRequiredTemperatureIsFirst(self): + hour1, hour2 = 12, 15 + temp1, temp2 = 55, 75 + thermostat = TestableThermostat(14) + thermostat.AddSetPoint(hour1, temp1) + thermostat.AddSetPoint(hour2, temp2) + self.assertEqual(thermostat.GetCurrentRequiredTemperature(), 55)