Example #1
0
def test_read_instructions():
    expected_instructions = [{
        'mask':
        'XXXXXXXXXXXXXXXXXXXXXXXXXXXXX1XXXX0X',
        'writes': [{
            'address': 8,
            'decimal': 11
        }, {
            'address': 7,
            'decimal': 101
        }, {
            'address': 8,
            'decimal': 0
        }]
    }]
    acutal_instructions = program.read_instructions('example.txt')
    assert acutal_instructions == expected_instructions
Example #2
0
def test_sum_program_2():
    instructions = program.read_instructions('example2.txt')
    memory = program.run_instructions2(instructions, {})
    expected_memory_sum = program.sum_memory(memory)
    assert expected_memory_sum == 208
Example #3
0
def test_run_instructions():
    starting_memory = {}
    instructions = program.read_instructions('example.txt')
    expected_memory = {7: 101, 8: 64}
    actual_memory = program.run_instructions(instructions, starting_memory)
    assert actual_memory == expected_memory