aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Ribas <brunoribas@gmail.com>2016-11-04 17:14:35 +0000
committerBruno Ribas <brunoribas@gmail.com>2016-11-04 17:14:35 +0000
commitc45196dfe0007882404246665137e3f96b64d445 (patch)
tree4b6947449c0dbdb7d90dbf987a12453891e4082f
parentda1ef60ac7e8ebe530b0502473c1d59c06970f15 (diff)
downloadboca-c45196dfe0007882404246665137e3f96b64d445.tar.gz
boca-c45196dfe0007882404246665137e3f96b64d445.zip
problemtemplate: Added tests/cpp
Signed-off-by: Bruno Ribas <brunoribas@gmail.com>
-rwxr-xr-xdoc/problemexamples/problemtemplate/tests/cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/doc/problemexamples/problemtemplate/tests/cpp b/doc/problemexamples/problemtemplate/tests/cpp
new file mode 100755
index 0000000..d3f7273
--- /dev/null
+++ b/doc/problemexamples/problemtemplate/tests/cpp
@@ -0,0 +1,42 @@
+#!/bin/bash
+#
+# This file performs a test of the autojudge system. It can run whatever you feel important to test the autojudge
+# and the script files that are included in the problem package
+
+mkdir -p testdir
+cd testdir
+
+cat > test.cpp <<EOF
+#include<stdio.h>
+
+using namespace std;
+int main() {
+ char s[100];
+ scanf("%s", s);
+ printf("%s\n",s);
+ return 0;
+}
+EOF
+cat > test.in <<EOF
+inputdata
+EOF
+
+TL=2
+REP=10
+chmod 755 ../../compile/cpp
+../../compile/cpp test.cpp test.exe $TL
+chmod 755 ../../run/cpp
+../../run/cpp test.exe test.in $TL $REP
+if [ -r stdout0 ]; then
+ output=`cat stdout0`
+ if [ "$output" != "inputdata" ]; then
+ echo "ERROR"
+ exit 1
+ fi
+else
+ echo "ERROR"
+ exit 1
+fi
+echo "TEST PASSED"
+cd ..
+exit 0