From 05e778a6d06f9d74ebc73fb5113643ffd80a6a8b Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Fri, 12 Feb 2016 14:47:33 +0100 Subject: Prolog: catch exceptions in test functions --- prolog/problems/sorting/is_sorted_1/common.py | 2 ++ prolog/problems/sorting/isort_2/common.py | 2 ++ prolog/problems/sorting/pivoting_4/common.py | 2 ++ prolog/problems/sorting/quick_sort_2/common.py | 2 ++ prolog/problems/sorting/sins_3/common.py | 2 ++ prolog/problems/sorting/slowest_sort_ever_2/common.py | 2 ++ 6 files changed, 12 insertions(+) (limited to 'prolog/problems/sorting') diff --git a/prolog/problems/sorting/is_sorted_1/common.py b/prolog/problems/sorting/is_sorted_1/common.py index b4ae92d..8921b54 100644 --- a/prolog/problems/sorting/is_sorted_1/common.py +++ b/prolog/problems/sorting/is_sorted_1/common.py @@ -44,6 +44,8 @@ def test(code, aux_code): for query, answers in test_cases: if prolog.engine.check_answers(engine_id, query=query, answers=answers, timeout=1.0): n_correct += 1 + except: + pass finally: if engine_id: prolog.engine.destroy(engine_id) diff --git a/prolog/problems/sorting/isort_2/common.py b/prolog/problems/sorting/isort_2/common.py index 5acd971..e929eb1 100644 --- a/prolog/problems/sorting/isort_2/common.py +++ b/prolog/problems/sorting/isort_2/common.py @@ -43,6 +43,8 @@ def test(code, aux_code): for query, answers in test_cases: if prolog.engine.check_answers(engine_id, query=query, answers=answers, timeout=1.0): n_correct += 1 + except: + pass finally: if engine_id: prolog.engine.destroy(engine_id) diff --git a/prolog/problems/sorting/pivoting_4/common.py b/prolog/problems/sorting/pivoting_4/common.py index 92403c3..e558a8a 100644 --- a/prolog/problems/sorting/pivoting_4/common.py +++ b/prolog/problems/sorting/pivoting_4/common.py @@ -40,6 +40,8 @@ def test(code, aux_code): for query, answers in test_cases: if prolog.engine.check_answers(engine_id, query=query, answers=answers, timeout=1.0): n_correct += 1 + except: + pass finally: if engine_id: prolog.engine.destroy(engine_id) diff --git a/prolog/problems/sorting/quick_sort_2/common.py b/prolog/problems/sorting/quick_sort_2/common.py index 94677de..c287f38 100644 --- a/prolog/problems/sorting/quick_sort_2/common.py +++ b/prolog/problems/sorting/quick_sort_2/common.py @@ -49,6 +49,8 @@ def test(code, aux_code): for query, answers in test_cases: if prolog.engine.check_answers(engine_id, query=query, answers=answers, timeout=1.0): n_correct += 1 + except: + pass finally: if engine_id: prolog.engine.destroy(engine_id) diff --git a/prolog/problems/sorting/sins_3/common.py b/prolog/problems/sorting/sins_3/common.py index b466743..0650eb6 100644 --- a/prolog/problems/sorting/sins_3/common.py +++ b/prolog/problems/sorting/sins_3/common.py @@ -41,6 +41,8 @@ def test(code, aux_code): for query, answers in test_cases: if prolog.engine.check_answers(engine_id, query=query, answers=answers, timeout=1.0): n_correct += 1 + except: + pass finally: if engine_id: prolog.engine.destroy(engine_id) diff --git a/prolog/problems/sorting/slowest_sort_ever_2/common.py b/prolog/problems/sorting/slowest_sort_ever_2/common.py index 93367bb..06df01b 100644 --- a/prolog/problems/sorting/slowest_sort_ever_2/common.py +++ b/prolog/problems/sorting/slowest_sort_ever_2/common.py @@ -50,6 +50,8 @@ def test(code, aux_code): for query, answers in test_cases: if prolog.engine.check_answers(engine_id, query=query, answers=answers, timeout=1.0): n_correct += 1 + except: + pass finally: if engine_id: prolog.engine.destroy(engine_id) -- cgit v1.2.1