summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorPrabhu Ramachandran2011-11-24 02:11:40 +0530
committerPrabhu Ramachandran2011-11-24 02:11:40 +0530
commit11a2eaefaba6d2b547d35afbee3e85b18520afd2 (patch)
treef05aef4423f613c4d38232569df77a88c66978e7 /docs
parent30f56443790841901f15b5ab435f97fba1c81d85 (diff)
downloadonline_test-11a2eaefaba6d2b547d35afbee3e85b18520afd2.tar.gz
online_test-11a2eaefaba6d2b547d35afbee3e85b18520afd2.tar.bz2
online_test-11a2eaefaba6d2b547d35afbee3e85b18520afd2.zip
ENH/TMP: Preliminary support for bash scripts.
- Changing the Question model to add a language attribute. - Moving python_server.py -> code_server.py. - Adding functionality to test for Shell scripts. This is still incomplete since the shell code checker seems to have some problems. - Modified the xmlrpc_clients to support multiple languages and right now two. - Using setgid/setuid instead of setegid/seteuid in the code_server.py.. - Adding a bash example to the sample_questions.py. The shell script support doesn't quite work yet but this is really a code_server/checking issue.
Diffstat (limited to 'docs')
-rw-r--r--docs/sample_questions.py15
-rw-r--r--docs/sample_questions.xml2
2 files changed, 17 insertions, 0 deletions
diff --git a/docs/sample_questions.py b/docs/sample_questions.py
index 2a9eaf8..eac9479 100644
--- a/docs/sample_questions.py
+++ b/docs/sample_questions.py
@@ -4,6 +4,7 @@ questions = [
Question(
summary='Factorial',
points=2,
+ language="python",
description='''
Write a function called <code>fact</code> which takes a single integer argument
(say <code>n</code>) and returns the factorial of the number.
@@ -18,6 +19,7 @@ assert fact(5) == 120
Question(
summary='Simple function',
points=1,
+ language="python",
description='''Create a simple function called <code>sqr</code> which takes a single
argument and returns the square of the argument. For example: <br/>
<code>sqr(3) -> 9</code>.''',
@@ -26,6 +28,19 @@ import math
assert sqr(3) == 9
assert abs(sqr(math.sqrt(2)) - 2.0) < 1e-14
'''),
+Question(
+ summary='Bash addition',
+ points=2,
+ language="bash",
+ description='''Write a shell script which takes two arguments on the
+ command line and prints the sum of the two on the output.''',
+ test='''\
+#!/bin/bash
+[[ $# -eq 2 ]] && echo $(( $1 + $2 )) && exit $(( $1 + $2 ))
+#++++++
+1 2
+2 1
+'''),
]
quiz = Quiz(start_date=date.today(),
diff --git a/docs/sample_questions.xml b/docs/sample_questions.xml
index 104ea32..cad205b 100644
--- a/docs/sample_questions.xml
+++ b/docs/sample_questions.xml
@@ -10,6 +10,7 @@ and returns the factorial of the number.
For example fact(3) -> 6
</description>
<points>2</points>
+<language>python</language>
<test>
assert fact(0) == 1
assert fact(5) == 120
@@ -26,6 +27,7 @@ returns the square of the argument
For example sqr(3) -> 9.
</description>
<points>1</points>
+<language>python</language>
<test>
import math
assert sqr(3) == 9