diff options
author | Timotej Lazar <timotej.lazar@fri.uni-lj.si> | 2015-12-23 16:23:43 +0100 |
---|---|---|
committer | Timotej Lazar <timotej.lazar@fri.uni-lj.si> | 2015-12-23 16:23:43 +0100 |
commit | c1bb0d56b2c0482c766d094c65fdf0fd9d1aa0ba (patch) | |
tree | b23a943e337fc81ad3bc898450229c3974f8388c /prolog/problems | |
parent | 766e2ba30413850ab43842de0aa3e9a80c5e7236 (diff) |
Simplify Prolog test function
Diffstat (limited to 'prolog/problems')
53 files changed, 106 insertions, 275 deletions
diff --git a/prolog/problems/clp_fd/gcd_3/common.py b/prolog/problems/clp_fd/gcd_3/common.py index 6e62e3b..f24e0bb 100644 --- a/prolog/problems/clp_fd/gcd_3/common.py +++ b/prolog/problems/clp_fd/gcd_3/common.py @@ -35,14 +35,11 @@ test_cases = [ [{'X': '6'}]), ] -def test(program, solved_problems): - code = (program + '\n' + - server.problems.solutions_for_problems('prolog', solved_problems)) - +def test(code, aux_code): n_correct = 0 engine_id = None try: - engine_id, output = prolog.engine.create(code=code, timeout=1.0) + engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0) if engine_id is not None and 'error' not in map(itemgetter(0), output): # Engine successfully created, and no syntax error in program. for query, answers in test_cases: diff --git a/prolog/problems/clp_fd/magic_1/common.py b/prolog/problems/clp_fd/magic_1/common.py index b897cb3..3ffe72f 100644 --- a/prolog/problems/clp_fd/magic_1/common.py +++ b/prolog/problems/clp_fd/magic_1/common.py @@ -33,14 +33,11 @@ test_cases = [ [8, 1, 6, 3, 5, 7, 4, 9, 2], [8, 3, 4, 1, 5, 9, 6, 7, 2]]'}]), ] -def test(program, solved_problems): - code = (program + '\n' + - server.problems.solutions_for_problems('prolog', solved_problems)) - +def test(code, aux_code): n_correct = 0 engine_id = None try: - engine_id, output = prolog.engine.create(code=code, timeout=1.0) + engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0) if engine_id is not None and 'error' not in map(itemgetter(0), output): # Engine successfully created, and no syntax error in program. for query, answers in test_cases: diff --git a/prolog/problems/clp_fd/puzzle_abc_3/common.py b/prolog/problems/clp_fd/puzzle_abc_3/common.py index 34ad409..ffce416 100644 --- a/prolog/problems/clp_fd/puzzle_abc_3/common.py +++ b/prolog/problems/clp_fd/puzzle_abc_3/common.py @@ -25,14 +25,11 @@ test_cases = [ [{'X': '[12/10/5]'}]), ] -def test(program, solved_problems): - code = (program + '\n' + - server.problems.solutions_for_problems('prolog', solved_problems)) - +def test(code, aux_code): n_correct = 0 engine_id = None try: - engine_id, output = prolog.engine.create(code=code, timeout=1.0) + engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0) if engine_id is not None and 'error' not in map(itemgetter(0), output): # Engine successfully created, and no syntax error in program. for query, answers in test_cases: diff --git a/prolog/problems/clp_fd/puzzle_beth_1/common.py b/prolog/problems/clp_fd/puzzle_beth_1/common.py index 8a975ee..fb00516 100644 --- a/prolog/problems/clp_fd/puzzle_beth_1/common.py +++ b/prolog/problems/clp_fd/puzzle_beth_1/common.py @@ -20,14 +20,11 @@ test_cases = [ [{'X': '[12]'}]), ] -def test(program, solved_problems): - code = (program + '\n' + - server.problems.solutions_for_problems('prolog', solved_problems)) - +def test(code, aux_code): n_correct = 0 engine_id = None try: - engine_id, output = prolog.engine.create(code=code, timeout=1.0) + engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0) if engine_id is not None and 'error' not in map(itemgetter(0), output): # Engine successfully created, and no syntax error in program. for query, answers in test_cases: diff --git a/prolog/problems/clp_fd/puzzle_momson_2/common.py b/prolog/problems/clp_fd/puzzle_momson_2/common.py index 0f9e0a8..906bd15 100644 --- a/prolog/problems/clp_fd/puzzle_momson_2/common.py +++ b/prolog/problems/clp_fd/puzzle_momson_2/common.py @@ -27,14 +27,11 @@ test_cases = [ [{'X': '[42/24, 51/15]'}]), ] -def test(program, solved_problems): - code = (program + '\n' + - server.problems.solutions_for_problems('prolog', solved_problems)) - +def test(code, aux_code): n_correct = 0 engine_id = None try: - engine_id, output = prolog.engine.create(code=code, timeout=1.0) + engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0) if engine_id is not None and 'error' not in map(itemgetter(0), output): # Engine successfully created, and no syntax error in program. for query, answers in test_cases: diff --git a/prolog/problems/clp_fd/puzzle_ratio_2/common.py b/prolog/problems/clp_fd/puzzle_ratio_2/common.py index eca7f62..736cd2e 100644 --- a/prolog/problems/clp_fd/puzzle_ratio_2/common.py +++ b/prolog/problems/clp_fd/puzzle_ratio_2/common.py @@ -28,14 +28,11 @@ test_cases = [ [{'X': '[30/24]'}]), ] -def test(program, solved_problems): - code = (program + '\n' + - server.problems.solutions_for_problems('prolog', solved_problems)) - +def test(code, aux_code): n_correct = 0 engine_id = None try: - engine_id, output = prolog.engine.create(code=code, timeout=1.0) + engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0) if engine_id is not None and 'error' not in map(itemgetter(0), output): # Engine successfully created, and no syntax error in program. for query, answers in test_cases: diff --git a/prolog/problems/clp_fd/tobase_3/common.py b/prolog/problems/clp_fd/tobase_3/common.py index 5e3a783..3783396 100644 --- a/prolog/problems/clp_fd/tobase_3/common.py +++ b/prolog/problems/clp_fd/tobase_3/common.py @@ -36,14 +36,11 @@ test_cases = [ [{'X': '[2/1111011, 3/11120, 4/1323, 5/443, 6/323, 7/234, 8/173, 9/146, 10/123]'}]), ] -def test(program, solved_problems): - code = (program + '\n' + - server.problems.solutions_for_problems('prolog', solved_problems)) - +def test(code, aux_code): n_correct = 0 engine_id = None try: - engine_id, output = prolog.engine.create(code=code, timeout=1.0) + engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0) if engine_id is not None and 'error' not in map(itemgetter(0), output): # Engine successfully created, and no syntax error in program. for query, answers in test_cases: diff --git a/prolog/problems/family_relations/ancestor_2/common.py b/prolog/problems/family_relations/ancestor_2/common.py index 68cbc6d..48ea512 100644 --- a/prolog/problems/family_relations/ancestor_2/common.py +++ b/prolog/problems/family_relations/ancestor_2/common.py @@ -40,15 +40,11 @@ test_cases = [ [{'X': 'vanessa'}, {'X': 'patrick'}, {'X': 'tina'}, {'X': 'thomas'}, {'X': 'william'}]), ] -def test(program, solved_problems): - code = (program + '\n' + - server.problems.solutions_for_problems('prolog', solved_problems) + '\n' + - server.problems.load_facts('prolog', facts).facts) - +def test(code, aux_code): n_correct = 0 engine_id = None try: - engine_id, output = prolog.engine.create(code=code, timeout=1.0) + engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0) if engine_id is not None and 'error' not in map(itemgetter(0), output): # Engine successfully created, and no syntax error in program. for query, answers in test_cases: diff --git a/prolog/problems/family_relations/aunt_2/common.py b/prolog/problems/family_relations/aunt_2/common.py index b0a18bf..507460f 100644 --- a/prolog/problems/family_relations/aunt_2/common.py +++ b/prolog/problems/family_relations/aunt_2/common.py @@ -44,15 +44,11 @@ test_cases = [ [{'X': 'vanessa'}, {'X': 'patricia'}]), ] -def test(program, solved_problems): - code = (program + '\n' + - server.problems.solutions_for_problems('prolog', solved_problems) + '\n' + - server.problems.load_facts('prolog', facts).facts) - +def test(code, aux_code): n_correct = 0 engine_id = None try: - engine_id, output = prolog.engine.create(code=code, timeout=1.0) + engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0) if engine_id is not None and 'error' not in map(itemgetter(0), output): # Engine successfully created, and no syntax error in program. for query, answers in test_cases: diff --git a/prolog/problems/family_relations/brother_2/common.py b/prolog/problems/family_relations/brother_2/common.py index 4d01c0b..556d0e9 100644 --- a/prolog/problems/family_relations/brother_2/common.py +++ b/prolog/problems/family_relations/brother_2/common.py @@ -38,15 +38,11 @@ test_cases = [ [{'X': 'jeffrey'}, {'X': 'william'}]), ] -def test(program, solved_problems): - code = (program + '\n' + - server.problems.solutions_for_problems('prolog', solved_problems) + '\n' + - server.problems.load_facts('prolog', facts).facts) - +def test(code, aux_code): n_correct = 0 engine_id = None try: - engine_id, output = prolog.engine.create(code=code, timeout=1.0) + engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0) if engine_id is not None and 'error' not in map(itemgetter(0), output): # Engine successfully created, and no syntax error in program. for query, answers in test_cases: diff --git a/prolog/problems/family_relations/connected_3/common.py b/prolog/problems/family_relations/connected_3/common.py index b6356a9..31d0d12 100644 --- a/prolog/problems/family_relations/connected_3/common.py +++ b/prolog/problems/family_relations/connected_3/common.py @@ -29,15 +29,11 @@ test_cases = [ # [{'X': 'vanessa'}, {'X': 'patricia'}, {'X': 'susan'}, {'X': 'john'}, {'X': 'michael'}, {'X': 'michelle'}]), ] -def test(program, solved_problems): - code = (program + '\n' + - server.problems.solutions_for_problems('prolog', solved_problems) + '\n' + - server.problems.load_facts('prolog', facts).facts) - +def test(code, aux_code): n_correct = 0 engine_id = None try: - engine_id, output = prolog.engine.create(code=code, timeout=1.0) + engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0) if engine_id is not None and 'error' not in map(itemgetter(0), output): # Engine successfully created, and no syntax error in program. for query, answers in test_cases: diff --git a/prolog/problems/family_relations/cousin_2/common.py b/prolog/problems/family_relations/cousin_2/common.py index 382c7a0..0f7a37d 100644 --- a/prolog/problems/family_relations/cousin_2/common.py +++ b/prolog/problems/family_relations/cousin_2/common.py @@ -51,15 +51,11 @@ test_cases = [ [{'X': 'andrew'}, {'X': 'melanie'}]), ] -def test(program, solved_problems): - code = (program + '\n' + - server.problems.solutions_for_problems('prolog', solved_problems) + '\n' + - server.problems.load_facts('prolog', facts).facts) - +def test(code, aux_code): n_correct = 0 engine_id = None try: - engine_id, output = prolog.engine.create(code=code, timeout=1.0) + engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0) if engine_id is not None and 'error' not in map(itemgetter(0), output): # Engine successfully created, and no syntax error in program. for query, answers in test_cases: diff --git a/prolog/problems/family_relations/descendant_2/common.py b/prolog/problems/family_relations/descendant_2/common.py index e979b0f..f419b1d 100644 --- a/prolog/problems/family_relations/descendant_2/common.py +++ b/prolog/problems/family_relations/descendant_2/common.py @@ -40,15 +40,11 @@ test_cases = [ [{'X': 'vanessa'}, {'X': 'patricia'}, {'X': 'susan'}, {'X': 'john'}, {'X': 'michael'}, {'X': 'michelle'}]), ] -def test(program, solved_problems): - code = (program + '\n' + - server.problems.solutions_for_problems('prolog', solved_problems) + '\n' + - server.problems.load_facts('prolog', facts).facts) - +def test(code, aux_code): n_correct = 0 engine_id = None try: - engine_id, output = prolog.engine.create(code=code, timeout=1.0) + engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0) if engine_id is not None and 'error' not in map(itemgetter(0), output): # Engine successfully created, and no syntax error in program. for query, answers in test_cases: diff --git a/prolog/problems/family_relations/father_2/common.py b/prolog/problems/family_relations/father_2/common.py index 45b9255..f5888de 100644 --- a/prolog/problems/family_relations/father_2/common.py +++ b/prolog/problems/family_relations/father_2/common.py @@ -41,15 +41,11 @@ test_cases = [ [{'X': 'aleksandr'}]), ] -def test(program, solved_problems): - code = (program + '\n' + - server.problems.solutions_for_problems('prolog', solved_problems) + '\n' + - server.problems.load_facts('prolog', facts).facts) - +def test(code, aux_code): n_correct = 0 engine_id = None try: - engine_id, output = prolog.engine.create(code=code, timeout=1.0) + engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0) if engine_id is not None and 'error' not in map(itemgetter(0), output): # Engine successfully created, and no syntax error in program. for query, answers in test_cases: diff --git a/prolog/problems/family_relations/grandparent_2/common.py b/prolog/problems/family_relations/grandparent_2/common.py index 0c902da..663c9e4 100644 --- a/prolog/problems/family_relations/grandparent_2/common.py +++ b/prolog/problems/family_relations/grandparent_2/common.py @@ -42,15 +42,11 @@ test_cases = [ [{'X': 'vanessa'}, {'X': 'patricia'}]), ] -def test(program, solved_problems): - code = (program + '\n' + - server.problems.solutions_for_problems('prolog', solved_problems) + '\n' + - server.problems.load_facts('prolog', facts).facts) - +def test(code, aux_code): n_correct = 0 engine_id = None try: - engine_id, output = prolog.engine.create(code=code, timeout=1.0) + engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0) if engine_id is not None and 'error' not in map(itemgetter(0), output): # Engine successfully created, and no syntax error in program. for query, answers in test_cases: diff --git a/prolog/problems/family_relations/mother_2/common.py b/prolog/problems/family_relations/mother_2/common.py index 535e7ed..0a4c7bf 100644 --- a/prolog/problems/family_relations/mother_2/common.py +++ b/prolog/problems/family_relations/mother_2/common.py @@ -42,15 +42,11 @@ test_cases = [ [{'X': 'steve'}]), ] -def test(program, solved_problems): - code = (program + '\n' + - server.problems.solutions_for_problems('prolog', solved_problems) + '\n' + - server.problems.load_facts('prolog', facts).facts) - +def test(code, aux_code): n_correct = 0 engine_id = None try: - engine_id, output = prolog.engine.create(code=code, timeout=1.0) + engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0) if engine_id is not None and 'error' not in map(itemgetter(0), output): # Engine successfully created, and no syntax error in program. for query, answers in test_cases: diff --git a/prolog/problems/family_relations/sister_2/common.py b/prolog/problems/family_relations/sister_2/common.py index 1eb4a6a..90039e3 100644 --- a/prolog/problems/family_relations/sister_2/common.py +++ b/prolog/problems/family_relations/sister_2/common.py @@ -39,15 +39,11 @@ test_cases = [ [{'X': 'melanie'}]), ] -def test(program, solved_problems): - code = (program + '\n' + - server.problems.solutions_for_problems('prolog', solved_problems) + '\n' + - server.problems.load_facts('prolog', facts).facts) - +def test(code, aux_code): n_correct = 0 engine_id = None try: - engine_id, output = prolog.engine.create(code=code, timeout=1.0) + engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0) if engine_id is not None and 'error' not in map(itemgetter(0), output): # Engine successfully created, and no syntax error in program. for query, answers in test_cases: diff --git a/prolog/problems/license_plates/checklicenseplate_3/common.py b/prolog/problems/license_plates/checklicenseplate_3/common.py index 0480258..6741e69 100644 --- a/prolog/problems/license_plates/checklicenseplate_3/common.py +++ b/prolog/problems/license_plates/checklicenseplate_3/common.py @@ -71,14 +71,11 @@ test_cases = [ {'E1': '-8/2', 'E2': '-1-3'}, {'E1': '8/2', 'E2': '1+3'}]), ] -def test(program, solved_problems): - code = (program + '\n' + - server.problems.solutions_for_problems('prolog', solved_problems)) - +def test(code, aux_code): n_correct = 0 engine_id = None try: - engine_id, output = prolog.engine.create(code=code, timeout=1.0) + engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0) if engine_id is not None and 'error' not in map(itemgetter(0), output): # Engine successfully created, and no syntax error in program. for query, answers in test_cases: diff --git a/prolog/problems/license_plates/firstminus_2/common.py b/prolog/problems/license_plates/firstminus_2/common.py index 89fe3b0..8831fe2 100644 --- a/prolog/problems/license_plates/firstminus_2/common.py +++ b/prolog/problems/license_plates/firstminus_2/common.py @@ -22,14 +22,11 @@ test_cases = [ [{'X': '[5, 2, 3, 4]'}, {'X': '[-5, 2, 3, 4]'}]), ] -def test(program, solved_problems): - code = (program + '\n' + - server.problems.solutions_for_problems('prolog', solved_problems)) - +def test(code, aux_code): n_correct = 0 engine_id = None try: - engine_id, output = prolog.engine.create(code=code, timeout=1.0) + engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0) if engine_id is not None and 'error' not in map(itemgetter(0), output): # Engine successfully created, and no syntax error in program. for query, answers in test_cases: diff --git a/prolog/problems/license_plates/genexp_2/common.py b/prolog/problems/license_plates/genexp_2/common.py index 4b097f2..6c3dd17 100644 --- a/prolog/problems/license_plates/genexp_2/common.py +++ b/prolog/problems/license_plates/genexp_2/common.py @@ -43,14 +43,11 @@ test_cases = [ {'X': '1+2/3'}, {'X': '1-2/3'}, {'X': '1*(2/3)'}, {'X': '1/(2/3)'}]), ] -def test(program, solved_problems): - code = (program + '\n' + - server.problems.solutions_for_problems('prolog', solved_problems)) - +def test(code, aux_code): n_correct = 0 engine_id = None try: - engine_id, output = prolog.engine.create(code=code, timeout=1.0) + engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0) if engine_id is not None and 'error' not in map(itemgetter(0), output): # Engine successfully created, and no syntax error in program. for query, answers in test_cases: diff --git a/prolog/problems/license_plates/getdigits_2/common.py b/prolog/problems/license_plates/getdigits_2/common.py index 4ae42ff..6650b5a 100644 --- a/prolog/problems/license_plates/getdigits_2/common.py +++ b/prolog/problems/license_plates/getdigits_2/common.py @@ -27,14 +27,11 @@ test_cases = [ [{'X': '[3, 2, 4, 2]'}]), ] -def test(program, solved_problems): - code = (program + '\n' + - server.problems.solutions_for_problems('prolog', solved_problems)) - +def test(code, aux_code): n_correct = 0 engine_id = None try: - engine_id, output = prolog.engine.create(code=code, timeout=1.0) + engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0) if engine_id is not None and 'error' not in map(itemgetter(0), output): # Engine successfully created, and no syntax error in program. for query, answers in test_cases: diff --git a/prolog/problems/license_plates/joindigits_2/common.py b/prolog/problems/license_plates/joindigits_2/common.py index 189f221..1c5dba8 100644 --- a/prolog/problems/license_plates/joindigits_2/common.py +++ b/prolog/problems/license_plates/joindigits_2/common.py @@ -26,14 +26,11 @@ test_cases = [ [{'X': '[2, 3, 1]'}, {'X': '[2, 31]'}, {'X': '[23, 1]'}, {'X': '[231]'}]), ] -def test(program, solved_problems): - code = (program + '\n' + - server.problems.solutions_for_problems('prolog', solved_problems)) - +def test(code, aux_code): n_correct = 0 engine_id = None try: - engine_id, output = prolog.engine.create(code=code, timeout=1.0) + engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0) if engine_id is not None and 'error' not in map(itemgetter(0), output): # Engine successfully created, and no syntax error in program. for query, answers in test_cases: diff --git a/prolog/problems/lists/conc_3/common.py b/prolog/problems/lists/conc_3/common.py index 6efac47..ffd8f0f 100644 --- a/prolog/problems/lists/conc_3/common.py +++ b/prolog/problems/lists/conc_3/common.py @@ -26,14 +26,11 @@ test_cases = [ [{}]), ] -def test(program, solved_problems): - code = (program + '\n' + - server.problems.solutions_for_problems('prolog', solved_problems)) - +def test(code, aux_code): n_correct = 0 engine_id = None try: - engine_id, output = prolog.engine.create(code=code, timeout=1.0) + engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0) if engine_id is not None and 'error' not in map(itemgetter(0), output): # Engine successfully created, and no syntax error in program. for query, answers in test_cases: diff --git a/prolog/problems/lists/count_3/common.py b/prolog/problems/lists/count_3/common.py index c257d66..7970240 100644 --- a/prolog/problems/lists/count_3/common.py +++ b/prolog/problems/lists/count_3/common.py @@ -30,14 +30,11 @@ test_cases = [ [{'X': '2'}]), ] -def test(program, solved_problems): - code = (program + '\n' + - server.problems.solutions_for_problems('prolog', solved_problems)) - +def test(code, aux_code): n_correct = 0 engine_id = None try: - engine_id, output = prolog.engine.create(code=code, timeout=1.0) + engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0) if engine_id is not None and 'error' not in map(itemgetter(0), output): # Engine successfully created, and no syntax error in program. for query, answers in test_cases: diff --git a/prolog/problems/lists/del_3/common.py b/prolog/problems/lists/del_3/common.py index 5e00f4d..d0e4a29 100644 --- a/prolog/problems/lists/del_3/common.py +++ b/prolog/problems/lists/del_3/common.py @@ -24,14 +24,11 @@ test_cases = [ [{'X': 'g', 'Y': 'u', 'Z': 'f'}]), ] -def test(program, solved_problems): - code = (program + '\n' + - server.problems.solutions_for_problems('prolog', solved_problems)) - +def test(code, aux_code): n_correct = 0 engine_id = None try: - engine_id, output = prolog.engine.create(code=code, timeout=1.0) + engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0) if engine_id is not None and 'error' not in map(itemgetter(0), output): # Engine successfully created, and no syntax error in program. for query, answers in test_cases: diff --git a/prolog/problems/lists/divide_3/common.py b/prolog/problems/lists/divide_3/common.py index 83a8a9e..1f14d2f 100644 --- a/prolog/problems/lists/divide_3/common.py +++ b/prolog/problems/lists/divide_3/common.py @@ -29,14 +29,11 @@ test_cases = [ [{'A': '[t, l, q, e, y, r]'}]), ] -def test(program, solved_problems): - code = (program + '\n' + - server.problems.solutions_for_problems('prolog', solved_problems)) - +def test(code, aux_code): n_correct = 0 engine_id = None try: - engine_id, output = prolog.engine.create(code=code, timeout=1.0) + engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0) if engine_id is not None and 'error' not in map(itemgetter(0), output): # Engine successfully created, and no syntax error in program. for query, answers in test_cases: diff --git a/prolog/problems/lists/dup_2/common.py b/prolog/problems/lists/dup_2/common.py index cce5aef..66b9c64 100644 --- a/prolog/problems/lists/dup_2/common.py +++ b/prolog/problems/lists/dup_2/common.py @@ -26,14 +26,11 @@ test_cases = [ [{'X': '[k, f, f, g, a]'}]), ] -def test(program, solved_problems): - code = (program + '\n' + - server.problems.solutions_for_problems('prolog', solved_problems)) - +def test(code, aux_code): n_correct = 0 engine_id = None try: - engine_id, output = prolog.engine.create(code=code, timeout=1.0) + engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0) if engine_id is not None and 'error' not in map(itemgetter(0), output): # Engine successfully created, and no syntax error in program. for query, answers in test_cases: diff --git a/prolog/problems/lists/evenlen_1_+_oddlen_1/common.py b/prolog/problems/lists/evenlen_1_+_oddlen_1/common.py index 13d9bca..b683cf7 100644 --- a/prolog/problems/lists/evenlen_1_+_oddlen_1/common.py +++ b/prolog/problems/lists/evenlen_1_+_oddlen_1/common.py @@ -32,14 +32,11 @@ test_cases = [ [{}]), ] -def test(program, solved_problems): - code = (program + '\n' + - server.problems.solutions_for_problems('prolog', solved_problems)) - +def test(code, aux_code): n_correct = 0 engine_id = None try: - engine_id, output = prolog.engine.create(code=code, timeout=1.0) + engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0) if engine_id is not None and 'error' not in map(itemgetter(0), output): # Engine successfully created, and no syntax error in program. for query, answers in test_cases: diff --git a/prolog/problems/lists/insert_3/common.py b/prolog/problems/lists/insert_3/common.py index fe1fbb6..7d92726 100644 --- a/prolog/problems/lists/insert_3/common.py +++ b/prolog/problems/lists/insert_3/common.py @@ -26,14 +26,11 @@ test_cases = [ [{'A': 'c', 'X': 'i'}]), ] -def test(program, solved_problems): - code = (program + '\n' + - server.problems.solutions_for_problems('prolog', solved_problems)) - +def test(code, aux_code): n_correct = 0 engine_id = None try: - engine_id, output = prolog.engine.create(code=code, timeout=1.0) + engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0) if engine_id is not None and 'error' not in map(itemgetter(0), output): # Engine successfully created, and no syntax error in program. for query, answers in test_cases: diff --git a/prolog/problems/lists/len_2/common.py b/prolog/problems/lists/len_2/common.py index 94a05c5..538db56 100644 --- a/prolog/problems/lists/len_2/common.py +++ b/prolog/problems/lists/len_2/common.py @@ -25,14 +25,11 @@ test_cases = [ [{'X': '0'}]), ] -def test(program, solved_problems): - code = (program + '\n' + - server.problems.solutions_for_problems('prolog', solved_problems)) - +def test(code, aux_code): n_correct = 0 engine_id = None try: - engine_id, output = prolog.engine.create(code=code, timeout=1.0) + engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0) if engine_id is not None and 'error' not in map(itemgetter(0), output): # Engine successfully created, and no syntax error in program. for query, answers in test_cases: diff --git a/prolog/problems/lists/max_2/common.py b/prolog/problems/lists/max_2/common.py index 1f8769a..6fd9a4d 100644 --- a/prolog/problems/lists/max_2/common.py +++ b/prolog/problems/lists/max_2/common.py @@ -29,14 +29,11 @@ test_cases = [ [{'X': '-22'}]), ] -def test(program, solved_problems): - code = (program + '\n' + - server.problems.solutions_for_problems('prolog', solved_problems)) - +def test(code, aux_code): n_correct = 0 engine_id = None try: - engine_id, output = prolog.engine.create(code=code, timeout=1.0) + engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0) if engine_id is not None and 'error' not in map(itemgetter(0), output): # Engine successfully created, and no syntax error in program. for query, answers in test_cases: diff --git a/prolog/problems/lists/memb_2/common.py b/prolog/problems/lists/memb_2/common.py index 30a6dfd..691471f 100644 --- a/prolog/problems/lists/memb_2/common.py +++ b/prolog/problems/lists/memb_2/common.py @@ -22,14 +22,11 @@ test_cases = [ [{'X': 'y'}, {'X': 'l'}, {'X': 'r'}, {'X': 'g'}, {'X': 'a'}]), ] -def test(program, solved_problems): - code = (program + '\n' + - server.problems.solutions_for_problems('prolog', solved_problems)) - +def test(code, aux_code): n_correct = 0 engine_id = None try: - engine_id, output = prolog.engine.create(code=code, timeout=1.0) + engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0) if engine_id is not None and 'error' not in map(itemgetter(0), output): # Engine successfully created, and no syntax error in program. for query, answers in test_cases: diff --git a/prolog/problems/lists/min_2/common.py b/prolog/problems/lists/min_2/common.py index fc505b7..65ce979 100644 --- a/prolog/problems/lists/min_2/common.py +++ b/prolog/problems/lists/min_2/common.py @@ -29,14 +29,11 @@ test_cases = [ [{'X': '-22'}]), ] -def test(program, solved_problems): - code = (program + '\n' + - server.problems.solutions_for_problems('prolog', solved_problems)) - +def test(code, aux_code): n_correct = 0 engine_id = None try: - engine_id, output = prolog.engine.create(code=code, timeout=1.0) + engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0) if engine_id is not None and 'error' not in map(itemgetter(0), output): # Engine successfully created, and no syntax error in program. for query, answers in test_cases: diff --git a/prolog/problems/lists/palindrome_1/common.py b/prolog/problems/lists/palindrome_1/common.py index 044f7be..7050c8c 100644 --- a/prolog/problems/lists/palindrome_1/common.py +++ b/prolog/problems/lists/palindrome_1/common.py @@ -30,14 +30,11 @@ test_cases = [ [{'X': 'b'}]), ] -def test(program, solved_problems): - code = (program + '\n' + - server.problems.solutions_for_problems('prolog', solved_problems)) - +def test(code, aux_code): n_correct = 0 engine_id = None try: - engine_id, output = prolog.engine.create(code=code, timeout=1.0) + engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0) if engine_id is not None and 'error' not in map(itemgetter(0), output): # Engine successfully created, and no syntax error in program. for query, answers in test_cases: diff --git a/prolog/problems/lists/permute_2/common.py b/prolog/problems/lists/permute_2/common.py index 5ade0b5..162b018 100644 --- a/prolog/problems/lists/permute_2/common.py +++ b/prolog/problems/lists/permute_2/common.py @@ -28,14 +28,11 @@ test_cases = [ [{'X': '[[b, e, l], [b, l, e], [e, b, l], [e, l, b], [l, b, e], [l, e, b]]'}]), ] -def test(program, solved_problems): - code = (program + '\n' + - server.problems.solutions_for_problems('prolog', solved_problems)) - +def test(code, aux_code): n_correct = 0 engine_id = None try: - engine_id, output = prolog.engine.create(code=code, timeout=1.0) + engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0) if engine_id is not None and 'error' not in map(itemgetter(0), output): # Engine successfully created, and no syntax error in program. for query, answers in test_cases: diff --git a/prolog/problems/lists/rev_2/common.py b/prolog/problems/lists/rev_2/common.py index 2a16e27..f5e4d9c 100644 --- a/prolog/problems/lists/rev_2/common.py +++ b/prolog/problems/lists/rev_2/common.py @@ -28,14 +28,11 @@ test_cases = [ [{'X': '[d, d, c, k, s]'}]), ] -def test(program, solved_problems): - code = (program + '\n' + - server.problems.solutions_for_problems('prolog', solved_problems)) - +def test(code, aux_code): n_correct = 0 engine_id = None try: - engine_id, output = prolog.engine.create(code=code, timeout=1.0) + engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0) if engine_id is not None and 'error' not in map(itemgetter(0), output): # Engine successfully created, and no syntax error in program. for query, answers in test_cases: diff --git a/prolog/problems/lists/shiftleft_2/common.py b/prolog/problems/lists/shiftleft_2/common.py index 8de545b..6f3576b 100644 --- a/prolog/problems/lists/shiftleft_2/common.py +++ b/prolog/problems/lists/shiftleft_2/common.py @@ -26,14 +26,11 @@ test_cases = [ [{'A': 'x', 'B': 'y', 'C': 'l', 'D': 'c', 'E': 'h'}]), ] -def test(program, solved_problems): - code = (program + '\n' + - server.problems.solutions_for_problems('prolog', solved_problems)) - +def test(code, aux_code): n_correct = 0 engine_id = None try: - engine_id, output = prolog.engine.create(code=code, timeout=1.0) + engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0) if engine_id is not None and 'error' not in map(itemgetter(0), output): # Engine successfully created, and no syntax error in program. for query, answers in test_cases: diff --git a/prolog/problems/lists/shiftright_2/common.py b/prolog/problems/lists/shiftright_2/common.py index 205daa9..3084f9f 100644 --- a/prolog/problems/lists/shiftright_2/common.py +++ b/prolog/problems/lists/shiftright_2/common.py @@ -26,14 +26,11 @@ test_cases = [ [{'A': 'x', 'B': 'y', 'C': 'c', 'D': 'h', 'E': 'l'}]), ] -def test(program, solved_problems): - code = (program + '\n' + - server.problems.solutions_for_problems('prolog', solved_problems)) - +def test(code, aux_code): n_correct = 0 engine_id = None try: - engine_id, output = prolog.engine.create(code=code, timeout=1.0) + engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0) if engine_id is not None and 'error' not in map(itemgetter(0), output): # Engine successfully created, and no syntax error in program. for query, answers in test_cases: diff --git a/prolog/problems/lists/sublist_2/common.py b/prolog/problems/lists/sublist_2/common.py index bcf3315..e2d8964 100644 --- a/prolog/problems/lists/sublist_2/common.py +++ b/prolog/problems/lists/sublist_2/common.py @@ -29,14 +29,11 @@ test_cases = [ [{'X': '[[], [a], [a, b], [a, b, c], [b], [b, c], [c]]'}]), ] -def test(program, solved_problems): - code = (program + '\n' + - server.problems.solutions_for_problems('prolog', solved_problems)) - +def test(code, aux_code): n_correct = 0 engine_id = None try: - engine_id, output = prolog.engine.create(code=code, timeout=1.0) + engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0) if engine_id is not None and 'error' not in map(itemgetter(0), output): # Engine successfully created, and no syntax error in program. for query, answers in test_cases: diff --git a/prolog/problems/lists/sum_2/common.py b/prolog/problems/lists/sum_2/common.py index a849601..568cfca 100644 --- a/prolog/problems/lists/sum_2/common.py +++ b/prolog/problems/lists/sum_2/common.py @@ -25,14 +25,11 @@ test_cases = [ [{'X': '4'}]), ] -def test(program, solved_problems): - code = (program + '\n' + - server.problems.solutions_for_problems('prolog', solved_problems)) - +def test(code, aux_code): n_correct = 0 engine_id = None try: - engine_id, output = prolog.engine.create(code=code, timeout=1.0) + engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0) if engine_id is not None and 'error' not in map(itemgetter(0), output): # Engine successfully created, and no syntax error in program. for query, answers in test_cases: diff --git a/prolog/problems/sets/diff_3/common.py b/prolog/problems/sets/diff_3/common.py index e2706cb..bfa3ce6 100644 --- a/prolog/problems/sets/diff_3/common.py +++ b/prolog/problems/sets/diff_3/common.py @@ -38,14 +38,11 @@ test_cases = [ [{'X': '[]'}]), ] -def test(program, solved_problems): - code = (program + '\n' + - server.problems.solutions_for_problems('prolog', solved_problems)) - +def test(code, aux_code): n_correct = 0 engine_id = None try: - engine_id, output = prolog.engine.create(code=code, timeout=1.0) + engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0) if engine_id is not None and 'error' not in map(itemgetter(0), output): # Engine successfully created, and no syntax error in program. for query, answers in test_cases: diff --git a/prolog/problems/sets/intersect_3/common.py b/prolog/problems/sets/intersect_3/common.py index ba90db7..55d2df5 100644 --- a/prolog/problems/sets/intersect_3/common.py +++ b/prolog/problems/sets/intersect_3/common.py @@ -37,14 +37,11 @@ test_cases = [ [{'X': '[1, 2, 4, 7, 9]'}]), ] -def test(program, solved_problems): - code = (program + '\n' + - server.problems.solutions_for_problems('prolog', solved_problems)) - +def test(code, aux_code): n_correct = 0 engine_id = None try: - engine_id, output = prolog.engine.create(code=code, timeout=1.0) + engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0) if engine_id is not None and 'error' not in map(itemgetter(0), output): # Engine successfully created, and no syntax error in program. for query, answers in test_cases: diff --git a/prolog/problems/sets/is_subset_2/common.py b/prolog/problems/sets/is_subset_2/common.py index a64d0f8..0d78cd6 100644 --- a/prolog/problems/sets/is_subset_2/common.py +++ b/prolog/problems/sets/is_subset_2/common.py @@ -31,14 +31,11 @@ test_cases = [ [{}]), ] -def test(program, solved_problems): - code = (program + '\n' + - server.problems.solutions_for_problems('prolog', solved_problems)) - +def test(code, aux_code): n_correct = 0 engine_id = None try: - engine_id, output = prolog.engine.create(code=code, timeout=1.0) + engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0) if engine_id is not None and 'error' not in map(itemgetter(0), output): # Engine successfully created, and no syntax error in program. for query, answers in test_cases: diff --git a/prolog/problems/sets/is_superset_2/common.py b/prolog/problems/sets/is_superset_2/common.py index abd3cfb..59f2fda 100644 --- a/prolog/problems/sets/is_superset_2/common.py +++ b/prolog/problems/sets/is_superset_2/common.py @@ -31,14 +31,11 @@ test_cases = [ [{}]), ] -def test(program, solved_problems): - code = (program + '\n' + - server.problems.solutions_for_problems('prolog', solved_problems)) - +def test(code, aux_code): n_correct = 0 engine_id = None try: - engine_id, output = prolog.engine.create(code=code, timeout=1.0) + engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0) if engine_id is not None and 'error' not in map(itemgetter(0), output): # Engine successfully created, and no syntax error in program. for query, answers in test_cases: diff --git a/prolog/problems/sets/powerset_2/common.py b/prolog/problems/sets/powerset_2/common.py index 77801d7..e97603c 100644 --- a/prolog/problems/sets/powerset_2/common.py +++ b/prolog/problems/sets/powerset_2/common.py @@ -29,14 +29,11 @@ test_cases = [ [{'X': '[1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3]'}]), ] -def test(program, solved_problems): - code = (program + '\n' + - server.problems.solutions_for_problems('prolog', solved_problems)) - +def test(code, aux_code): n_correct = 0 engine_id = None try: - engine_id, output = prolog.engine.create(code=code, timeout=1.0) + engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0) if engine_id is not None and 'error' not in map(itemgetter(0), output): # Engine successfully created, and no syntax error in program. for query, answers in test_cases: diff --git a/prolog/problems/sets/subset_2/common.py b/prolog/problems/sets/subset_2/common.py index 99d0799..f7d87d2 100644 --- a/prolog/problems/sets/subset_2/common.py +++ b/prolog/problems/sets/subset_2/common.py @@ -42,14 +42,11 @@ test_cases = [ {'X': '[2, 5, 6, 7]'}, {'X': '[0, 5, 6, 7]'}, {'X': '[0, 2, 5, 6, 7]'}]), ] -def test(program, solved_problems): - code = (program + '\n' + - server.problems.solutions_for_problems('prolog', solved_problems)) - +def test(code, aux_code): n_correct = 0 engine_id = None try: - engine_id, output = prolog.engine.create(code=code, timeout=1.0) + engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0) if engine_id is not None and 'error' not in map(itemgetter(0), output): # Engine successfully created, and no syntax error in program. for query, answers in test_cases: diff --git a/prolog/problems/sets/union_3/common.py b/prolog/problems/sets/union_3/common.py index 774c8cf..ae24943 100644 --- a/prolog/problems/sets/union_3/common.py +++ b/prolog/problems/sets/union_3/common.py @@ -34,14 +34,11 @@ test_cases = [ [{'X': '[0, 1, 2, 3, 5, 6, 9]'}]), ] -def test(program, solved_problems): - code = (program + '\n' + - server.problems.solutions_for_problems('prolog', solved_problems)) - +def test(code, aux_code): n_correct = 0 engine_id = None try: - engine_id, output = prolog.engine.create(code=code, timeout=1.0) + engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0) if engine_id is not None and 'error' not in map(itemgetter(0), output): # Engine successfully created, and no syntax error in program. for query, answers in test_cases: diff --git a/prolog/problems/sorting/is_sorted_1/common.py b/prolog/problems/sorting/is_sorted_1/common.py index 9213ddc..db5c3cc 100644 --- a/prolog/problems/sorting/is_sorted_1/common.py +++ b/prolog/problems/sorting/is_sorted_1/common.py @@ -34,14 +34,11 @@ test_cases = [ [{}]), ] -def test(program, solved_problems): - code = (program + '\n' + - server.problems.solutions_for_problems('prolog', solved_problems)) - +def test(code, aux_code): n_correct = 0 engine_id = None try: - engine_id, output = prolog.engine.create(code=code, timeout=1.0) + engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0) if engine_id is not None and 'error' not in map(itemgetter(0), output): # Engine successfully created, and no syntax error in program. for query, answers in test_cases: diff --git a/prolog/problems/sorting/isort_2/common.py b/prolog/problems/sorting/isort_2/common.py index 6041b35..1669a4a 100644 --- a/prolog/problems/sorting/isort_2/common.py +++ b/prolog/problems/sorting/isort_2/common.py @@ -33,14 +33,11 @@ test_cases = [ [{'X': '[1, 2, 3, 4, 5]'}]), ] -def test(program, solved_problems): - code = (program + '\n' + - server.problems.solutions_for_problems('prolog', solved_problems)) - +def test(code, aux_code): n_correct = 0 engine_id = None try: - engine_id, output = prolog.engine.create(code=code, timeout=1.0) + engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0) if engine_id is not None and 'error' not in map(itemgetter(0), output): # Engine successfully created, and no syntax error in program. for query, answers in test_cases: diff --git a/prolog/problems/sorting/pivoting_4/common.py b/prolog/problems/sorting/pivoting_4/common.py index 0e9afaa..3a3a906 100644 --- a/prolog/problems/sorting/pivoting_4/common.py +++ b/prolog/problems/sorting/pivoting_4/common.py @@ -30,14 +30,11 @@ test_cases = [ [{'A': '[1, 0, 3, -2]', 'B': '[22, 8, 5, 7]'}]), ] -def test(program, solved_problems): - code = (program + '\n' + - server.problems.solutions_for_problems('prolog', solved_problems)) - +def test(code, aux_code): n_correct = 0 engine_id = None try: - engine_id, output = prolog.engine.create(code=code, timeout=1.0) + engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0) if engine_id is not None and 'error' not in map(itemgetter(0), output): # Engine successfully created, and no syntax error in program. for query, answers in test_cases: diff --git a/prolog/problems/sorting/quick_sort_2/common.py b/prolog/problems/sorting/quick_sort_2/common.py index b1449f1..d46c185 100644 --- a/prolog/problems/sorting/quick_sort_2/common.py +++ b/prolog/problems/sorting/quick_sort_2/common.py @@ -39,14 +39,11 @@ test_cases = [ [{'X': '[1, 2, 3, 4, 5]'}]), ] -def test(program, solved_problems): - code = (program + '\n' + - server.problems.solutions_for_problems('prolog', solved_problems)) - +def test(code, aux_code): n_correct = 0 engine_id = None try: - engine_id, output = prolog.engine.create(code=code, timeout=1.0) + engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0) if engine_id is not None and 'error' not in map(itemgetter(0), output): # Engine successfully created, and no syntax error in program. for query, answers in test_cases: diff --git a/prolog/problems/sorting/sins_3/common.py b/prolog/problems/sorting/sins_3/common.py index 4c707ca..efc544e 100644 --- a/prolog/problems/sorting/sins_3/common.py +++ b/prolog/problems/sorting/sins_3/common.py @@ -31,14 +31,11 @@ test_cases = [ [{'X': '[2, 2, 3, 4, 5, 6, 7]'}]), ] -def test(program, solved_problems): - code = (program + '\n' + - server.problems.solutions_for_problems('prolog', solved_problems)) - +def test(code, aux_code): n_correct = 0 engine_id = None try: - engine_id, output = prolog.engine.create(code=code, timeout=1.0) + engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0) if engine_id is not None and 'error' not in map(itemgetter(0), output): # Engine successfully created, and no syntax error in program. for query, answers in test_cases: diff --git a/prolog/problems/sorting/slowest_sort_ever_2/common.py b/prolog/problems/sorting/slowest_sort_ever_2/common.py index 72e25e2..5d0f566 100644 --- a/prolog/problems/sorting/slowest_sort_ever_2/common.py +++ b/prolog/problems/sorting/slowest_sort_ever_2/common.py @@ -40,14 +40,11 @@ test_cases = [ [{'X': '[2, 3, 4, 5]'}]), ] -def test(program, solved_problems): - code = (program + '\n' + - server.problems.solutions_for_problems('prolog', solved_problems)) - +def test(code, aux_code): n_correct = 0 engine_id = None try: - engine_id, output = prolog.engine.create(code=code, timeout=1.0) + engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0) if engine_id is not None and 'error' not in map(itemgetter(0), output): # Engine successfully created, and no syntax error in program. for query, answers in test_cases: |