MCPcopy Create free account
hub / github.com/FloatTech/ZeroBot-Plugin / Test_calculateException

Function Test_calculateException

plugin/chess/elo_test.go:46–80  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

44}
45
46func Test_calculateException(t *testing.T) {
47 type args struct {
48 rate int
49 opponentRate int
50 }
51 tests := []struct {
52 name string
53 args args
54 want float64
55 }{
56 {
57 name: "test1",
58 args: args{
59 rate: 1613,
60 opponentRate: 1573,
61 },
62 want: 0.5573116,
63 },
64 {
65 name: "test2",
66 args: args{
67 rate: 1613,
68 opponentRate: 1613,
69 },
70 want: 0.5,
71 },
72 }
73 for _, tt := range tests {
74 t.Run(tt.name, func(t *testing.T) {
75 if got := calculateException(tt.args.rate, tt.args.opponentRate); math.Abs(got-tt.want) > 0.0001 {
76 t.Errorf("calculateException() = %v, want %v", got, tt.want)
77 }
78 })
79 }
80}

Callers

nothing calls this directly

Calls 1

calculateExceptionFunction · 0.85

Tested by

no test coverage detected