示例#1
0
def test_01():
    b = Bot('2')

    b.addValue('1')
    assert not b.needsToAct(), "Thinks it needs to act with one"
    b.addValue('   33  ')
    assert b.needsToAct(), "Thinks it doesn't need to act"
    try:
        b.getValue('233')
        assert False, "Bot accepted 3 values."
    except:
        pass
示例#2
0
def test_05():
    b = Bot('2')

    b.addValue('1')
    b.addValue('2')
    b.setInstruction('3', '4')

    d1, d2 = b.instruct()

    assert d1[0] == '3'
    assert d1[1] == 2
    assert d2[0] == '4'
    assert d2[1] == 1
示例#3
0
def test_04():
    b = Bot('output 2')

    b.addValue('1')
    b.addValue('2')
    b.setInstruction('output 4', '3')

    d1, d2 = b.instruct()

    assert d1[0] == 'output 4'
    assert d1[1] == 2
    assert d2[0] == '3'
    assert d2[1] == 1
示例#4
0
def test_02():
    b1 = Bot('2', (2, 3))
    b2 = Bot('1', (2, 3))
    b3 = Bot('1', (2, 3))
    b4 = Bot('1', (2, 3))

    b1.addValue('3')
    b1.addValue('2')
    b2.addValue('3')
    b2.addValue('3')
    b4.addValue('3')

    assert b1.foundIt(), "Bot didn't find it."
    assert not b2.foundIt(), "Bot didn't find it"
    assert not b3.foundIt()