-
Notifications
You must be signed in to change notification settings - Fork 0
/
bash-n-towerbot.test
90 lines (83 loc) · 2.19 KB
/
bash-n-towerbot.test
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/bin/bash
# bash-n-towerbot.test - dumb integration tests for bash-n-towerbot
#
# Copyright (C) 2019, 2020 Christian Garbs <mitch@cgarbs.de>
# Licensed under GNU GPL v3 or later.
#
# This file is part of bash-n.
#
# bash-n is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# bash-n is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with bash-n. If not, see <http://www.gnu.org/licenses/>.
run_bot()
{
./bash-n-towerbot 2>/dev/null
}
############################
test_single_fake_game_does_not_fail()
{
run_bot <<EOF
WELCOME;bash-n-towerbot
NEW SEASON;abcdef
NEW GAME;OTHER-NAME
YOURTURN;1234
TOKEN INSERTED;bash-n-towerbot;4
TOKEN INSERTED;OTHER-NAME;4
YOURTURN;1235
TOKEN INSERTED;bash-n-towerbot;1
TOKEN INSERTED;OTHER-NAME;1
YOURTURN;1236
TOKEN INSERTED;bash-n-towerbot;2
TOKEN INSERTED;OTHER-NAME;2
YOURTURN;1237
TOKEN INSERTED;bash-n-towerbot;3
RESULT;LOST;OTHER-NAME;column out of range
EOF
}
test_multiple_fake_games_do_not_fail()
{
run_bot <<EOF
WELCOME;bash-n-towerbot
NEW SEASON;abcdef
NEW GAME;OTHER-NAME
YOURTURN;1234
TOKEN INSERTED;bash-n-towerbot;4
TOKEN INSERTED;OTHER-NAME;4
YOURTURN;1235
TOKEN INSERTED;bash-n-towerbot;4
TOKEN INSERTED;OTHER-NAME;4
YOURTURN;1236
TOKEN INSERTED;bash-n-towerbot;4
TOKEN INSERTED;OTHER-NAME;4
YOURTURN;1237
TOKEN INSERTED;bash-n-towerbot;4
RESULT;LOST;OTHER-NAME;column is already full
NEW GAME;OTHER-NAME
TOKEN INSERTED;OTHER-NAME;7
YOURTURN;2234
TOKEN INSERTED;bash-n-towerbot;4
TOKEN INSERTED;OTHER-NAME;4
YOURTURN;2235
TOKEN INSERTED;bash-n-towerbot;6
TOKEN INSERTED;OTHER-NAME;7
YOURTURN;2236
TOKEN INSERTED;bash-n-towerbot;1
TOKEN INSERTED;OTHER-NAME;3
YOURTURN;2237
TOKEN INSERTED;bash-n-towerbot;2
TOKEN INSERTED;OTHER-NAME;2
YOURTURN;2238
RESULT;DRAW;OTHER-NAME;no winner
EOF
}
############################
source bash-tests