aboutsummaryrefslogtreecommitdiff
path: root/doc/problemexamples/problemtemplate/tests
diff options
context:
space:
mode:
authorBruno Cesar Ribas <brunoribas@gmail.com>2018-10-23 11:56:39 +0000
committerBruno Cesar Ribas <brunoribas@gmail.com>2018-10-23 11:56:39 +0000
commit8fa580d8a0ef5a9e2455c477a296cb0a537e0ba3 (patch)
tree40a65d86745d1af677015c9dada3b67d6dfd23ae /doc/problemexamples/problemtemplate/tests
parent8fddbaf054150fdf2644b27fda43d2d370c564d4 (diff)
downloadboca-8fa580d8a0ef5a9e2455c477a296cb0a537e0ba3.tar.gz
boca-8fa580d8a0ef5a9e2455c477a296cb0a537e0ba3.zip
Adding kotlin files with problemtemplate
Signed-off-by: Bruno Cesar Ribas <brunoribas@gmail.com>
Diffstat (limited to 'doc/problemexamples/problemtemplate/tests')
-rwxr-xr-xdoc/problemexamples/problemtemplate/tests/kt41
1 files changed, 41 insertions, 0 deletions
diff --git a/doc/problemexamples/problemtemplate/tests/kt b/doc/problemexamples/problemtemplate/tests/kt
new file mode 100755
index 0000000..2658715
--- /dev/null
+++ b/doc/problemexamples/problemtemplate/tests/kt
@@ -0,0 +1,41 @@
+#!/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.kt <<'EOF'
+import java.util.*
+fun main(args: Array<String>) {
+ var scanner = Scanner(System.`in`)
+ val nTests = scanner.nextInt()
+ for (i in 1..nTests) {
+ System.`out`.format("%s%n", scanner.next())
+ }
+}
+EOF
+cat > test.in <<EOF
+inputdata
+EOF
+
+TL=2
+REP=10
+chmod 755 ../../compile/kt
+../../compile/kt test.kt test.exe $TL
+chmod 755 ../../run/kt
+../../run/kt test.kt 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