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

Function TestStringSetDifference

pkg/set/stringset_test.go:216–237  ·  view source on GitHub ↗

StringSet.Difference() 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

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) {
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.
240func TestStringSetUnion(t *testing.T) {

Callers

nothing calls this directly

Calls 4

CreateStringSetFunction · 0.85
NewStringSetFunction · 0.85
DifferenceMethod · 0.45
EqualsMethod · 0.45

Tested by

no test coverage detected