diff options
author | Timotej Lazar <timotej.lazar@araneo.org> | 2015-05-06 16:26:57 +0200 |
---|---|---|
committer | Aleš Smodiš <aless@guru.si> | 2015-08-11 14:26:03 +0200 |
commit | 368bb943b548e9b3f338b4a73379608221388bf8 (patch) | |
tree | c103e887b525a4bbeef25b3f3cf28554b6768902 /monkey | |
parent | daf19282ec7783346104ca65b01e4e5f1e2c7128 (diff) |
Remove app-specific code from prolog.engine
Diffstat (limited to 'monkey')
-rwxr-xr-x | monkey/monkey.py | 11 | ||||
-rwxr-xr-x | monkey/test.py | 3 |
2 files changed, 11 insertions, 3 deletions
diff --git a/monkey/monkey.py b/monkey/monkey.py index fd11868..f64a142 100755 --- a/monkey/monkey.py +++ b/monkey/monkey.py @@ -3,11 +3,20 @@ import math import time +import prolog.engine from .edits import classify_edits -from prolog.engine import test from prolog.util import Token, annotate, compose, map_vars, normalized, rename_vars, stringify from .util import PQueue +# Check whether all tests for problem [name] succeed. +def test(name, code): + try: + reply = prolog.engine.create_and_ask( + code=code, query='run_tests({})'.format(name)) + return reply.get('event') == 'success' + except Exception as ex: + return False + # Starting from [code], find a sequence of edits that transforms it into a # correct predicate for [name]. Append [aux_code] when testing (available facts # and predicates). diff --git a/monkey/test.py b/monkey/test.py index 1909f8d..6887a2c 100755 --- a/monkey/test.py +++ b/monkey/test.py @@ -9,8 +9,7 @@ from termcolor import colored from .edits import classify_edits, trace_graph from .graph import graphviz -from .monkey import fix, fix_hints -from prolog.engine import test +from .monkey import fix, fix_hints, test from prolog.util import annotate, compose, stringify from .util import indent |