def test_generate_vm_configuration(args, kwargs, expected):
    actual = _generate_vm_configuration(*args, **kwargs)
    assert len(actual) == len(expected)

    for left, right in zip(actual, expected):
        left_block, left_vm = left
        right_block, right_vm = right

        assert left_block == right_block

        if right_vm == Forks.Frontier:
            assert 'Frontier' in left_vm.__name__
        elif right_vm == Forks.Homestead:
            assert 'Homestead' in left_vm.__name__
            dao_start_block = kwargs.get('dao_start_block')
            if dao_start_block is False:
                assert left_vm.support_dao_fork is False
            elif dao_start_block is None:
                assert left_vm.support_dao_fork is True
                assert left_vm.dao_fork_block_number == right_block
            else:
                assert left_vm.support_dao_fork is True
                assert left_vm.dao_fork_block_number == dao_start_block
        elif right_vm == Forks.TangerineWhistle:
            assert 'TangerineWhistle' in left_vm.__name__
        elif right_vm == Forks.SpuriousDragon:
            assert 'SpuriousDragon' in left_vm.__name__
        elif right_vm == Forks.Byzantium:
            assert 'Byzantium' in left_vm.__name__
        elif right_vm == Forks.Custom:
            assert 'CustomFrontier' in left_vm.__name__
        else:
            assert False, "Invariant"
Exemplo n.º 2
0
def test_generate_vm_configuration(args, kwargs, expected):
    actual = _generate_vm_configuration(*args, **kwargs)
    assert len(actual) == len(expected)

    for left, right in zip(actual, expected):
        left_block, left_vm = left
        right_block, right_vm = right

        assert left_block == right_block

        assert right_vm.value in left_vm.__name__

        if right_vm == Forks.Homestead:
            dao_start_block = kwargs.get('dao_start_block')
            if dao_start_block is False:
                assert left_vm.support_dao_fork is False
            elif dao_start_block is None:
                assert left_vm.support_dao_fork is True
                assert left_vm.get_dao_fork_block_number() == right_block
            else:
                assert left_vm.support_dao_fork is True
                assert left_vm.get_dao_fork_block_number() == dao_start_block