mirror of
https://github.com/luanti-org/minetestmapper.git
synced 2025-10-06 22:05:22 +02:00
Add test for invalid block too
This commit is contained in:
@@ -13,7 +13,7 @@ encodepos () {
|
||||
echo "$(($1 + 0x1000 * $2 + 0x1000000 * $3))"
|
||||
}
|
||||
|
||||
# create map file with sql statements
|
||||
# create map file using SQL statements
|
||||
writemap () {
|
||||
rm -rf $mapdir
|
||||
mkdir $mapdir
|
||||
@@ -42,6 +42,17 @@ checkmap () {
|
||||
echo "Passed."
|
||||
}
|
||||
|
||||
# check that invocation returned an error
|
||||
checkerr () {
|
||||
local r=0
|
||||
./minetestmapper --noemptyimage -v -i ./testmap -o map.png "$@" || r=1
|
||||
if [ $r -eq 0 ]; then
|
||||
echo "Did not return error!"
|
||||
exit 1
|
||||
fi
|
||||
echo "Passed."
|
||||
}
|
||||
|
||||
# this is missing the indices and primary keys but that doesn't matter
|
||||
schema_old="CREATE TABLE blocks(pos INT, data BLOB);"
|
||||
schema_new="CREATE TABLE blocks(x INT, y INT, z INT, data BLOB);"
|
||||
@@ -114,3 +125,17 @@ mkdir $mapdir/players
|
||||
printf '%s\n' "name = cat" "position = (80,0,80)" >$mapdir/players/cat
|
||||
# we can't check that it actually worked, however
|
||||
checkmap 1 --drawplayers --zoom 4
|
||||
|
||||
msg "block error (wrong version)"
|
||||
writemap "
|
||||
$schema_new
|
||||
INSERT INTO blocks VALUES (0, 0, 0, x'150000');
|
||||
"
|
||||
checkerr
|
||||
|
||||
msg "block error (invalid zstd)"
|
||||
writemap "
|
||||
$schema_new
|
||||
INSERT INTO blocks VALUES (0, 0, 0, x'1d28b52ffd2001090000');
|
||||
"
|
||||
checkerr
|
||||
|
Reference in New Issue
Block a user