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

Function TestIntSetToSlice

pkg/set/intset_test.go:87–106  ·  view source on GitHub ↗

IntSet.ToSlice() 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

85
86// IntSet.ToSlice() is called with series of cases for valid and erroneous inputs and the result is validated.
87func TestIntSetToSlice(t *testing.T) {
88 testCases := []struct {
89 set IntSet
90 expectedResult []int
91 }{
92 // Test empty set.
93 {NewIntSet(), []int{}},
94 // Test set with value.
95 {CreateIntSet(42), []int{42}},
96 // Test set with multiple values (should be sorted).
97 {CreateIntSet(3, 1, 2), []int{1, 2, 3}},
98 }
99
100 for _, testCase := range testCases {
101 islice := testCase.set.ToSlice()
102 if !reflect.DeepEqual(islice, testCase.expectedResult) {
103 t.Fatalf("expected: %v, got: %v", testCase.expectedResult, islice)
104 }
105 }
106}
107
108func TestIntSet_UnmarshalJSON(t *testing.T) {
109 type args struct {

Callers

nothing calls this directly

Calls 3

NewIntSetFunction · 0.85
CreateIntSetFunction · 0.85
ToSliceMethod · 0.45

Tested by

no test coverage detected