def test_memory_extension(initial_size, start, extension_size): # Arrange machine_state = MachineState(gas_limit=8000000) machine_state.memory = [0] * initial_size # Act machine_state.mem_extend(start, extension_size) # Assert assert machine_state.memory_size == len(machine_state.memory) assert machine_state.memory_size == max(initial_size, start + extension_size)
def test_memory_extension(initial_size, start, extension_size): # Arrange machine_state = MachineState(gas_limit=8000000) machine_state.memory = Memory() machine_state.memory.extend(initial_size) # Act machine_state.mem_extend(start, extension_size) # Assert assert machine_state.memory_size == len(machine_state.memory) assert machine_state.memory_size == max( initial_size, (utils.ceil32(start + extension_size) // 32) * 32 )