diff options
author | adityacp | 2016-07-27 22:49:05 +0530 |
---|---|---|
committer | adityacp | 2016-07-27 22:52:23 +0530 |
commit | bca8dd59b6d796af680cac3d7f65fc3ac6ed8420 (patch) | |
tree | a4ac9650f8424f46c9a421fb59aec54adf86b847 | |
parent | 379acc5439c3aaa7f659e6f718db8baf8cfc5fdc (diff) | |
download | online_test-bca8dd59b6d796af680cac3d7f65fc3ac6ed8420.tar.gz online_test-bca8dd59b6d796af680cac3d7f65fc3ac6ed8420.tar.bz2 online_test-bca8dd59b6d796af680cac3d7f65fc3ac6ed8420.zip |
added testcase for string input
-rw-r--r-- | yaksh/evaluator_tests/test_java_evaluation.py | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/yaksh/evaluator_tests/test_java_evaluation.py b/yaksh/evaluator_tests/test_java_evaluation.py index 211b324..c98a938 100644 --- a/yaksh/evaluator_tests/test_java_evaluation.py +++ b/yaksh/evaluator_tests/test_java_evaluation.py @@ -97,7 +97,7 @@ class JavaStdioEvaluationTestCases(unittest.TestCase): def test_array_input(self): self.test_case_data = [{'expected_output': '561', - 'expected_input': '5,6,1'}] + 'expected_input': '5\n6\n1'}] user_answer = dedent(""" import java.util.Scanner; class Test @@ -186,5 +186,25 @@ class JavaStdioEvaluationTestCases(unittest.TestCase): self.assertEquals(result.get('error'), "Correct Answer") self.assertTrue(result.get('success')) + def test_string_input(self): + self.test_case_data = [{'expected_output': 'HelloWorld', + 'expected_input': 'Hello\nWorld'}] + user_answer = dedent(""" + import java.util.Scanner; + class Test + {public static void main(String[] args){ + Scanner s = new Scanner(System.in); + String a = s.nextLine(); + String b = s.nextLine(); + System.out.print(a+b); + }}""") + get_class = JavaStdioEvaluator() + kwargs = {'user_answer': user_answer, + 'test_case_data': self.test_case_data + } + result = get_class.evaluate(**kwargs) + self.assertEquals(result.get('error'), "Correct Answer") + self.assertTrue(result.get('success')) + if __name__ == '__main__': unittest.main() |