blob: 26587156f9a6f0842629745669530445aa6eeafd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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
|