def test_color_BLUE_to_GREEN_transition(self): main() color_strip = get_color_strip_instance() pwr_meter = get_pwr_meter_instance() self.assertEqual(BLACK, color_strip.current_color) pwr_meter.send_power_event(73) self.assertEqual(BLUE, color_strip.current_color) pwr_meter.send_power_event(74) self.assertEqual(BLUE, color_strip.current_color) pwr_meter.send_power_event(76) self.assertEqual(BLUE, color_strip.current_color) # # should change color around the threshold pwr_meter.send_power_event(77) self.assertEqual(GREEN, color_strip.current_color) pwr_meter.send_power_event(78) self.assertEqual(GREEN, color_strip.current_color) # #make sure going back down a bit doesn't change the color pwr_meter.send_power_event(75) self.assertEqual(GREEN, color_strip.current_color) pwr_meter.send_power_event(73) self.assertEqual(GREEN, color_strip.current_color) # # should change color around the threshold pwr_meter.send_power_event(72) self.assertEqual(BLUE, color_strip.current_color)
def test_color_ORANGE_to_RED_transition(self): main() color_strip = get_color_strip_instance() pwr_meter = get_pwr_meter_instance() self.assertEqual(BLACK, color_strip.current_color) pwr_meter.send_power_event(117) self.assertEqual(ORANGE, color_strip.current_color) pwr_meter.send_power_event(118) self.assertEqual(ORANGE, color_strip.current_color) pwr_meter.send_power_event(119) self.assertEqual(ORANGE, color_strip.current_color) # # should change color around the threshold pwr_meter.send_power_event(120) self.assertEqual(RED, color_strip.current_color) pwr_meter.send_power_event(121) self.assertEqual(RED, color_strip.current_color) # #make sure going back down a bit doesn't change the color pwr_meter.send_power_event(117) self.assertEqual(RED, color_strip.current_color) pwr_meter.send_power_event(116) self.assertEqual(RED, color_strip.current_color) # # should change color around the threshold pwr_meter.send_power_event(114) self.assertEqual(ORANGE, color_strip.current_color)
def test_0_watts(self): main() color_strip = get_color_strip_instance() pwr_meter = get_pwr_meter_instance() self.assertEqual(BLACK, color_strip.current_color) pwr_meter.send_power_event(0) self.assertEqual(WHITE, color_strip.current_color)
def test_implossibly_high_power(self): main() color_strip = get_color_strip_instance() pwr_meter = get_pwr_meter_instance() self.assertEqual(BLACK, color_strip.current_color) pwr_meter.send_power_event(10000) self.assertEqual(RED, color_strip.current_color)
def test_ramp_up_and_down(self): main() color_strip = get_color_strip_instance() pwr_meter = get_pwr_meter_instance() self.assertEqual(BLACK, color_strip.current_color) pwr_meter.send_power_event(55) self.assertEqual(WHITE, color_strip.current_color) pwr_meter.send_power_event(58) self.assertEqual(WHITE, color_strip.current_color) pwr_meter.send_power_event(61) self.assertEqual(BLUE, color_strip.current_color) pwr_meter.send_power_event(71) self.assertEqual(BLUE, color_strip.current_color) pwr_meter.send_power_event(74) self.assertEqual(BLUE, color_strip.current_color) pwr_meter.send_power_event(77) self.assertEqual(GREEN, color_strip.current_color) pwr_meter.send_power_event(86) self.assertEqual(GREEN, color_strip.current_color) pwr_meter.send_power_event(89) self.assertEqual(GREEN, color_strip.current_color) pwr_meter.send_power_event(92) self.assertEqual(YELLOW, color_strip.current_color) pwr_meter.send_power_event(89) self.assertEqual(YELLOW, color_strip.current_color) pwr_meter.send_power_event(86) self.assertEqual(GREEN, color_strip.current_color) pwr_meter.send_power_event(78) self.assertEqual(GREEN, color_strip.current_color) pwr_meter.send_power_event(75) self.assertEqual(GREEN, color_strip.current_color) pwr_meter.send_power_event(72) self.assertEqual(BLUE, color_strip.current_color) pwr_meter.send_power_event(62) self.assertEqual(BLUE, color_strip.current_color) pwr_meter.send_power_event(59) self.assertEqual(BLUE, color_strip.current_color) pwr_meter.send_power_event(56) self.assertEqual(WHITE, color_strip.current_color)