-
Notifications
You must be signed in to change notification settings - Fork 0
/
mission_test.go
65 lines (53 loc) · 1.05 KB
/
mission_test.go
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
package quester
import (
"testing"
)
func TestCurrentTask(t *testing.T) {
m := &Mission{
Tasks: Tasks{
{
Statement: "task 1",
},
{
Statement: "task 2",
},
},
}
if m.CurrentTask().Statement != "task 1" {
t.Fatal("Current task must be the first task defined in collection")
}
m.ResolveCurrentTask("right answer")
if m.CurrentTask().Statement != "task 2" {
t.Fatal("Current task must be changed after successful resolution of previos one")
}
m.ResolveCurrentTask("right answer")
if m.CurrentTask() != nil {
t.Fatal("In case all task are resolved current task must return nil")
}
}
func TestFinished(t *testing.T) {
m := &Mission{
Tasks: Tasks{
{
Statement: "task 1",
},
},
}
m.ResolveCurrentTask("test")
if !m.IsFinished() {
t.Fatal("Mission must be finished when all tasks are resolved")
}
}
func TestClue(t *testing.T) {
m := &Mission{
Tasks: Tasks{
{
Statement: "task 1",
Clue: "clue 1",
},
},
}
if m.Clue() != "clue 1" {
t.Fatal("Clue() must return clue of the current task")
}
}