def test_blocksworld_add():
    lang = blocksworld.generate_small_fstrips_bw_language()
    model = Model(lang)
    clear = lang.get_predicate('clear')
    b1 = lang.get_constant('b1')
    b2 = lang.get_constant('b2')
    model.add(clear, b1)
    assert evaluate(clear(b1), model) is True
    assert evaluate(clear(b2), model) is False
示例#2
0
def test_blocksworld_set():
    lang = blocksworld.generate_small_fstrips_bw_language()
    model = Model(lang)
    loc = lang.get_function('loc')
    b1, table = (lang.get_constant(s) for s in ('b1', 'table'))
    model.set(loc, b1, table)

    assert evaluate(loc(b1), model) == table
示例#3
0
def test_zero_ary_predicate_set():
    L = tarski.language()

    P = L.predicate('P')

    M = Model(L)
    M.add(P)

    assert evaluate(P(), M) is True
示例#4
0
def test_blocksworld_add_and_remove():
    lang = tarski.benchmarks.blocksworld.generate_fstrips_bw_language()
    model = Model(lang)

    clear = lang.get_predicate('clear')
    b1 = lang.get_constant('b1')
    b2 = lang.get_constant('b2')

    model.add(clear, b1)
    model.add(clear, b2)
    model.remove(clear, b1)
    assert evaluate(clear(b1), model) is False