Ejemplo n.º 1
0
def test_load_input():
    filepath = Path(__file__).parent / "sample_input_1.txt"
    expected = [
        ("mask", "", "XXXXXXXXXXXXXXXXXXXXXXXXXXXXX1XXXX0X"),
        ("mem", "8", "11"),
        ("mem", "7", "101"),
        ("mem", "8", "0"),
    ]
    assert load_input(filepath) == expected
Ejemplo n.º 2
0
 def test_step(self):
     filepath = Path(__file__).parent / "sample_input.txt"
     layout = load_input(filepath)
     sim = SeatingSimulation(layout)
     expected = [
         "#.##.##.##",
         "#######.##",
         "#.#.#..#..",
         "####.##.##",
         "#.##.##.##",
         "#.#####.##",
         "..#.#.....",
         "##########",
         "#.######.#",
         "#.#####.##",
     ]
     expected = [list(string) for string in expected]
     sim.step()
     assert sim.current == expected
Ejemplo n.º 3
0
 def test_run(self):
     filepath = Path(__file__).parent / "sample_input.txt"
     layout = load_input(filepath)
     sim = SeatingSimulation(layout)
     assert sim.run() == 26