Revised testing - unhardcoded answers and excluded maps
This commit is contained in:
parent
d5bb76c53f
commit
df350ac0d0
@ -1,52 +0,0 @@
|
||||
|
||||
# Test if the parser is correctly reading in faces with 3 indices.
|
||||
|
||||
# Map Versions as of : 4:26 PM 4/8/2017
|
||||
# Answers are copied from the map file.
|
||||
# The program is expected to output the same string as the answer.
|
||||
|
||||
# test-parser parameters
|
||||
# 1. which parser to test
|
||||
# 2. map file to use
|
||||
# 3. line number to begin from
|
||||
|
||||
function test () {
|
||||
if [ "$1" == "$2" ]; then
|
||||
echo "test passed"
|
||||
else
|
||||
echo "test failed"
|
||||
echo $2
|
||||
fi
|
||||
}
|
||||
|
||||
ansr1=" 0.000000 0.000000 1.000000 1.000000 0.000000 5 2 7 0xffffffff common/materials/metal/aluminum
|
||||
0.000000 0.000000 1.000000 1.000000 0.000000 6 5 7 0xffffffff common/materials/metal/aluminum
|
||||
0.000000 0.000000 1.000000 1.000000 0.000000 3 1 0 4 0xffffffff common/materials/metal/aluminum
|
||||
0.000000 0.000000 1.000000 1.000000 0.000000 0 1 2 5 0xffffffff common/materials/metal/aluminum
|
||||
0.000000 0.000000 1.000000 1.000000 0.000000 4 0 5 6 0xffffffff common/materials/metal/aluminum
|
||||
0.000000 0.000000 1.000000 1.000000 0.000000 2 1 3 7 0xffffffff common/materials/metal/aluminum
|
||||
0.000000 0.000000 1.000000 1.000000 0.000000 3 4 6 7 0xffffffff common/materials/metal/aluminum"
|
||||
test1=$(./test-parser --face "maps/pocket-infinity.map" 142)
|
||||
test $ansr1 $test1
|
||||
|
||||
ansr2=" 0.000000 0.000000 1.000000 1.000000 0.000000 2 0 4 0xffa5a5a5 common/materials/metal/p_metal3
|
||||
0.000000 0.000000 1.000000 1.000000 0.000000 1 3 5 0xffa5a5a5 common/materials/metal/p_metal3
|
||||
0.000000 0.000000 1.000000 1.000000 0.000000 0 3 1 4 0xffa5a5a5 common/materials/metal/p_metal3
|
||||
0.000000 0.000000 1.000000 1.000000 0.000000 3 0 2 5 0xffa5a5a5 common/materials/metal/p_metal3
|
||||
0.000000 0.000000 1.000000 1.000000 0.000000 2 4 1 5 0xffa5a5a5 common/materials/metal/p_metal3"
|
||||
test2=$(./test-parser --face "maps/static-discharge.map" 1739)
|
||||
test $ansr2 $test2
|
||||
|
||||
ansr3=" 0.000000 0.000000 1.000000 1.000000 0.000000 1 0 4 0xff727278 common/materials/stone/stone
|
||||
0.000000 0.000000 1.000000 1.000000 0.000000 3 1 4 0xff727278 common/materials/stone/stone
|
||||
0.000000 0.000000 1.000000 1.000000 0.000000 1 2 5 0xff727278 common/materials/stone/stone
|
||||
0.000000 0.000000 1.000000 1.000000 0.000000 0 1 5 0xff727278 common/materials/stone/stone
|
||||
0.000000 0.000000 1.000000 1.000000 0.000000 4 0 6 0xff727278 common/materials/stone/stone
|
||||
0.000000 0.000000 1.000000 1.000000 0.000000 5 2 6 0xff727278 common/materials/stone/stone
|
||||
0.000000 0.000000 1.000000 1.000000 0.000000 0 5 6 0xff727278 common/materials/stone/stone
|
||||
0.000000 0.000000 1.000000 1.000000 0.000000 1 3 7 0xff727278 common/materials/stone/stone
|
||||
0.000000 0.000000 1.000000 1.000000 0.000000 2 1 7 0xff727278 common/materials/stone/stone
|
||||
0.000000 0.000000 1.000000 1.000000 0.000000 6 2 7 0xff727278 common/materials/stone/stone
|
||||
0.000000 0.000000 1.000000 1.000000 0.000000 3 4 6 7 0xff727278 common/materials/stone/stone"
|
||||
test3=$(./test-parser --face "maps/SkyTemples.map" 19354)
|
||||
test $ansr3 $test3
|
22
ReflexToQ3/test/cases-parser-faces.sh
Normal file
22
ReflexToQ3/test/cases-parser-faces.sh
Normal file
@ -0,0 +1,22 @@
|
||||
|
||||
# Test if the parser is correctly reading in faces with 3 indices.
|
||||
# Map Versions as of : 4:26 PM 4/8/2017
|
||||
|
||||
function test () {
|
||||
if [ "$1" == "$2" ]; then
|
||||
echo "test passed"
|
||||
else
|
||||
echo "test failed"
|
||||
echo $2
|
||||
fi
|
||||
}
|
||||
|
||||
# test parser will read in the data and output it in the same format.
|
||||
dir="cases"
|
||||
for each in "$dir"/*
|
||||
do
|
||||
echo "$each"
|
||||
ansr=$(cat $each)
|
||||
test=$(./test-parser --face $each 0)
|
||||
test $ansr $test
|
||||
done
|
7
ReflexToQ3/test/cases/parser-face-3indices-0.txt
Normal file
7
ReflexToQ3/test/cases/parser-face-3indices-0.txt
Normal file
@ -0,0 +1,7 @@
|
||||
0.000000 0.000000 1.000000 1.000000 0.000000 5 2 7 0xffffffff common/materials/metal/aluminum
|
||||
0.000000 0.000000 1.000000 1.000000 0.000000 6 5 7 0xffffffff common/materials/metal/aluminum
|
||||
0.000000 0.000000 1.000000 1.000000 0.000000 3 1 0 4 0xffffffff common/materials/metal/aluminum
|
||||
0.000000 0.000000 1.000000 1.000000 0.000000 0 1 2 5 0xffffffff common/materials/metal/aluminum
|
||||
0.000000 0.000000 1.000000 1.000000 0.000000 4 0 5 6 0xffffffff common/materials/metal/aluminum
|
||||
0.000000 0.000000 1.000000 1.000000 0.000000 2 1 3 7 0xffffffff common/materials/metal/aluminum
|
||||
0.000000 0.000000 1.000000 1.000000 0.000000 3 4 6 7 0xffffffff common/materials/metal/aluminum"
|
5
ReflexToQ3/test/cases/parser-face-3indices-1.txt
Normal file
5
ReflexToQ3/test/cases/parser-face-3indices-1.txt
Normal file
@ -0,0 +1,5 @@
|
||||
0.000000 0.000000 1.000000 1.000000 0.000000 2 0 4 0xffa5a5a5 common/materials/metal/p_metal3
|
||||
0.000000 0.000000 1.000000 1.000000 0.000000 1 3 5 0xffa5a5a5 common/materials/metal/p_metal3
|
||||
0.000000 0.000000 1.000000 1.000000 0.000000 0 3 1 4 0xffa5a5a5 common/materials/metal/p_metal3
|
||||
0.000000 0.000000 1.000000 1.000000 0.000000 3 0 2 5 0xffa5a5a5 common/materials/metal/p_metal3
|
||||
0.000000 0.000000 1.000000 1.000000 0.000000 2 4 1 5 0xffa5a5a5 common/materials/metal/p_metal3
|
11
ReflexToQ3/test/cases/parser-face-3indices-2.txt
Normal file
11
ReflexToQ3/test/cases/parser-face-3indices-2.txt
Normal file
@ -0,0 +1,11 @@
|
||||
0.000000 0.000000 1.000000 1.000000 0.000000 1 0 4 0xff727278 common/materials/stone/stone
|
||||
0.000000 0.000000 1.000000 1.000000 0.000000 3 1 4 0xff727278 common/materials/stone/stone
|
||||
0.000000 0.000000 1.000000 1.000000 0.000000 1 2 5 0xff727278 common/materials/stone/stone
|
||||
0.000000 0.000000 1.000000 1.000000 0.000000 0 1 5 0xff727278 common/materials/stone/stone
|
||||
0.000000 0.000000 1.000000 1.000000 0.000000 4 0 6 0xff727278 common/materials/stone/stone
|
||||
0.000000 0.000000 1.000000 1.000000 0.000000 5 2 6 0xff727278 common/materials/stone/stone
|
||||
0.000000 0.000000 1.000000 1.000000 0.000000 0 5 6 0xff727278 common/materials/stone/stone
|
||||
0.000000 0.000000 1.000000 1.000000 0.000000 1 3 7 0xff727278 common/materials/stone/stone
|
||||
0.000000 0.000000 1.000000 1.000000 0.000000 2 1 7 0xff727278 common/materials/stone/stone
|
||||
0.000000 0.000000 1.000000 1.000000 0.000000 6 2 7 0xff727278 common/materials/stone/stone
|
||||
0.000000 0.000000 1.000000 1.000000 0.000000 3 4 6 7 0xff727278 common/materials/stone/stone"
|
8
ReflexToQ3/test/cases/parser-face-5indices-0.txt
Normal file
8
ReflexToQ3/test/cases/parser-face-5indices-0.txt
Normal file
@ -0,0 +1,8 @@
|
||||
0.000000 0.000000 1.000000 1.000000 0.000000 1 2 4 0xff727278 common/materials/stone/stone
|
||||
0.000000 0.000000 1.000000 1.000000 0.000000 3 1 4 0xff727278 common/materials/stone/stone
|
||||
0.000000 0.000000 1.000000 1.000000 0.000000 0 3 4 0xff727278 common/materials/stone/stone
|
||||
0.000000 0.000000 1.000000 1.000000 0.000000 4 2 5 0xff727278 common/materials/stone/stone
|
||||
0.000000 0.000000 1.000000 1.000000 0.000000 0 4 6 0xff727278 common/materials/stone/stone
|
||||
0.000000 0.000000 1.000000 1.000000 0.000000 4 5 6 0xff727278 common/materials/stone/stone
|
||||
0.000000 0.000000 1.000000 1.000000 0.000000 5 2 6 0xff727278 common/materials/stone/stone
|
||||
0.000000 0.000000 1.000000 1.000000 0.000000 0 6 2 1 3 0xff727278 common/materials/stone/stone
|
8
ReflexToQ3/test/cases/parser-face-5indices-1.txt
Normal file
8
ReflexToQ3/test/cases/parser-face-5indices-1.txt
Normal file
@ -0,0 +1,8 @@
|
||||
0.000000 0.000000 1.000000 1.000000 0.000000 1 0 3 0xff727278 common/materials/stone/stone
|
||||
0.000000 0.000000 1.000000 1.000000 0.000000 3 0 6 0xff727278 common/materials/stone/stone
|
||||
0.000000 0.000000 1.000000 1.000000 0.000000 0 4 7 0xff727278 common/materials/stone/stone
|
||||
0.000000 0.000000 1.000000 1.000000 0.000000 3 6 7 0xff727278 common/materials/stone/stone
|
||||
0.000000 0.000000 1.000000 1.000000 0.000000 6 0 7 0xff727278 common/materials/stone/stone
|
||||
0.000000 0.000000 1.000000 1.000000 0.000000 0 1 2 4 0xff727278 common/materials/stone/stone
|
||||
0.000000 0.000000 1.000000 1.000000 0.000000 2 1 3 7 0xff727278 common/materials/stone/stone
|
||||
0.000000 0.000000 1.000000 1.000000 0.000000 2 7 5 7 4 0xff727278 common/materials/stone/stone
|
6
ReflexToQ3/test/cases/parser-face-nomaterial-0.txt
Normal file
6
ReflexToQ3/test/cases/parser-face-nomaterial-0.txt
Normal file
@ -0,0 +1,6 @@
|
||||
0.000000 0.000000 1.000000 1.000000 0.000000 0 1 2 3 0x00000000
|
||||
0.000000 0.000000 1.000000 1.000000 0.000000 6 5 4 7 0x00000000
|
||||
0.000000 0.000000 1.000000 1.000000 0.000000 2 1 5 6 0x00000000
|
||||
0.000000 0.000000 1.000000 1.000000 0.000000 0 3 7 4 0x00000000
|
||||
0.000000 0.000000 1.000000 1.000000 0.000000 3 2 6 7 0x00000000
|
||||
0.000000 0.000000 1.000000 1.000000 0.000000 1 0 4 5 0x00000000
|
Loading…
Reference in New Issue
Block a user