summaryrefslogtreecommitdiff
path: root/yaksh/evaluator_tests/test_scilab_evaluation.py
diff options
context:
space:
mode:
authoradityacp2017-01-04 11:42:32 +0530
committeradityacp2017-01-04 11:42:32 +0530
commit58481cdcba38e8e602b8e2d3e5172f9e653f93a9 (patch)
tree21312113c078b6b22f24d5bab052a52bd185a3c9 /yaksh/evaluator_tests/test_scilab_evaluation.py
parentb271e3b33f673c70114893bf461d2a6116dd7cf7 (diff)
parentef6a61b1938ec399efb6d66b914f245afa3ed5ff (diff)
downloadonline_test-58481cdcba38e8e602b8e2d3e5172f9e653f93a9.tar.gz
online_test-58481cdcba38e8e602b8e2d3e5172f9e653f93a9.tar.bz2
online_test-58481cdcba38e8e602b8e2d3e5172f9e653f93a9.zip
Merge https://github.com/fossee/online_test into fix_management_commands
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 938d0e5..5a452a3 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
@@ -13,7 +13,38 @@ from yaksh.evaluator_tests.test_python_evaluation import EvaluatorBaseTest
class ScilabEvaluationTestCases(EvaluatorBaseTest):
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
}]