StringSet.Difference() is called with series of cases for valid and erroneous inputs and the result is validated.
(t *testing.T)
| 214 | |
| 215 | // StringSet.Difference() is called with series of cases for valid and erroneous inputs and the result is validated. |
| 216 | func TestStringSetDifference(t *testing.T) { |
| 217 | testCases := []struct { |
| 218 | set1 StringSet |
| 219 | set2 StringSet |
| 220 | expectedResult StringSet |
| 221 | }{ |
| 222 | // Test differing none. |
| 223 | {CreateStringSet("foo", "bar"), CreateStringSet("foo", "bar"), NewStringSet()}, |
| 224 | // Test differing in first set. |
| 225 | {CreateStringSet("foo", "bar", "baz"), CreateStringSet("foo", "bar"), CreateStringSet("baz")}, |
| 226 | // Test differing values in both set. |
| 227 | {CreateStringSet("foo", "baz"), CreateStringSet("baz", "bar"), CreateStringSet("foo")}, |
| 228 | // Test differing all values. |
| 229 | {CreateStringSet("foo", "baz"), CreateStringSet("poo", "bar"), CreateStringSet("foo", "baz")}, |
| 230 | } |
| 231 | |
| 232 | for _, testCase := range testCases { |
| 233 | if result := testCase.set1.Difference(testCase.set2); !result.Equals(testCase.expectedResult) { |
| 234 | t.Fatalf("expected: %s, got: %s", testCase.expectedResult, result) |
| 235 | } |
| 236 | } |
| 237 | } |
| 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) { |
nothing calls this directly
no test coverage detected