(t *testing.T)
| 102 | } |
| 103 | |
| 104 | func TestJosephusProblem(t *testing.T) { |
| 105 | type testCase struct { |
| 106 | param int |
| 107 | wantToReturn int |
| 108 | listCount int |
| 109 | } |
| 110 | |
| 111 | testCases := []testCase{ |
| 112 | {5, 4, 8}, |
| 113 | {3, 8, 8}, |
| 114 | {8, 5, 8}, |
| 115 | {8, 5, 8}, |
| 116 | {2, 14, 14}, |
| 117 | {13, 56, 58}, |
| 118 | {7, 5, 5}, |
| 119 | } |
| 120 | |
| 121 | for _, tCase := range testCases { |
| 122 | list := NewCyclic[int]() |
| 123 | fillList(list, tCase.listCount) |
| 124 | got := JosephusProblem(list, tCase.param) |
| 125 | if got != tCase.wantToReturn { |
| 126 | t.Errorf("got: %v, want: %v", got, tCase.wantToReturn) |
| 127 | } |
| 128 | } |
| 129 | } |
nothing calls this directly
no test coverage detected