add ui tests
parent
f985dc4e5c
commit
91b1662302
|
@ -0,0 +1 @@
|
|||
test/*.expect
|
4
justfile
4
justfile
|
@ -5,3 +5,7 @@ default:
|
|||
# run tests
|
||||
test:
|
||||
for f in lib/*.test.fnl; do fennel $f | faucet; done
|
||||
|
||||
# build expect scripts
|
||||
expects:
|
||||
for f in test/*.dat; do awk -f test/test.awk $f > ${f/dat/expect}; done
|
||||
|
|
2
main.fnl
2
main.fnl
|
@ -72,8 +72,6 @@
|
|||
2 ;; moving
|
||||
(let [from (index-of-move (string.sub move 1 2))
|
||||
to (index-of-move (string.sub move -2 -1))]
|
||||
(print "From" from)
|
||||
(print "To" to)
|
||||
(tset self.moves from 0)
|
||||
(tset self.moves to self.player)
|
||||
(if (mill-at? self.moves to)
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
== ABOUT ==
|
||||
|
||||
these files are to help me test the ui
|
||||
|
||||
moves are recorded in `<file>.dat`.
|
||||
then you can `awk -f test.awk file.dat > file.expect`.
|
||||
(or `just expects` to build them all.)
|
||||
then you can `expect file.expect`
|
||||
to have expect play the game for you up to a certain point.
|
||||
|
||||
== REQUIREMENTS ==
|
||||
|
||||
- awk
|
||||
- expect
|
||||
|
||||
== FUTURE PLANS ==
|
||||
|
||||
have actual integration tests?
|
|
@ -0,0 +1,22 @@
|
|||
A1
|
||||
A4
|
||||
A7
|
||||
b2
|
||||
b4
|
||||
b6
|
||||
c3
|
||||
c4
|
||||
c5
|
||||
d1
|
||||
d2
|
||||
d3
|
||||
d5
|
||||
d6
|
||||
d7
|
||||
e3
|
||||
e4
|
||||
e5
|
||||
e4f4
|
||||
e3e4
|
||||
f4g4
|
||||
d3e3
|
|
@ -0,0 +1,5 @@
|
|||
a1
|
||||
b4
|
||||
a4
|
||||
b2
|
||||
a7
|
|
@ -0,0 +1,12 @@
|
|||
BEGIN {
|
||||
print "#!/usr/bin/expect -f"
|
||||
print "spawn fennel main.fnl"
|
||||
}
|
||||
|
||||
{ print "expect -re \"Player .'s turn:\""
|
||||
print "send -- \"" $0 "\\r\""
|
||||
}
|
||||
|
||||
END {
|
||||
print "interact"
|
||||
}
|
Loading…
Reference in New Issue