MCPcopy Create free account
hub / github.com/OpenPrinting/goipp / TestGroupCopy

Function TestGroupCopy

group_test.go:124–163  ·  view source on GitHub ↗

TestGroupCopy tests Group.Clone and Group.DeepCopy

(t *testing.T)

Source from the content-addressed store, hash-verified

122
123// TestGroupCopy tests Group.Clone and Group.DeepCopy
124func TestGroupCopy(t *testing.T) {
125 type testData struct {
126 g Group
127 }
128
129 attrs := Attributes{
130 MakeAttr("attr1", TagInteger, Integer(1)),
131 MakeAttr("attr2", TagInteger, Integer(2)),
132 MakeAttr("attr3", TagInteger, Integer(3)),
133 }
134
135 tests := []testData{
136 {Group{TagJobGroup, nil}},
137 {Group{TagJobGroup, Attributes{}}},
138 {Group{TagJobGroup, attrs}},
139 }
140
141 for _, test := range tests {
142 clone := test.g.Clone()
143
144 if !test.g.Equal(clone) {
145 t.Errorf("testing Group.Clone\n"+
146 "expected: %#v\n"+
147 "present: %#v\n",
148 test.g,
149 clone,
150 )
151 }
152
153 copy := test.g.DeepCopy()
154 if !test.g.Equal(copy) {
155 t.Errorf("testing Group.DeepCopy\n"+
156 "expected: %#v\n"+
157 "present: %#v\n",
158 test.g,
159 copy,
160 )
161 }
162 }
163}
164
165// TestGroupEqualSimilar tests Group.Equal and Group.Similar
166func TestGroupsEqualSimilar(t *testing.T) {

Callers

nothing calls this directly

Calls 5

MakeAttrFunction · 0.85
IntegerTypeAlias · 0.85
DeepCopyMethod · 0.65
CloneMethod · 0.45
EqualMethod · 0.45

Tested by

no test coverage detected