summaryrefslogtreecommitdiff
path: root/yaksh/evaluator_tests
diff options
context:
space:
mode:
authoradityacp2018-05-29 12:48:24 +0530
committeradityacp2018-06-07 14:50:47 +0530
commit683cc77b3c5c8d7f63d8fd8384cc03d5ee089b43 (patch)
treec79ca4c3a1baeda38bfdf0cd4994a0ab1848b76b /yaksh/evaluator_tests
parent9006f08dd153530c334cf000b858fdc8d9943d7e (diff)
downloadonline_test-683cc77b3c5c8d7f63d8fd8384cc03d5ee089b43.tar.gz
online_test-683cc77b3c5c8d7f63d8fd8384cc03d5ee089b43.tar.bz2
online_test-683cc77b3c5c8d7f63d8fd8384cc03d5ee089b43.zip
Add tests for bash evaluator
Diffstat (limited to 'yaksh/evaluator_tests')
-rw-r--r--yaksh/evaluator_tests/test_bash_evaluation.py52
1 files changed, 52 insertions, 0 deletions
diff --git a/yaksh/evaluator_tests/test_bash_evaluation.py b/yaksh/evaluator_tests/test_bash_evaluation.py
index 19f9fb2..f86bf24 100644
--- a/yaksh/evaluator_tests/test_bash_evaluation.py
+++ b/yaksh/evaluator_tests/test_bash_evaluation.py
@@ -58,6 +58,58 @@ class BashAssertionEvaluationTestCases(EvaluatorBaseTest):
# Then
self.assertTrue(result.get('success'))
+ def test_correct_answer_without_test_case_args(self):
+ # Given
+ user_answer = "echo 'hello'"
+ tc_data = "echo 'hello'"
+ self.test_case_data = [
+ {"test_case": tc_data,
+ "test_case_args": "",
+ "test_case_type": "standardtestcase",
+ "weight": 0.0
+ }
+ ]
+ kwargs = {'metadata': {
+ 'user_answer': user_answer,
+ 'file_paths': self.file_paths,
+ 'partial_grading': False,
+ 'language': 'bash'
+ }, 'test_case_data': self.test_case_data,
+ }
+
+ # When
+ grader = Grader(self.in_dir)
+ result = grader.evaluate(kwargs)
+
+ # Then
+ self.assertTrue(result.get('success'))
+
+ def test_incorrect_answer_without_test_case_args(self):
+ # Given
+ user_answer = "echo 'hello'"
+ tc_data = "echo 'hello world'"
+ self.test_case_data = [
+ {"test_case": tc_data,
+ "test_case_args": "",
+ "test_case_type": "standardtestcase",
+ "weight": 0.0
+ }
+ ]
+ kwargs = {'metadata': {
+ 'user_answer': user_answer,
+ 'file_paths': self.file_paths,
+ 'partial_grading': False,
+ 'language': 'bash'
+ }, 'test_case_data': self.test_case_data,
+ }
+
+ # When
+ grader = Grader(self.in_dir)
+ result = grader.evaluate(kwargs)
+
+ # Then
+ self.assertFalse(result.get('success'))
+
def test_error(self):
# Given
user_answer = ("#!/bin/bash\n[[ $# -eq 2 ]] "