MCPcopy
hub / github.com/minio/minio-go / TestStringSetIntersection

Function TestStringSetIntersection

pkg/set/stringset_test.go:192–213  ·  view source on GitHub ↗

StringSet.Intersection() is called with series of cases for valid and erroneous inputs and the result is validated.

(t *testing.T)

Source from the content-addressed store, hash-verified

190
191// StringSet.Intersection() is called with series of cases for valid and erroneous inputs and the result is validated.
192func 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.
216func TestStringSetDifference(t *testing.T) {

Callers

nothing calls this directly

Calls 4

CreateStringSetFunction · 0.85
NewStringSetFunction · 0.85
IntersectionMethod · 0.45
EqualsMethod · 0.45

Tested by

no test coverage detected