|
7 | 7 | "fmt" |
8 | 8 | "encoding/json" |
9 | 9 | "github.com/EndlessCheng/mahjong-helper/util/debug" |
| 10 | + "github.com/stretchr/testify/assert" |
10 | 11 | ) |
11 | 12 |
|
12 | 13 | func Test_majsoul_analysis(t *testing.T) { |
@@ -142,3 +143,34 @@ func Test_tenhou_analysis(t *testing.T) { |
142 | 143 | } |
143 | 144 | } |
144 | 145 | } |
| 146 | + |
| 147 | +func Test_modifySanninPlayerInfoList(t *testing.T) { |
| 148 | + assert := assert.New(t) |
| 149 | + |
| 150 | + roundNumber := 0 |
| 151 | + dealer := 2 |
| 152 | + rd := newRoundData(nil, roundNumber, 0, dealer) |
| 153 | + newPlayers := modifySanninPlayerInfoList(rd.players, roundNumber) |
| 154 | + assert.Equal(newPlayers[0].selfWindTile, 29) |
| 155 | + assert.Equal(newPlayers[1].selfWindTile, 30) |
| 156 | + assert.Equal(newPlayers[2].selfWindTile, 27) |
| 157 | + assert.Equal(newPlayers[3].selfWindTile, 28) |
| 158 | + |
| 159 | + roundNumber = 1 |
| 160 | + dealer = 3 |
| 161 | + rd = newRoundData(nil, roundNumber, 0, dealer) |
| 162 | + newPlayers = modifySanninPlayerInfoList(rd.players, roundNumber) |
| 163 | + assert.Equal(newPlayers[0].selfWindTile, 28) |
| 164 | + assert.Equal(newPlayers[1].selfWindTile, 30) |
| 165 | + assert.Equal(newPlayers[2].selfWindTile, 29) |
| 166 | + assert.Equal(newPlayers[3].selfWindTile, 27) |
| 167 | + |
| 168 | + roundNumber = 2 |
| 169 | + dealer = 0 |
| 170 | + rd = newRoundData(nil, roundNumber, 0, dealer) |
| 171 | + newPlayers = modifySanninPlayerInfoList(rd.players, roundNumber) |
| 172 | + assert.Equal(newPlayers[0].selfWindTile, 27) |
| 173 | + assert.Equal(newPlayers[1].selfWindTile, 30) |
| 174 | + assert.Equal(newPlayers[2].selfWindTile, 28) |
| 175 | + assert.Equal(newPlayers[3].selfWindTile, 29) |
| 176 | +} |
0 commit comments