package thirteen import "testing" func TestFindSpecial(t *testing.T) { type item struct { cards [13]int lai []int target int // 牌型 } data := []item{ // 青龙 { cards: [13]int{39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51}, lai: []int{52, 53}, target: CyanLongType, }, { cards: [13]int{39, 40, 41, 42, 43, 44, 44, 46, 47, 48, 49, 53, 52}, lai: []int{52, 53}, target: CyanLongType, }, //一条龙 { cards: [13]int{13, 14, 28, 29, 30, 44, 45, 7, 34, 9, 23, 11, 51}, lai: []int{52, 53}, target: ALongType, }, { cards: [13]int{13, 14, 28, 29, 52, 44, 45, 7, 34, 9, 23, 11, 51}, lai: []int{52, 53}, target: ALongType, }, { cards: [13]int{13, 13, 28, 29, 52, 44, 45, 7, 34, 9, 23, 11, 51}, lai: []int{52, 53}, target: 0, }, //三同花顺 { cards: [13]int{1, 2, 3, 4, 5, 15, 16, 17, 18, 19, 27, 28, 29}, lai: []int{52, 53}, target: ThreeColorFlushType, }, { cards: [13]int{1, 2, 3, 4, 5, 15, 16, 17, 52, 19, 27, 28, 52}, lai: []int{52, 53}, target: ThreeColorFlushType, }, //凑一色 { cards: [13]int{13, 14, 40, 16, 42, 18, 44, 19, 46, 47, 23, 49, 25}, lai: []int{52, 53}, target: SameColorType, }, { cards: [13]int{0, 1, 2, 28, 3, 29, 5, 31, 8, 10, 11, 12, 37}, lai: []int{52, 53}, target: SameColorType, }, { cards: [13]int{39, 40, 17, 18, 44, 45, 21, 48, 49, 24, 50, 25, 51}, lai: []int{52, 53}, target: SameColorType, }, { cards: [13]int{52, 40, 17, 18, 44, 45, 21, 48, 49, 24, 50, 25, 51}, lai: []int{52, 53}, target: SameColorType, }, //六对半 { cards: [13]int{17, 30, 5, 31, 6, 32, 8, 47, 23, 36, 38, 51, 39}, lai: []int{52, 53}, target: SixPairsHalfType, }, { cards: [13]int{26, 39, 15, 28, 16, 42, 4, 17, 18, 31, 34, 47, 22}, lai: []int{52, 53}, target: SixPairsHalfType, }, { cards: [13]int{26, 52, 15, 28, 53, 42, 4, 17, 18, 31, 34, 47, 22}, lai: []int{52, 53}, target: SixPairsHalfType, }, { cards: [13]int{0, 13, 3, 3, 4, 30, 4, 4, 7, 7, 8, 0, 52}, lai: []int{52, 53}, target: SixPairsHalfType, }, //三顺子 { cards: [13]int{28, 16, 30, 5, 32, 44, 6, 7, 21, 35, 47, 22, 23}, lai: []int{52, 53}, target: ThreeContinuityType, }, { cards: [13]int{1, 28, 16, 17, 18, 30, 31, 45, 20, 8, 36, 50, 12}, lai: []int{52, 53}, target: 0, }, { cards: [13]int{52, 28, 16, 17, 18, 30, 31, 45, 20, 8, 36, 50, 52}, lai: []int{52, 53}, target: ThreeContinuityType, }, //三同花 { cards: [13]int{43, 42, 46, 26, 29, 33, 35, 34, 2, 1, 0, 5, 52}, lai: []int{52, 53}, target: ThreeColorsType, }, { cards: [13]int{43, 42, 46, 26, 29, 33, 35, 34, 2, 1, 0, 5, 11}, lai: []int{52, 53}, target: ThreeColorsType, }, } for _, v := range data { r := GetSpecialType(v.cards, v.lai) t.Logf("cards: %v", PokersShow(v.cards[:])) if r != v.target { t.Errorf("判断错误:结果:%v 正确结果:%v\n", SpecialTypeName[r], SpecialTypeName[v.target]) } else { t.Logf("判断日志:结果:%v 正确结果:%v\n", SpecialTypeName[r], SpecialTypeName[v.target]) } } }