IntSet.String() is called with series of cases for valid and erroneous inputs and the result is validated.
(t *testing.T)
| 64 | |
| 65 | // IntSet.String() is called with series of cases for valid and erroneous inputs and the result is validated. |
| 66 | func 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. |
| 87 | func TestIntSetToSlice(t *testing.T) { |
nothing calls this directly
no test coverage detected