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

Function TestIntSetString

pkg/set/intset_test.go:66–84  ·  view source on GitHub ↗

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

64
65// IntSet.String() is called with series of cases for valid and erroneous inputs and the result is validated.
66func TestIntSetString(t *testing.T) {
67 testCases := []struct {
68 set IntSet
69 expectedResult string
70 }{
71 // Test empty set.
72 {NewIntSet(), `[]`},
73 // Test set with value.
74 {CreateIntSet(42), `[42]`},
75 // Test set with multiple values.
76 {CreateIntSet(1, 2, 3), `[1 2 3]`},
77 }
78
79 for _, testCase := range testCases {
80 if str := testCase.set.String(); str != testCase.expectedResult {
81 t.Fatalf("expected: %s, got: %s", testCase.expectedResult, str)
82 }
83 }
84}
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) {

Callers

nothing calls this directly

Calls 3

NewIntSetFunction · 0.85
CreateIntSetFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected