summaryrefslogtreecommitdiff
path: root/yaksh/evaluator_tests/test_scilab_evaluation.py
diff options
context:
space:
mode:
authoradityacp2016-12-23 11:41:31 +0530
committeradityacp2016-12-23 11:41:31 +0530
commit30f35a22e14e6e372a760676fddceb0807d22141 (patch)
tree5d06521225f7d4a1288fd88ac8e2498200d83435 /yaksh/evaluator_tests/test_scilab_evaluation.py
parent9d4e16cc5024b756d811e353714074d7d6066c2f (diff)
downloadonline_test-30f35a22e14e6e372a760676fddceb0807d22141.tar.gz
online_test-30f35a22e14e6e372a760676fddceb0807d22141.tar.bz2
online_test-30f35a22e14e6e372a760676fddceb0807d22141.zip
Add test cases based on moderator input code
Diffstat (limited to 'yaksh/evaluator_tests/test_scilab_evaluation.py')
-rw-r--r--yaksh/evaluator_tests/test_scilab_evaluation.py35
1 files changed, 33 insertions, 2 deletions
diff --git a/yaksh/evaluator_tests/test_scilab_evaluation.py b/yaksh/evaluator_tests/test_scilab_evaluation.py
index 0275ee8..c6b3b54 100644
--- a/yaksh/evaluator_tests/test_scilab_evaluation.py
+++ b/yaksh/evaluator_tests/test_scilab_evaluation.py
@@ -3,7 +3,7 @@ import unittest
import os
import shutil
import tempfile
-
+from textwrap import dedent
from yaksh import grader as gd
from yaksh.grader import Grader
from yaksh.scilab_code_evaluator import ScilabCodeEvaluator
@@ -11,7 +11,38 @@ from yaksh.scilab_code_evaluator import ScilabCodeEvaluator
class ScilabEvaluationTestCases(unittest.TestCase):
def setUp(self):
tmp_in_dir_path = tempfile.mkdtemp()
- self.test_case_data = [{"test_case": "scilab_files/test_add.sce",
+ self.tc_data = dedent("""
+ mode(-1)
+ exec("function.sci",-1);
+ i = 0
+ p = add(3,5);
+ correct = (p == 8);
+ if correct then
+ i=i+1
+ end
+ disp("Input submitted 3 and 5")
+ disp("Expected output 8 got " + string(p))
+ p = add(22,-20);
+ correct = (p==2);
+ if correct then
+ i=i+1
+ end
+ disp("Input submitted 22 and -20")
+ disp("Expected output 2 got " + string(p))
+ p =add(91,0);
+ correct = (p==91);
+ if correct then
+ i=i+1
+ end
+ disp("Input submitted 91 and 0")
+ disp("Expected output 91 got " + string(p))
+ if i==3 then
+ exit(5);
+ else
+ exit(3);
+ end
+ """)
+ self.test_case_data = [{"test_case": self.tc_data,
"test_case_type": "standardtestcase",
"weight": 0.0
}]