-
Notifications
You must be signed in to change notification settings - Fork 456
/
session_wuge_test.go
70 lines (66 loc) · 1.12 KB
/
session_wuge_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package fate_test
import (
"fmt"
"log"
"testing"
"github.com/babyname/fate"
"github.com/babyname/fate/model"
)
// TestWuGe_WaiGe ...
func TestWuGe_WaiGe(t *testing.T) {
l1, l2, f1, f2 := 1, 1, 1, 1
for i := 0; i < 80000; i++ {
if f2 >= model.WuGeLuckyMax {
f1++
f2 = 1
}
if f1 >= model.WuGeLuckyMax {
l2++
f1 = 1
}
if l2 >= model.WuGeLuckyMax {
l1++
l2 = 1
}
wg := fate.CalcWuGe(l1, l2, f1, f2)
sum := l1 + l2 + f1 + f2
if wg.ZongGe() != sum {
log.Println(wg.ZongGe() == sum, l1, l2, f1, f2, wg.ZongGe())
}
//fmt.Println("result:", wg.Check())
f2++
}
}
func TestWuGeID(t *testing.T) {
type args struct {
l1 int
l2 int
f1 int
f2 int
}
tests := []struct {
name string
args args
want int
}{
{
name: "",
args: args{
l1: 0x2,
l2: 0x4,
f1: 0x8,
f2: 0x16,
},
want: 0x02040816,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got := model.WuGeLuckyID(tt.args.l1, tt.args.l2, tt.args.f1, tt.args.f2)
fmt.Printf("got %x\n", got)
if got != tt.want {
t.Errorf("WuGeID() = %v, nowant %v", got, tt.want)
}
})
}
}