代码拉取完成,页面将自动刷新
package main
import (
"testing"
"github.com/EndlessCheng/mahjong-helper/util"
"github.com/EndlessCheng/mahjong-helper/util/model"
)
func Test_parseTenhouMeld(t *testing.T) {
d := &tenhouRoundData{}
for _, s := range []string{
"43595",
"17511",
} {
t.Log(d._parseTenhouMeld(s))
}
}
func TestAnalysisTilesRisk(t *testing.T) {
debugMode = true
d := newGame(&tenhouRoundData{})
handsTiles34, _, err := util.StrToTiles34("123456789m 123456789p 123456789s 1234567z")
if err != nil {
t.Fatal(err)
}
globalDiscardTiles34, _, err := util.StrToTiles34("22m 158p 123789s 6z")
if err != nil {
t.Fatal(err)
}
for i, c := range handsTiles34 {
if c == 0 {
continue
}
d.leftCounts[i] -= c
if d.leftCounts[c] < 0 {
t.Fatal("参数有误: ", util.Mahjong[c])
}
}
for i, c := range globalDiscardTiles34 {
if c == 0 {
continue
}
d.leftCounts[i] -= c
if d.leftCounts[c] < 0 {
t.Fatal("参数有误: ", util.Mahjong[c])
}
d.globalDiscardTiles = append(d.globalDiscardTiles, i)
}
d.players[1].isReached = true
d.players[1].reachTileAtGlobal = 0
d.players[1].discardTiles = []int{1, 1, 1, 1, 12, 4, 5, 6}
d.players[2].isReached = true
d.players[2].reachTileAtGlobal = 7
d.players[2].discardTiles = []int{1, 1, 1, 1, 1}
d.players[3].discardTiles = []int{1, 1, 1, 1, 1}
d.players[3].melds = make([]*model.Meld, 2)
d.players[3].meldDiscardsAt = []int{2, 3}
d.players[3].latestDiscardAtGlobal = 10
table := d.analysisTilesRisk()
table.printWithHands(handsTiles34, d.leftCounts)
}
func TestReg(t *testing.T) {
d := &tenhouRoundData{
msg: &tenhouMessage{
Tag: "T123",
},
}
t.Log(d.IsSelfDraw() == true)
d.msg.Tag = "TATA"
t.Log(d.IsSelfDraw() == false)
d.msg.Tag = "T"
t.Log(d.IsSelfDraw() == false)
d.msg.Tag = "T1234"
t.Log(d.IsSelfDraw() == false)
d.msg.Tag = "D123"
t.Log(d.IsDiscard() == true)
d.msg.Tag = "E123"
t.Log(d.IsDiscard() == true)
d.msg.Tag = "EAAA"
t.Log(d.IsDiscard() == false)
d.msg.Tag = "E"
t.Log(d.IsDiscard() == false)
d.msg.Tag = "E123123"
t.Log(d.IsDiscard() == false)
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。