empserver/tests/fairland-test
Markus Armbruster 18687315ac fairland: Fail when island can't be placed, for fairness
The previous commit made island distribution more fair by placing
islands close to a continent in turn.  This is still unfair when
fairland can't place all the islands.

Make grow_islands() fail when it can't place all islands, and main()
start over then, just like it does when grow_continents() fails.

Deities can no longer fill the world with islands by asking for a
impossibly high number of islands.  Tolerable loss, I think.

fairland-test needs a tweak to avoid loss of test coverage.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2021-01-05 10:41:36 +01:00

32 lines
876 B
Bash
Executable file

#!/bin/sh -e
# Basic fairland test
if [ $# -ne 1 ]
then echo "Usage: $0 SRCDIR" >&2; exit 1
fi
srcdir="$1"
. "$srcdir"/tests/test-common.sh
create_sandbox
$files -f >/dev/null
run_and_cmp plain $fairland -s sandbox/plain-newcap_script -R 1 5 30
$empdump -x >sandbox/plain.xdump
cmp_out plain.xdump plain-newcap_script
$files -f >/dev/null
run_and_cmp stunted $fairland -s sandbox/stunted-newcap_script -R 1 8 35 16 15 0 0 5 2
$empdump -x >sandbox/stunted.xdump
cmp_out stunted.xdump stunted-newcap_script
$files -f >/dev/null
run_and_cmp no-spike $fairland -s sandbox/no-spike-newcap_script -R 1 3 30 15 10 0
$empdump -x >sandbox/no-spike.xdump
cmp_out no-spike.xdump no-spike-newcap_script
$files -f >/dev/null
run_and_cmp spike $fairland -s sandbox/spike-newcap_script -R 1 -i 8 30 8 20 50 10
$empdump -x >sandbox/spike.xdump
cmp_out spike.xdump spike-newcap_script