StringSet.Intersection() is called with series of cases for valid and erroneous inputs and the result is validated.
(t *testing.T)
| 190 | |
| 191 | // StringSet.Intersection() is called with series of cases for valid and erroneous inputs and the result is validated. |
| 192 | func TestStringSetIntersection(t *testing.T) { |
| 193 | testCases := []struct { |
| 194 | set1 StringSet |
| 195 | set2 StringSet |
| 196 | expectedResult StringSet |
| 197 | }{ |
| 198 | // Test intersecting all values. |
| 199 | {CreateStringSet("foo", "bar"), CreateStringSet("foo", "bar"), CreateStringSet("foo", "bar")}, |
| 200 | // Test intersecting all values in second set. |
| 201 | {CreateStringSet("foo", "bar", "baz"), CreateStringSet("foo", "bar"), CreateStringSet("foo", "bar")}, |
| 202 | // Test intersecting different values in second set. |
| 203 | {CreateStringSet("foo", "baz"), CreateStringSet("baz", "bar"), CreateStringSet("baz")}, |
| 204 | // Test intersecting none. |
| 205 | {CreateStringSet("foo", "baz"), CreateStringSet("poo", "bar"), NewStringSet()}, |
| 206 | } |
| 207 | |
| 208 | for _, testCase := range testCases { |
| 209 | if result := testCase.set1.Intersection(testCase.set2); !result.Equals(testCase.expectedResult) { |
| 210 | t.Fatalf("expected: %s, got: %s", testCase.expectedResult, result) |
| 211 | } |
| 212 | } |
| 213 | } |
| 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) { |
nothing calls this directly
no test coverage detected