# Path: prolog/interpreter/test/tool.py
# def assert_true(query, e=None):
#     if e is None:
#         e = Engine()
#     terms, vars = e.parse(query)
#     term, = terms
#     e.run_query_in_current(term)
#     return dict([(name, var.dereference(None))
#                      for name, var in vars.iteritems()])
# 
# def assert_false(query, e=None):
#     if e is None:
#         e = Engine()
#     term = e.parse(query)[0][0]
#     py.test.raises(UnificationFailed, e.run_query_in_current, term)
# 
# def prolog_raises(exc, query, e=None):
#     prolog_catch = "catch(((%s), fail), error(%s), true)." % (query, exc)
#     return assert_true(prolog_catch, e)
# 
# Path: prolog/interpreter/test/tool.py
# def assert_true(query, e=None):
# def assert_false(query, e=None):
# def prolog_raises(exc, query, e=None):
#     def __init__(self, module, vars):
#     def activate(self, fcont, heap):
# def collect_all(engine, s):
# def parse(inp):
# def create_file(name, content):
# def delete_file(name):
# def create_dir(name):
# def delete_dir(name):
# def file_content(src):
# class CollectAllContinuation(Continuation):


import py
from prolog.interpreter.test.tool import assert_true, assert_false, prolog_raises
from prolog.interpreter.test.tool import get_engine

def test_basic_term_variables():
    assert_true("term_variables(X, [X]).")
    assert_false("term_variables(X, []).")
    assert_true("term_variables(f(X, Y), [X, Y]).")

# Path: prolog/interpreter/test/tool.py
# def assert_true(query, e=None):
#     if e is None:
#         e = Engine()
#     terms, vars = e.parse(query)
#     term, = terms
#     e.run_query_in_current(term)
#     return dict([(name, var.dereference(None))
#                      for name, var in vars.iteritems()])
# 
# def assert_false(query, e=None):
#     if e is None:
#         e = Engine()
#     term = e.parse(query)[0][0]
#     py.test.raises(UnificationFailed, e.run_query_in_current, term)
# 
# def prolog_raises(exc, query, e=None):
#     prolog_catch = "catch(((%s), fail), error(%s), true)." % (query, exc)
#     return assert_true(prolog_catch, e)
# 
# Path: prolog/interpreter/test/tool.py
# def assert_true(query, e=None):
# def assert_false(query, e=None):
# def prolog_raises(exc, query, e=None):
#     def __init__(self, module, vars):
#     def activate(self, fcont, heap):
# def collect_all(engine, s):
# def parse(inp):
# def create_file(name, content):
# def delete_file(name):
# def create_dir(name):
# def delete_dir(name):
# def file_content(src):
# class CollectAllContinuation(Continuation):


# Path: prolog/interpreter/test/test_term_variables.py
import py
from prolog.interpreter.test.tool import assert_true, assert_false, prolog_raises
from prolog.interpreter.test.tool import get_engine


def test_basic_term_variables():
    assert_true("term_variables(X, [X]).")
    assert_false("term_variables(X, []).")
    assert_true("term_variables(f(X, Y), [X, Y]).")

    assert_true("term_variables(a, []).")