tests/retreat: New; exercising retreat
Does not cover land unit retreat after a failed morale check. The test exposes bugs. They're marked "BUG:" in the test input. Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
parent
c7af9bd955
commit
58cd269bed
8 changed files with 7585 additions and 0 deletions
2
Make.mk
2
Make.mk
|
@ -264,12 +264,14 @@ ifeq ($(empthread),LWP)
|
|||
$(srcdir)/tests/build-test $(srcdir)
|
||||
$(srcdir)/tests/fire-test $(srcdir)
|
||||
$(srcdir)/tests/bridgefall-test $(srcdir)
|
||||
$(srcdir)/tests/retreat-test $(srcdir)
|
||||
else
|
||||
@echo "$(srcdir)/tests/smoke-test SKIPPED"
|
||||
@echo "$(srcdir)/tests/actofgod-test SKIPPED"
|
||||
@echo "$(srcdir)/tests/build-test SKIPPED"
|
||||
@echo "$(srcdir)/tests/fire-test SKIPPED"
|
||||
@echo "$(srcdir)/tests/bridgefall-test SKIPPED"
|
||||
@echo "$(srcdir)/tests/retreat-test SKIPPED"
|
||||
endif
|
||||
|
||||
|
||||
|
|
22
tests/retreat-test
Executable file
22
tests/retreat-test
Executable file
|
@ -0,0 +1,22 @@
|
|||
#!/bin/sh -e
|
||||
# Ship and land unit retreat test for Empire
|
||||
|
||||
if [ $# -ne 1 ]
|
||||
then echo "Usage: $0 SRCDIR" >&2; exit 1
|
||||
fi
|
||||
|
||||
srcdir="$1"
|
||||
|
||||
. "$srcdir"/tests/test-common.sh
|
||||
|
||||
create_sandbox
|
||||
cat >>sandbox/etc/empire/econfig <<EOF
|
||||
WORLD_X 24
|
||||
WORLD_Y 12
|
||||
EOF
|
||||
|
||||
begin_test "$srcdir"/tests/retreat/setup-POGO
|
||||
feed_dir "$srcdir"/tests/retreat
|
||||
end_test
|
||||
|
||||
cmp_out var/empire/server.log var/empire/journal.log final.xdump
|
200
tests/retreat/01-retreat-1
Normal file
200
tests/retreat/01-retreat-1
Normal file
|
@ -0,0 +1,200 @@
|
|||
||| Commands
|
||||
|| retreat command
|
||||
| garbage path
|
||||
retr 0 garbage i
|
||||
| condition help, then junk conditions
|
||||
retr 1 g
|
||||
?
|
||||
junk
|
||||
| long path, all conditions
|
||||
retr 2/3 bgyujnbgyujnbgyujn itshbdu
|
||||
| clear retreat order
|
||||
retr 3 ignored c
|
||||
| group retreat order
|
||||
retr a ?uid=4 b h
|
||||
| show retreat orders
|
||||
retr
|
||||
0/1/2/3/4
|
||||
|| lretreat command
|
||||
| garbage path
|
||||
lret 0 garbage i
|
||||
| condition help, then junk conditions
|
||||
lret 1 g
|
||||
?
|
||||
junk
|
||||
| long path, all conditions
|
||||
lret 2/3 yujnbgyujnbgyujnbg ihb
|
||||
| clear retreat order
|
||||
lret 3 ignored c
|
||||
| group retreat order
|
||||
lret a ?uid=4 b h
|
||||
| show retreat orders
|
||||
lret
|
||||
0/1/2/3/4
|
||||
||| Ships
|
||||
|| ships failing to retreat
|
||||
| sunk
|
||||
fire se -2,2 30
|
||||
| sailing
|
||||
fire se -2,2 31
|
||||
| crewless
|
||||
fire se -2,2 32
|
||||
| construction zone
|
||||
fire se -2,2 33
|
||||
| landlocked
|
||||
fire se -2,2 34
|
||||
| no mobility
|
||||
fire se -2,2 35
|
||||
|| ships having difficulties during retreat
|
||||
| out of mobility after n
|
||||
fire se -2,2 40
|
||||
| into non-navigable sector after n
|
||||
fire se -2,2 41
|
||||
| into unfriendly sector right away
|
||||
fire se -2,2 42
|
||||
| gg with 43, sweeping and hitting mines
|
||||
fire se -2,2 44
|
||||
|| ships retreating fully
|
||||
| nh
|
||||
fire se -2,2 10
|
||||
| h
|
||||
fire se -2,2 10
|
||||
| nj into friendly harbor
|
||||
fire se -2,2 10
|
||||
|| own ship
|
||||
fire se -2,2 2
|
||||
|| ships retreating from gun fire
|
||||
| injured covered above
|
||||
| helpless
|
||||
fire se -2,2 11
|
||||
| not helpless
|
||||
fire se -2,-2 20
|
||||
|| ships retreating from depth charges
|
||||
| depth-charged
|
||||
fire sh 5 50
|
||||
fire sh 5 51
|
||||
| helpless
|
||||
fire sh 5 52
|
||||
| not helpless
|
||||
navi 5 gyuh
|
||||
fire sh 5 53
|
||||
|| ships retreating from bombs
|
||||
| injured
|
||||
bomb 0/1/2/3/4 . p -2,2 jh
|
||||
s
|
||||
60
|
||||
61
|
||||
62
|
||||
63
|
||||
64
|
||||
| bombed
|
||||
bomb 0/1/2/3/4 . p -2,2 jh
|
||||
s
|
||||
65
|
||||
66
|
||||
67
|
||||
68
|
||||
69
|
||||
| helpless is not implemented
|
||||
|| ships retreating from missiles
|
||||
| injured
|
||||
launch 10 80
|
||||
launch 11 81
|
||||
launch 12 82
|
||||
launch 13 83
|
||||
launch 14 84
|
||||
| bombed and helpless doesn't apply to missiles (I guess they should)
|
||||
|| ships retreating from torpedoes
|
||||
| torpedoed
|
||||
torp 6 100
|
||||
torp 6 101
|
||||
torp 6 102
|
||||
torp 6 103
|
||||
torp 6 104
|
||||
| BUG: retreats only when hit
|
||||
| injured is not implemented
|
||||
| helpless is not implemented
|
||||
|| ships retreating from sonar pings
|
||||
| naval sonar
|
||||
navi 5 bsh
|
||||
| retreat on plane sonar is not implemented
|
||||
|| ships retreating from unsuccessful boarding
|
||||
navi 5 nh
|
||||
board 130 5
|
||||
1
|
||||
||| Land units
|
||||
| only retreat on p-bombing is implemented
|
||||
| BUG: condition b triggers only on hit
|
||||
|| land units failing to retreat
|
||||
| these bombing runs must hit; if they don't, use __cmd to make them
|
||||
| destroyed
|
||||
bomb 30 . p -2,2 ujh
|
||||
l
|
||||
30
|
||||
| loaded, but there's no way to trigger a retreat then
|
||||
| crewless
|
||||
__cmd added -1 0 0
|
||||
bomb 30 . p -2,2 ujh
|
||||
l
|
||||
32
|
||||
| BUG: retreats anyway
|
||||
| kidnapped
|
||||
bomb 30 . p -2,2 uh
|
||||
l
|
||||
33
|
||||
| BUG: retreats anyway
|
||||
| no mobility
|
||||
bomb 30 . p -2,2 ujh
|
||||
l
|
||||
35
|
||||
|| land units having difficulties during retreat
|
||||
| these bombing runs must hit; if they don't, use __cmd to make them
|
||||
| out of mobility after n
|
||||
__cmd added -1 0 0
|
||||
bomb 30 . p -2,2 ujh
|
||||
l
|
||||
40
|
||||
| into mountain after j
|
||||
bomb 30 . p -2,2 ujh
|
||||
l
|
||||
41
|
||||
| into foreign sector right away
|
||||
__cmd added -1 0 0
|
||||
bomb 30 . p -2,2 ujh
|
||||
l
|
||||
42
|
||||
| yu with 43, sweeping and hitting mines
|
||||
__cmd added -1 0 0
|
||||
bomb 30 . p -2,2 ujh
|
||||
l
|
||||
44
|
||||
| BUG: oopses!
|
||||
|| land units retreating fully
|
||||
| jh
|
||||
bomb 30 . p -2,2 ujh
|
||||
l
|
||||
10
|
||||
| h
|
||||
__cmd added -1 0 0
|
||||
bomb 30 . p -2,2 ujjh
|
||||
l
|
||||
10
|
||||
| uy into allied sector
|
||||
__cmd added -1 0 0
|
||||
bomb 30 . p -2,2 ujjh
|
||||
l
|
||||
10
|
||||
| BUG: can't enter allied sector
|
||||
| own land unit
|
||||
bomb 30 . p -3,1 h
|
||||
l
|
||||
2
|
||||
| injured
|
||||
bomb 20/21/22/23/24 . p -2,2 uuh
|
||||
l
|
||||
60
|
||||
61
|
||||
62
|
||||
63
|
||||
64
|
||||
| bombed covered above
|
8
tests/retreat/99-POGO
Normal file
8
tests/retreat/99-POGO
Normal file
|
@ -0,0 +1,8 @@
|
|||
read 1
|
||||
read 2
|
||||
ship * ?fleet#a
|
||||
retr * ?fleet#a
|
||||
miss s * ?mission#0 q
|
||||
land * ?army#a
|
||||
lretr * ?army#a
|
||||
miss l * ?mission#0 q
|
5551
tests/retreat/final.xdump
Normal file
5551
tests/retreat/final.xdump
Normal file
File diff suppressed because it is too large
Load diff
1624
tests/retreat/journal.log
Normal file
1624
tests/retreat/journal.log
Normal file
File diff suppressed because it is too large
Load diff
19
tests/retreat/server.log
Normal file
19
tests/retreat/server.log
Normal file
|
@ -0,0 +1,19 @@
|
|||
------------------------------------------------------
|
||||
Empire server (pid 42) started
|
||||
Configured for testing
|
||||
Update schedule read
|
||||
No update scheduled
|
||||
Listening on 127.0.0.1
|
||||
Connect from 127.0.0.1
|
||||
Connect from 127.0.0.1
|
||||
tester@127.0.0.1 using country #1
|
||||
tester@127.0.0.1 logged in as country #1
|
||||
Oops: bug in ../src/lib/subs/nxtitem.c:106
|
||||
Crash dump complete
|
||||
tester@127.0.0.1 logged out, country #1
|
||||
Connect from 127.0.0.1
|
||||
tester@127.0.0.1 using country #0
|
||||
tester@127.0.0.1 logged in as country #0
|
||||
tester@127.0.0.1 logged out, country #0
|
||||
Shutdown commencing (cleaning up threads.)
|
||||
Server shutting down on signal 15
|
159
tests/retreat/setup-POGO
Normal file
159
tests/retreat/setup-POGO
Normal file
|
@ -0,0 +1,159 @@
|
|||
|| create land
|
||||
desi @0,0:2 a
|
||||
desi 4,4 h
|
||||
give c * ?des#. 100
|
||||
|| country#1
|
||||
add 1 1 1 p
|
||||
desi -2,0 c
|
||||
edit c 1 c -2,0 s 4 b 640 M 25000 T 100
|
||||
| two forts (one with, one without return fire)
|
||||
desi -2,2 f
|
||||
desi -2,-2 f
|
||||
| harbor for building of non-landlocked ships
|
||||
desi -3,1 h
|
||||
edit l * ?des#.&xloc<0 o 1 O 1
|
||||
| ships for testing retreat command
|
||||
build s -3,1 cs 5
|
||||
| ship to drop depth charges
|
||||
build s -3,1 dd
|
||||
| ship to launch torpedoes
|
||||
edit s 5 g 1 s 40
|
||||
build s -3,1 sb
|
||||
edit s 6 T 165 L -1,3 g 1 s 36
|
||||
| p-bombers with 50% hit chance vs. dd in port
|
||||
build p -2,2 lb 5
|
||||
| marine missiles acc 50
|
||||
edit p 0 U 10 T mi t 160 U 11 U 12 U 13 U 14
|
||||
| p-bombers with 50% hit chance vs. cav
|
||||
edit p 0 U 20 t 400 U 21 U 22 U 23 U 24
|
||||
| very accurate p-bomber
|
||||
edit p 0 U 30 T ac t 400
|
||||
| land units for testing retreat command
|
||||
build l -3,1 inf 5
|
||||
| fortify to reduce unwanted collateral damage
|
||||
edit u * F 127
|
||||
|| country#2
|
||||
add 2 2 2 p
|
||||
| mountain, to test "can't retreat into mountain"
|
||||
desi 2,0 ^
|
||||
edit c 2 c 2,0 s 4 b 640 M 25000 T 100
|
||||
| a harbor for building, a harbor for testing construction zone retreat
|
||||
desi 0:2,2 h
|
||||
edit l 2,2 e 1
|
||||
edit l * ?des#.&own=0 o 2 O 2
|
||||
| ship that can return fire to -2,-2 and -5,-1 weakly
|
||||
edit s 5 U 9 O 2 L -4,-2 E 60
|
||||
| a train to carry land units
|
||||
edit u 0 U 9 O 2 T tra L 1,1
|
||||
| target ships gun fire: injured, helpless, not helpless
|
||||
edit s 0 U 20 O 2 U 10 L 0,2 U 11
|
||||
retr 10 nhhnj ih
|
||||
retr 11 n h
|
||||
retr 20 u h
|
||||
| target ships that want to retreat, but can't: sunk, sailing, crewless,
|
||||
| in construction zone, landlocked, no mobility
|
||||
edit s 10 U 30 U 31 U 32 U 33 U 34 U 35
|
||||
sail 31 nnnnh
|
||||
edit s 33 L 2,2
|
||||
edit s 34 L 3,1
|
||||
retr 30/31/32/33/34/35 n i
|
||||
| target ships having difficulties during retreat: out of mobility,
|
||||
| into non-navigable, into unfriendly, as group into minefield
|
||||
edit s 10 U 40 t lc U 41 U 42
|
||||
retr 40 nnnnh i
|
||||
edit s 40 M 5
|
||||
retr 41 nuh i
|
||||
edit s 42 L -4,2
|
||||
retr 42 ugggh i
|
||||
edit s 10 U 43 t ms U 44
|
||||
fleet m 43/44
|
||||
edit s m L -4,4
|
||||
edit l -8:-6,4 M 100
|
||||
retr m gg i
|
||||
miss s 40/41/42 int .
|
||||
| target ships depth-charges: injured vs. depth-charged, depth-charged,
|
||||
| helpless, not helpless
|
||||
edit s 10 U 50 t sb L -5,1 U 51 U 52 U 53 L -4,-2
|
||||
retr 50 gg dih
|
||||
retr 51 gg dh
|
||||
retr 52/53 gg h
|
||||
| target ships bombs: injured vs. bombed, bombed
|
||||
| five of each, to have a decent chance at getting both a hit and a miss
|
||||
edit s 10 U 60 t dd U 61 U 62 U 63 U 64 U 65 U 66 U 67 U 68 U 69
|
||||
retr 60/61/62/63/64 nn bih
|
||||
retr 65/66/67/68/69 nn bh
|
||||
| target ships missiles: injured (bombed doesn't apply)
|
||||
| five, to have a decent chance at getting both a hit and a miss
|
||||
edit s 60 U 80 U 81 U 82 U 83 U 84
|
||||
retr 80/81/82/83/84 nn bih
|
||||
| target ships torpedoes: torpedoed (injured not implemented)
|
||||
| five, to have a decent chance at getting both a hit and a miss
|
||||
edit s 10 U 100 U 101 U 102 U 103 U 104
|
||||
retr 100/101/102/103/104 nn tih
|
||||
| target ship sonar
|
||||
edit s 50 U 120
|
||||
retr 120 gg s
|
||||
| target ship boarding
|
||||
edit s 50 U 130 t tt
|
||||
retr 130 gg u
|
||||
| target land units bombs: bombed
|
||||
edit u 9 U 10 T cav
|
||||
lret 10 jhhuy b
|
||||
| target land units that want to retreat, but can't: destroyed,
|
||||
| loaded on ship, crewless, kidnapped, loaded on land unit, no mobility
|
||||
edit u 10 U 30 T inf
|
||||
edit u 10 U 31 S 35
|
||||
edit u 10 U 32 U 33 U 35
|
||||
edit u 33 L -1,1
|
||||
edit u 10 U 34 Y 9
|
||||
lret 30/31/32/33/34/35 j b
|
||||
| target land units having difficulties during retreat: out of mobility,
|
||||
| into mountain, into foreign sector, as group into minefield
|
||||
edit u 10 U 40 U 41 U 42
|
||||
lret 40 nu b
|
||||
edit u 40 M 5
|
||||
lret 41 jy b
|
||||
lret 42 g b
|
||||
edit u 10 U 43 T eng U 44
|
||||
army m 43/44
|
||||
edit l 0:1,-1:0 O 1 M 100
|
||||
lret m yu b
|
||||
miss l 40/41/42 res .
|
||||
| target land units bombs: injured vs. bombed
|
||||
| five, to have a decent chance at getting both a hit and a miss
|
||||
edit u 10 U 60 L 0,0 U 61 U 62 U 63 U 64
|
||||
lret 60/61/62/63/64 nj bih
|
||||
|| country#3, allied to #2
|
||||
add 3 3 3 p
|
||||
edit l 2:3,-2:-1 o 3 O 3
|
||||
|| country#4, friendly to #2
|
||||
add 4 4 4 p
|
||||
edit l 4,4 o 4 O 4
|
||||
|| finishing touches
|
||||
give m * ?des=f 5
|
||||
give g * ?des=f 2
|
||||
give s * ?des=f 100
|
||||
give p * ?des=f 100
|
||||
edit l * ?des#.&eff=0 e 100 m 127
|
||||
edit s * ?eff=20&uid#30 E 100
|
||||
edit s * ?mob=0&uid#35 M 127
|
||||
edit s * ?uid#32 m 10
|
||||
edit u * ?eff=10&uid#30 e 100
|
||||
edit u * ?mob=0&uid#35 M 127
|
||||
edit u * ?uid#32 m 10
|
||||
fleet a * ?own=1&uid#2
|
||||
fleet a 9
|
||||
army a * ?own=1&uid#2
|
||||
edit p * e 100 m 127
|
||||
|| relations
|
||||
decl w 1 2
|
||||
decl w 2 1
|
||||
decl a 2 3
|
||||
decl f 2 4
|
||||
|| show initial state here to help maintainers
|
||||
map *
|
||||
ship *
|
||||
retr *
|
||||
land *
|
||||
lretr *
|
||||
plane *
|
Loading…
Add table
Add a link
Reference in a new issue