from exploits.tree import avl_tree
from test.exploits.dummy_output import DummyOutput
from input.ints import IntGenerator


def test_run():
    output = DummyOutput()
    n_inputs = 10
    avl_tree.options['n_inputs'] = n_inputs
    avl_tree.run(IntGenerator(), output)
    assert len(output) == n_inputs
    for i in range(len(output) - 1):
        assert output[i] == output[i + 1] + 1


def test_more_inputs():
    output = DummyOutput()
    n_inputs = 100
    avl_tree.options['n_inputs'] = n_inputs
    avl_tree.run(IntGenerator(), output)
    assert len(output) == n_inputs
    for i in range(len(output) - 1):
        assert output[i] == output[i + 1] + 1
