diff options
author | Prabhu Ramachandran | 2014-06-06 10:42:05 +0530 |
---|---|---|
committer | Prabhu Ramachandran | 2014-06-06 10:42:05 +0530 |
commit | 8b5d13df2a8f4ac3acc075c522128722b987e57b (patch) | |
tree | 5097f9bada96d00ad1c9b30b691723f1c2b07c18 /testapp/test_server.py | |
parent | dff8905769f900b17124a6cf2c79ec5678faed66 (diff) | |
parent | 83b3d80a2cdc2a342a521fe71cad72e081d6df5f (diff) | |
download | online_test-8b5d13df2a8f4ac3acc075c522128722b987e57b.tar.gz online_test-8b5d13df2a8f4ac3acc075c522128722b987e57b.tar.bz2 online_test-8b5d13df2a8f4ac3acc075c522128722b987e57b.zip |
Merge pull request #20 from prathamesh920/scilab_autocheck
Scilab autocheck
Diffstat (limited to 'testapp/test_server.py')
-rw-r--r-- | testapp/test_server.py | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/testapp/test_server.py b/testapp/test_server.py index 95f87ef..d22a022 100644 --- a/testapp/test_server.py +++ b/testapp/test_server.py @@ -16,7 +16,6 @@ def check_result(result, check='correct answer'): assert result[0], result[1] assert check in result[1].lower(), result[1] - def test_python(): """Test if server runs Python code as expected.""" src = 'while True: pass' @@ -207,6 +206,50 @@ def test_java(): '/tmp', language="java") check_result(result, 'error') +def test_scilab(): + """Test if server runs scilab code as expected.""" + src = """ + funcprot(0) +function[c]=add(a,b) + c=a+b; +endfunction + """ + result = code_server.run_code(src, 'scilab_files/test_add.sce', + '/tmp', language="scilab") + check_result(result, 'correct answer') + + src = """ + funcprot(0) +function[c]=add(a,b) + c=a-b; +endfunction + """ + result = code_server.run_code(src, 'scilab_files/test_add.sce', + '/tmp', language="scilab") + check_result(result, 'correct answer') + + src = """ + funcprot(0) +function[c]=add(a,b) + c=a+b; +dis( +endfunction + """ + result = code_server.run_code(src, 'scilab_files/test_add.sce', + '/tmp', language="scilab") + check_result(result, 'error') + + src = """ + funcprot(0) +function[c]=add(a,b) + c=a + while(1==1) + end +endfunction + """ + result = code_server.run_code(src, 'scilab_files/test_add.sce', + '/tmp', language="scilab") + check_result(result, 'error') def test_bash(): """Test if server runs Bash code as expected.""" @@ -256,3 +299,4 @@ if __name__ == '__main__': test_c() test_cpp() test_java() + test_scilab() |