StringSet.Union() is called with series of cases for valid and erroneous inputs and the result is validated.
(t *testing.T)
| 238 | |
| 239 | // StringSet.Union() is called with series of cases for valid and erroneous inputs and the result is validated. |
| 240 | func TestStringSetUnion(t *testing.T) { |
| 241 | testCases := []struct { |
| 242 | set1 StringSet |
| 243 | set2 StringSet |
| 244 | expectedResult StringSet |
| 245 | }{ |
| 246 | // Test union same values. |
| 247 | {CreateStringSet("foo", "bar"), CreateStringSet("foo", "bar"), CreateStringSet("foo", "bar")}, |
| 248 | // Test union same values in second set. |
| 249 | {CreateStringSet("foo", "bar", "baz"), CreateStringSet("foo", "bar"), CreateStringSet("foo", "bar", "baz")}, |
| 250 | // Test union different values in both set. |
| 251 | {CreateStringSet("foo", "baz"), CreateStringSet("baz", "bar"), CreateStringSet("foo", "baz", "bar")}, |
| 252 | // Test union all different values. |
| 253 | {CreateStringSet("foo", "baz"), CreateStringSet("poo", "bar"), CreateStringSet("foo", "baz", "poo", "bar")}, |
| 254 | } |
| 255 | |
| 256 | for _, testCase := range testCases { |
| 257 | if result := testCase.set1.Union(testCase.set2); !result.Equals(testCase.expectedResult) { |
| 258 | t.Fatalf("expected: %s, got: %s", testCase.expectedResult, result) |
| 259 | } |
| 260 | } |
| 261 | } |
| 262 | |
| 263 | // StringSet.MarshalJSON() is called with series of cases for valid and erroneous inputs and the result is validated. |
| 264 | func TestStringSetMarshalJSON(t *testing.T) { |
nothing calls this directly
no test coverage detected