TestGroupCopy tests Group.Clone and Group.DeepCopy
(t *testing.T)
| 122 | |
| 123 | // TestGroupCopy tests Group.Clone and Group.DeepCopy |
| 124 | func 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 |
| 166 | func TestGroupsEqualSimilar(t *testing.T) { |