-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommand_test.go
More file actions
42 lines (35 loc) · 802 Bytes
/
command_test.go
File metadata and controls
42 lines (35 loc) · 802 Bytes
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
package gobot
import (
"testing"
)
func TestPlaceIsFirstAllowedCommand(t *testing.T) {
r := getTestRobot()
cmd := Command{}
cmd.Command = "MOVE"
response := r.HandleCommand(cmd)
if response.Error == nil {
t.Errorf("No error returned when MOVE before PLACE")
t.Fail()
}
cmd = Command{}
cmd.Command = "LEFT"
response = r.HandleCommand(cmd)
if response.Error == nil {
t.Errorf("No error returned when LEFT before PLACE")
t.Fail()
}
cmd = Command{}
cmd.Command = "RIGHT"
response = r.HandleCommand(cmd)
if response.Error == nil {
t.Errorf("No error returned when RIGHT before PLACE")
t.Fail()
}
cmd = Command{}
cmd.Command = "REPORT"
response = r.HandleCommand(cmd)
if response.Error == nil {
t.Errorf("No error returned when REPORT before PLACE")
t.Fail()
}
}