예제 #1
0
def test_given_four_cell_panel_then_it_has_four_OFF_lights():
    panel = Panel(4)

    assert panel.coordinate(0, 0).status == Light.OFF
    assert panel.coordinate(0, 1).status == Light.OFF
    assert panel.coordinate(1, 0).status == Light.OFF
    assert panel.coordinate(1, 1).status == Light.OFF
예제 #2
0
def test_given_one_cell_panel_then_it_can_be_ON_light():
    panel = Panel(1)
    start_coordinate = Coordinate(0, 0)
    end_coordinate = Coordinate(0, 0)
    panel.turn_on(start_coordinate, end_coordinate)

    assert panel.coordinate(x=0, y=0).status == Light.ON
예제 #3
0
def test_given_four_cell_panel_and_power_on_all_then_four_lights_on():
    panel = Panel(4)
    start_coordinate = Coordinate(0, 0)
    end_coordinate = Coordinate(1, 1)
    panel.turn_on(start_coordinate, end_coordinate)

    assert panel.lights_on() == 4
예제 #4
0
def test_given_a_panel_then_it_is_panel_with_set_size():
    size = 1000

    panel = Panel(size)

    assert isinstance(panel, Panel)
    assert panel.size == size
예제 #5
0
def test_given_four_cell_panel_then_power_on_and_then_off():
    panel = Panel(4)
    panel.turn_on(Coordinate(0, 0), Coordinate(1, 0))
    panel.turn_off(Coordinate(0, 0), Coordinate(1, 1))

    assert panel.coordinate(0, 0).status == Light.OFF
    assert panel.coordinate(0, 1).status == Light.OFF
    assert panel.coordinate(1, 0).status == Light.OFF
    assert panel.coordinate(1, 1).status == Light.OFF
예제 #6
0
def test_given_four_cell_panel_then_power_on_first_row():
    panel = Panel(4)
    start_coordinate = Coordinate(0, 0)
    end_coordinate = Coordinate(1, 0)
    panel.turn_on(start_coordinate, end_coordinate)

    assert panel.coordinate(1, 1).status == Light.OFF
    assert panel.coordinate(0, 1).status == Light.OFF
    assert panel.coordinate(1, 0).status == Light.ON
    assert panel.coordinate(0, 0).status == Light.ON
예제 #7
0
def test_given_one_cell_panel_then_it_has_one_OFF_light():
    panel = Panel(1)

    assert panel.coordinate(x=0, y=0).status == Light.OFF