(t *testing.T)
| 44 | } |
| 45 | |
| 46 | func 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 | } |
nothing calls this directly
no test coverage detected