grid2: fix Test_calculateArithmeticPins

This commit is contained in:
c9s 2022-11-08 18:11:04 +08:00
parent f98c00b7aa
commit 4ddbeff7e4
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -104,6 +104,7 @@ func Test_calculateArithmeticPins(t *testing.T) {
want []Pin
}{
{
// (3000-1000)/30 = 66.6666666
name: "simple",
args: args{
lower: number(1000.0),
@ -148,7 +149,8 @@ func Test_calculateArithmeticPins(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
assert.Equalf(t, tt.want, calculateArithmeticPins(tt.args.lower, tt.args.upper, tt.args.size, tt.args.tickSize), "calculateArithmeticPins(%v, %v, %v, %v)", tt.args.lower, tt.args.upper, tt.args.size, tt.args.tickSize)
spread := tt.args.upper.Sub(tt.args.lower).Div(tt.args.size)
assert.Equalf(t, tt.want, calculateArithmeticPins(tt.args.lower, tt.args.upper, spread, tt.args.tickSize), "calculateArithmeticPins(%v, %v, %v, %v)", tt.args.lower, tt.args.upper, tt.args.size, tt.args.tickSize)
})
}
}