summaryrefslogtreecommitdiff
path: root/yaksh/evaluator_tests/test_c_cpp_evaluation.py
diff options
context:
space:
mode:
authorankitjavalkar2016-03-29 19:00:12 +0530
committerankitjavalkar2016-05-05 19:00:33 +0530
commite8e6b4bc35c7d012d9c41fb37d91687eb605b56c (patch)
tree2f0488eaed410e23a5d0e0a18b9bdae1e2b2f2d1 /yaksh/evaluator_tests/test_c_cpp_evaluation.py
parent1f4542cdbea66899899b9c7de3ea38e39d794112 (diff)
downloadonline_test-e8e6b4bc35c7d012d9c41fb37d91687eb605b56c.tar.gz
online_test-e8e6b4bc35c7d012d9c41fb37d91687eb605b56c.tar.bz2
online_test-e8e6b4bc35c7d012d9c41fb37d91687eb605b56c.zip
- Refactor Scilab, Bash, Java and C
- Add Test Cases to reflect refactoring changes - Fix language registry - Add test case for language registry - Fix register in settings - Keep snippet field for now
Diffstat (limited to 'yaksh/evaluator_tests/test_c_cpp_evaluation.py')
-rw-r--r--yaksh/evaluator_tests/test_c_cpp_evaluation.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/yaksh/evaluator_tests/test_c_cpp_evaluation.py b/yaksh/evaluator_tests/test_c_cpp_evaluation.py
index c5f8775..9d37fb4 100644
--- a/yaksh/evaluator_tests/test_c_cpp_evaluation.py
+++ b/yaksh/evaluator_tests/test_c_cpp_evaluation.py
@@ -18,7 +18,18 @@ class CEvaluationTestCases(unittest.TestCase):
}
result = get_class.evaluate(**kwargs)
self.assertTrue(result.get('success'))
- self.assertEqual(result.get('error'), "Correct answer")
+ self.assertEquals(result.get('error'), "Correct answer")
+
+ def test_incorrect_answer(self):
+ user_answer = "int add(int a, int b)\n{return a-b;}"
+ get_class = CppCodeEvaluator(self.in_dir)
+ kwargs = {'user_answer': user_answer,
+ 'test_case_data': self.test_case_data
+ }
+ result = get_class.evaluate(**kwargs)
+ self.assertFalse(result.get('success'))
+ self.assertIn("Incorrect:", result.get('error'))
+ self.assertTrue(result.get('error').splitlines > 1)
def test_compilation_error(self):
user_answer = "int add(int a, int b)\n{return a+b}"