Esempio n. 1
0
def test_interface_get_result():
    people = [Person('Bob', 12), Person('Jack', 11)]
    interface = Interface()
    interface.reader = people
    interface.create_josephus()
    result = interface.get_result()

    assert result == "elimination Bob, 12\nwinner\tJack, 11\n"
Esempio n. 2
0
def test_interface_create_josephus():
    interface = Interface()
    interface.reader = TxtReader("data/person.txt")
    interface.start = 2
    interface.step = 3
    interface.create_josephus()

    assert interface.josephus.start == 2
    assert interface.josephus.step == 3
    assert interface.josephus.people == [
        Person('Bob', 15),
        Person('Jack', 12),
        Person('Allen', 17),
        Person('Tony', 20),
        Person('Peter', 15),
        Person('Rose', 16),
        Person('Wade', 19)
    ]