summaryrefslogtreecommitdiff
path: root/yaksh/evaluator_tests/test_scilab_evaluation.py
diff options
context:
space:
mode:
authoradityacp2016-06-20 14:57:21 +0530
committeradityacp2016-07-28 15:56:06 +0530
commitd8876ae789197de4d977d28f0c0ff04cf39c2c35 (patch)
treea4dcaa8b0452fa41e73bd7593d77d1b2818ca3ab /yaksh/evaluator_tests/test_scilab_evaluation.py
parent98cda0357f238cd230c26eebbf75e1d90bc3588e (diff)
downloadonline_test-d8876ae789197de4d977d28f0c0ff04cf39c2c35.tar.gz
online_test-d8876ae789197de4d977d28f0c0ff04cf39c2c35.tar.bz2
online_test-d8876ae789197de4d977d28f0c0ff04cf39c2c35.zip
added test cases for file based questions
Diffstat (limited to 'yaksh/evaluator_tests/test_scilab_evaluation.py')
-rw-r--r--yaksh/evaluator_tests/test_scilab_evaluation.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/yaksh/evaluator_tests/test_scilab_evaluation.py b/yaksh/evaluator_tests/test_scilab_evaluation.py
index 242f260..f5e3767 100644
--- a/yaksh/evaluator_tests/test_scilab_evaluation.py
+++ b/yaksh/evaluator_tests/test_scilab_evaluation.py
@@ -7,17 +7,19 @@ from yaksh.settings import SERVER_TIMEOUT
class ScilabEvaluationTestCases(unittest.TestCase):
def setUp(self):
self.test_case_data = [{"test_case": "scilab_files/test_add.sce"}]
- self.in_dir = "/tmp"
+ self.in_dir = os.getcwd()
self.timeout_msg = ("Code took more than {0} seconds to run. "
"You probably have an infinite loop"
" in your code.").format(SERVER_TIMEOUT)
+ self.file_paths = None
def test_correct_answer(self):
user_answer = ("funcprot(0)\nfunction[c]=add(a,b)"
"\n\tc=a+b;\nendfunction")
get_class = ScilabCodeEvaluator(self.in_dir)
kwargs = {'user_answer': user_answer,
- 'test_case_data': self.test_case_data
+ 'test_case_data': self.test_case_data,
+ 'file_paths': self.file_paths
}
result = get_class.evaluate(**kwargs)
self.assertEquals(result.get('error'), "Correct answer")
@@ -28,7 +30,8 @@ class ScilabEvaluationTestCases(unittest.TestCase):
"\n\tc=a+b;\ndis(\tendfunction")
get_class = ScilabCodeEvaluator(self.in_dir)
kwargs = {'user_answer': user_answer,
- 'test_case_data': self.test_case_data
+ 'test_case_data': self.test_case_data,
+ 'file_paths': self.file_paths
}
result = get_class.evaluate(**kwargs)
self.assertFalse(result.get("success"))
@@ -40,7 +43,8 @@ class ScilabEvaluationTestCases(unittest.TestCase):
"\n\tc=a-b;\nendfunction")
get_class = ScilabCodeEvaluator(self.in_dir)
kwargs = {'user_answer': user_answer,
- 'test_case_data': self.test_case_data
+ 'test_case_data': self.test_case_data,
+ 'file_paths': self.file_paths
}
result = get_class.evaluate(**kwargs)
self.assertFalse(result.get('success'))
@@ -52,7 +56,8 @@ class ScilabEvaluationTestCases(unittest.TestCase):
"\n\tc=a;\nwhile(1==1)\nend\nendfunction")
get_class = ScilabCodeEvaluator(self.in_dir)
kwargs = {'user_answer': user_answer,
- 'test_case_data': self.test_case_data
+ 'test_case_data': self.test_case_data,
+ 'file_paths': self.file_paths
}
result = get_class.evaluate(**kwargs)
self.assertFalse(result.get("success"))