Score
0
Watch 1 Star 0 Fork 0

魔神翼 / UESTCJudgeCoreC++

Create your Gitee Account
Explore and code with more than 6 million developers,Free private repositories !:)
Sign up
This repository doesn't specify license. Without author's permission, this code is only for learning and cannot be used for other purposes.
Clone or download
unitTest.sh 5.18 KB
Copy Edit Web IDE Raw Blame History
power authored 2014-04-29 17:18 . fix CE and RE for python
#!/bin/bash
start=`date +%s`
cd bin/
function init()
{
passed=0
failed=0
mkdir -p temp/1000
cp ../java.policy temp/
cp ../testJudge/code/1000/1000*.cpp temp/1000/
cp ../testJudge/code/1000/1000.pas temp/1000/Main.pas
cp ../testJudge/code/1000/1000.java temp/1000/Main.java
cp ../testJudge/code/1000/1000.py temp/1000/Main.py
cp ../java.policy temp/
mkdir temp/1001
mkdir temp/1002
mkdir temp/64
mkdir temp/1405
} 2> error.log
resultStr=(
"WAIT" \
"AC" \
"PE" \
"TLE" \
"MLE" \
"WA" \
"OLE" \
"CE" \
"RE_SEGV" \
"RE_FPE" \
"RE_BUS" \
"RE_ABRT" \
"RE_UNKNOWN" \
"RF" \
"SE" \
"RE_JAVA" \
)
function runTest()
{
local result=`$3`
echo "Test $2:"
read -a array <<< "$result"
echo -e "Result: ${resultStr[$array]} Time: ${array[1]} MS Memory: ${array[2]} KB"
if [ "$array" = "$1" ]; then
echo -e "\x1b[32mPASS\x1b[0m"
((passed++))
else
echo -e "\x1b[31mFAIL\x1b[0m expect ${resultStr[$1]}"
((failed++))
fi
} 2>> error.log
init
# normal test
runTest 1 'AC' './pyloncore -u 1000 -s 1000_AC.cpp -C -n 1000 -D ../testJudge/data -d ./temp -t 1000 -m 65535 -l 1 -I 1000.in -O 1000.out'
runTest 2 'PE' './pyloncore -u 1000 -s 1000_PE.cpp -C -n 1000 -D ../testJudge/data -d ./temp -t 1000 -m 65535 -l 1 -I 1000.in -O 1000.out'
runTest 3 'TLE' './pyloncore -u 1000 -s 1000_TLE.cpp -C -n 1000 -D ../testJudge/data -d ./temp -t 1000 -m 65535 -l 1 -I 1000.in -O 1000.out'
runTest 4 'MLE' './pyloncore -u 1000 -s 1000_MLE.cpp -C -n 1000 -D ../testJudge/data -d ./temp -t 1000 -m 1024 -l 1 -I 1000.in -O 1000.out'
runTest 5 'WA' './pyloncore -u 1000 -s 1000_WA.cpp -C -n 1000 -D ../testJudge/data -d ./temp -t 1000 -m 65535 -l 1 -I 1000.in -O 1000.out'
runTest 6 'OLE' './pyloncore -u 1000 -s 1000_OLE.cpp -C -n 1000 -D ../testJudge/data -d ./temp -t 1000 -m 65535 -l 1 -I 1000.in -O 1000.out'
runTest 7 'CE' './pyloncore -u 1000 -s 1000_CE.cpp -C -n 1000 -D ../testJudge/data -d ./temp -t 1000 -m 65535 -l 1 -I 1000.in -O 1000.out'
runTest 8 'RE_SEGV' './pyloncore -u 1000 -s 1000_RE_SEGV.cpp -C -n 1000 -D ../testJudge/data -d ./temp -t 1000 -m 65535 -l 1 -I 1000.in -O 1000.out'
runTest 9 'RE_FPE' './pyloncore -u 1000 -s 1000_RE_FPE.cpp -C -n 1000 -D ../testJudge/data -d ./temp -t 1000 -m 65535 -l 1 -I 1000.in -O 1000.out'
runTest 13 'RF' './pyloncore -u 1000 -s 1000_RF.cpp -C -n 1000 -D ../testJudge/data -d ./temp -t 1000 -m 65535 -l 1 -I 1000.in -O 1000.out'
runTest 1 'Pascal AC' './pyloncore -u 1000 -s Main.pas -C -n 1000 -D ../testJudge/data -d ./temp -t 1000 -m 65535 -l 3 -I 1000.in -O 1000.out'
runTest 1 'Java AC' "./pyloncore -u 1000 -s Main.java -C -n 1000 -D ../testJudge/data -d ./temp -t 1000 -m 65535 -l 4 -I 1000.in -O 1000.out"
runTest 1 'Python AC' './pyloncore -u 1000 -s Main.py -C -n 1000 -D ../testJudge/data -d ./temp -t 1000 -m 65535 -l 5 -I 1000.in -O 1000.out'
cp ../testJudge/code/1000/1000_RE.py temp/1002/Main.py
runTest 12 'Python RE' './pyloncore -u 1002 -s Main.py -C -n 1000 -D ../testJudge/data -d ./temp -t 1000 -m 65535 -l 5 -I 1000.in -O 1000.out'
cp ../testJudge/code/1000/1000_CE.py temp/1002/Main.py
runTest 7 'Python CE' './pyloncore -u 1002 -s Main.py -C -n 1000 -D ../testJudge/data -d ./temp -t 1000 -m 65535 -l 5 -I 1000.in -O 1000.out'
# test Java
cp ../testJudge/code/1000/1000_AC.java temp/1001/Main.java
runTest 1 'Java AC' "./pyloncore -u 1001 -s Main.java -C -n 1000 -D ../testJudge/data -d ./temp -t 1000 -m 65535 -l 4 -I 1000.in -O 1000.out"
cp ../testJudge/code/1000/1000_PE.java temp/1001/Main.java
runTest 2 'Java PE' "./pyloncore -u 1001 -s Main.java -C -n 1000 -D ../testJudge/data -d ./temp -t 1000 -m 65535 -l 4 -I 1000.in -O 1000.out"
cp ../testJudge/code/1000/1000_TLE.java temp/1001/Main.java
runTest 3 'Java TLE' "./pyloncore -u 1001 -s Main.java -C -n 1000 -D ../testJudge/data -d ./temp -t 1000 -m 65535 -l 4 -I 1000.in -O 1000.out"
cp ../testJudge/code/1000/1000_MLE.java temp/1001/Main.java
runTest 4 'Java MLE' "./pyloncore -u 1001 -s Main.java -C -n 1000 -D ../testJudge/data -d ./temp -t 1000 -m 1024 -l 4 -I 1000.in -O 1000.out"
cp ../testJudge/code/1000/1000_CE.java temp/1001/Main.java
runTest 7 'Java CE' "./pyloncore -u 1001 -s Main.java -C -n 1000 -D ../testJudge/data -d ./temp -t 1000 -m 65535 -l 4 -I 1000.in -O 1000.out"
cp ../testJudge/code/1000/1000_RE.java temp/1001/Main.java
runTest 15 'Java RE' "./pyloncore -u 1001 -s Main.java -C -n 1000 -D ../testJudge/data -d ./temp -t 1000 -m 65535 -l 4 -I 1000.in -O 1000.out"
# test int64
cp ../testJudge/code/1000/1000_lld.cpp temp/64
runTest 1 'long long' "./pyloncore -u 64 -s 1000_lld.cpp -C -n 1000 -D ../testJudge/data -d ./temp -t 1000 -m 65535 -l 2 -I 1000.in -O 1000.out"
cp ../testJudge/code/1000/1000_I64d.cpp temp/64
runTest 1 '__int64' "./pyloncore -u 64 -s 1000_I64.cpp -C -n 1000 -D ../testJudge/data -d ./temp -t 1000 -m 65535 -l 2 -I 1000.in -O 1000.out"
# test spj
cp ../testJudge/code/1405/1405.cc temp/1405/1405.cc
runTest 1 'SPJ AC' "./pyloncore -u 1405 -s 1405.cc -C -S -n 1405 -D ../testJudge/data -d ./temp -t 1000 -m 65535 -l 2 -I 1405.in -O 1405.out"
echo -e "\nTotal Cases:" $((failed+passed))
echo -e "\x1b[31mFAILED\x1b[0m: $failed"
echo -e "\x1b[32mPASSED\x1b[0m: $passed"
end=`date +%s`
(( time=end-start ))
echo "Time: ${time}s"

Comment ( 0 )

Sign in for post a comment