def test_findall_or_p(self): x, y = Var('x'), Var('y') eq_( eval( findall( macrorules([[x, y], x], [[x, y], y])(prin(1), prin(2)))), None)
def test_findall2(self): cut_or_cont = il.Var('cut_or_cont') x, y = Var('x'), Var('y') findall_result = il.Var('findall_result') result = cps(findall(or_(1, 2), x, y)) expect = 1 eq_(result, expect)
def test_findall_template_func(self): x, y, z = LogicVar('x'), LogicVar('y'), LogicVar('z') f = Var('f') eq_( eval( let([(f, rules(((), 2), ((), 3)))], findall(is_(x, f()), x, y), getvalue(y))), [2, 3])
def test_findall_template_or(self): x, y, z = LogicVar('x'), LogicVar('y'), LogicVar('z') f = Var('f') eq_(eval(begin(findall(or_(is_(x, 1), is_(x, 2)), x, y), getvalue(y))), [1, 2])
def test_findall_first_p(self): eq_(eval(findall(first_p(prin(1), prin(2)))), None)
def test_findall_or_once(self): eq_(eval(findall(once(or_(prin(1), prin(2))))), None)
def test_between3(self): x = LogicVar('x') y = LogicVar('y') eq_(eval(begin(findall(between(1, 3, x), x, y), getvalue(y))), [1, 2, 3])
def test_findall(self): cut_or_cont = il.Var('cut_or_cont') result = cps(findall(or_(1, 2))) expect = 1 eq_(result, expect)
def test_sub_string2(self): eq_(eval(begin(findall(subsequence('ab', x, y, z, k), k, z), z)), ['a', 'ab', 'b'])
def test_findall_template_func(self): x, y, z = LogicVar('x'), LogicVar('y'), LogicVar('z') f = Var('f') eq_(eval(let([(f, rules(((), 2), ((), 3)))], findall(is_(x, f()), x, y), getvalue(y))), [2, 3])
def test_findall_or_p(self): x, y = Var('x'), Var('y') eq_(eval(findall(macrorules([[x, y], x], [[x, y], y])(prin(1), prin(2)))), None)
def test_findall_string_concat2(self): eq_(eval(begin(findall(concat(x, y, "abc"), L(x, y), z), z)), [L("a", "bc"), L("ab", "c")])
def test_sub_string(self): eq_(eval(begin(findall(subsequence('ab', 0, y, 2, "ab"), y, z), z)), [2])