-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathobject_test.go
83 lines (81 loc) · 1.53 KB
/
object_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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
package tilepix
import "testing"
func TestObject_String(t *testing.T) {
type fields struct {
Name string
objectType ObjectType
}
tests := []struct {
name string
fields fields
want string
}{
{
name: "Ellipse",
fields: fields{
Name: "object 1",
objectType: EllipseObj,
},
want: "Object{Ellipse, Name: 'object 1'}",
},
{
name: "Polygon",
fields: fields{
Name: "object 2",
objectType: PolygonObj,
},
want: "Object{Polygon, Name: 'object 2'}",
},
{
name: "Polyline",
fields: fields{
Name: "object 3",
objectType: PolylineObj,
},
want: "Object{Polyline, Name: 'object 3'}",
},
{
name: "Rectangle",
fields: fields{
Name: "object 4",
objectType: RectangleObj,
},
want: "Object{Rectangle, Name: 'object 4'}",
},
{
name: "Point",
fields: fields{
Name: "object 5",
objectType: PointObj,
},
want: "Object{Point, Name: 'object 5'}",
},
{
name: "Tile",
fields: fields{
Name: "object 6",
objectType: TileObj,
},
want: "Object{Tile, Name: 'object 6'}",
},
{
name: "Unknown",
fields: fields{
Name: "object 7",
objectType: 6,
},
want: "Object{Unknown, Name: 'object 7'}",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
o := &Object{
Name: tt.fields.Name,
objectType: tt.fields.objectType,
}
if got := o.String(); got != tt.want {
t.Errorf("String() = %v, want %v", got, tt.want)
}
})
}
}