summaryrefslogtreecommitdiff
path: root/prolog/problems/lists
diff options
context:
space:
mode:
authorTimotej Lazar <timotej.lazar@fri.uni-lj.si>2016-02-12 14:47:33 +0100
committerTimotej Lazar <timotej.lazar@fri.uni-lj.si>2016-02-12 14:47:33 +0100
commit05e778a6d06f9d74ebc73fb5113643ffd80a6a8b (patch)
tree61865d508a5cb95e8a750057d11c61159451b861 /prolog/problems/lists
parent75a6d1e8b3f48cb6beb3a5b417d84c83615acd68 (diff)
Prolog: catch exceptions in test functions
Diffstat (limited to 'prolog/problems/lists')
-rw-r--r--prolog/problems/lists/conc_3/common.py2
-rw-r--r--prolog/problems/lists/count_3/common.py2
-rw-r--r--prolog/problems/lists/del_3/common.py2
-rw-r--r--prolog/problems/lists/divide_3/common.py2
-rw-r--r--prolog/problems/lists/dup_2/common.py2
-rw-r--r--prolog/problems/lists/evenlen_1_+_oddlen_1/common.py2
-rw-r--r--prolog/problems/lists/insert_3/common.py2
-rw-r--r--prolog/problems/lists/len_2/common.py2
-rw-r--r--prolog/problems/lists/max_2/common.py2
-rw-r--r--prolog/problems/lists/memb_2/common.py2
-rw-r--r--prolog/problems/lists/min_2/common.py2
-rw-r--r--prolog/problems/lists/palindrome_1/common.py2
-rw-r--r--prolog/problems/lists/permute_2/common.py2
-rw-r--r--prolog/problems/lists/rev_2/common.py2
-rw-r--r--prolog/problems/lists/shiftleft_2/common.py2
-rw-r--r--prolog/problems/lists/shiftright_2/common.py2
-rw-r--r--prolog/problems/lists/sublist_2/common.py2
-rw-r--r--prolog/problems/lists/sum_2/common.py2
18 files changed, 36 insertions, 0 deletions
diff --git a/prolog/problems/lists/conc_3/common.py b/prolog/problems/lists/conc_3/common.py
index 7ee44b5..e24ec18 100644
--- a/prolog/problems/lists/conc_3/common.py
+++ b/prolog/problems/lists/conc_3/common.py
@@ -36,6 +36,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/lists/count_3/common.py b/prolog/problems/lists/count_3/common.py
index d260b05..25474b6 100644
--- a/prolog/problems/lists/count_3/common.py
+++ b/prolog/problems/lists/count_3/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/lists/del_3/common.py b/prolog/problems/lists/del_3/common.py
index 5be6599..9a1554a 100644
--- a/prolog/problems/lists/del_3/common.py
+++ b/prolog/problems/lists/del_3/common.py
@@ -34,6 +34,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/lists/divide_3/common.py b/prolog/problems/lists/divide_3/common.py
index b522254..a600e02 100644
--- a/prolog/problems/lists/divide_3/common.py
+++ b/prolog/problems/lists/divide_3/common.py
@@ -39,6 +39,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/lists/dup_2/common.py b/prolog/problems/lists/dup_2/common.py
index 36e31f8..0593ae5 100644
--- a/prolog/problems/lists/dup_2/common.py
+++ b/prolog/problems/lists/dup_2/common.py
@@ -36,6 +36,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/lists/evenlen_1_+_oddlen_1/common.py b/prolog/problems/lists/evenlen_1_+_oddlen_1/common.py
index ea86b40..2adacaf 100644
--- a/prolog/problems/lists/evenlen_1_+_oddlen_1/common.py
+++ b/prolog/problems/lists/evenlen_1_+_oddlen_1/common.py
@@ -42,6 +42,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/lists/insert_3/common.py b/prolog/problems/lists/insert_3/common.py
index ac8437b..b3b5f1c 100644
--- a/prolog/problems/lists/insert_3/common.py
+++ b/prolog/problems/lists/insert_3/common.py
@@ -36,6 +36,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/lists/len_2/common.py b/prolog/problems/lists/len_2/common.py
index 2c4fea8..ca3d985 100644
--- a/prolog/problems/lists/len_2/common.py
+++ b/prolog/problems/lists/len_2/common.py
@@ -35,6 +35,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/lists/max_2/common.py b/prolog/problems/lists/max_2/common.py
index 1f6969b..b4a0311 100644
--- a/prolog/problems/lists/max_2/common.py
+++ b/prolog/problems/lists/max_2/common.py
@@ -39,6 +39,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/lists/memb_2/common.py b/prolog/problems/lists/memb_2/common.py
index fea670b..e0914fa 100644
--- a/prolog/problems/lists/memb_2/common.py
+++ b/prolog/problems/lists/memb_2/common.py
@@ -32,6 +32,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/lists/min_2/common.py b/prolog/problems/lists/min_2/common.py
index 4ab3e65..a26a14d 100644
--- a/prolog/problems/lists/min_2/common.py
+++ b/prolog/problems/lists/min_2/common.py
@@ -39,6 +39,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/lists/palindrome_1/common.py b/prolog/problems/lists/palindrome_1/common.py
index cf1a15b..251c0da 100644
--- a/prolog/problems/lists/palindrome_1/common.py
+++ b/prolog/problems/lists/palindrome_1/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/lists/permute_2/common.py b/prolog/problems/lists/permute_2/common.py
index 1c16bd9..2568bbb 100644
--- a/prolog/problems/lists/permute_2/common.py
+++ b/prolog/problems/lists/permute_2/common.py
@@ -38,6 +38,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/lists/rev_2/common.py b/prolog/problems/lists/rev_2/common.py
index b8dbbe3..0875273 100644
--- a/prolog/problems/lists/rev_2/common.py
+++ b/prolog/problems/lists/rev_2/common.py
@@ -38,6 +38,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/lists/shiftleft_2/common.py b/prolog/problems/lists/shiftleft_2/common.py
index 9973e52..be0013f 100644
--- a/prolog/problems/lists/shiftleft_2/common.py
+++ b/prolog/problems/lists/shiftleft_2/common.py
@@ -36,6 +36,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/lists/shiftright_2/common.py b/prolog/problems/lists/shiftright_2/common.py
index 09c4067..21ce708 100644
--- a/prolog/problems/lists/shiftright_2/common.py
+++ b/prolog/problems/lists/shiftright_2/common.py
@@ -36,6 +36,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/lists/sublist_2/common.py b/prolog/problems/lists/sublist_2/common.py
index b5f6b89..99e0cf3 100644
--- a/prolog/problems/lists/sublist_2/common.py
+++ b/prolog/problems/lists/sublist_2/common.py
@@ -39,6 +39,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/lists/sum_2/common.py b/prolog/problems/lists/sum_2/common.py
index 026533f..2b6808a 100644
--- a/prolog/problems/lists/sum_2/common.py
+++ b/prolog/problems/lists/sum_2/common.py
@@ -35,6 +35,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)