mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 14:55:16 +00:00
29 lines
492 B
Go
29 lines
492 B
Go
|
//go:build !dnum
|
||
|
|
||
|
package fixedpoint
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
)
|
||
|
|
||
|
func TestNumFractionalDigitsLegacy(t *testing.T) {
|
||
|
tests := []struct {
|
||
|
name string
|
||
|
v Value
|
||
|
want int
|
||
|
}{
|
||
|
{
|
||
|
name: "over the default precision",
|
||
|
v: MustNewFromString("0.123456789"),
|
||
|
want: 8,
|
||
|
},
|
||
|
}
|
||
|
for _, tt := range tests {
|
||
|
t.Run(tt.name, func(t *testing.T) {
|
||
|
if got := tt.v.NumFractionalDigits(); got != tt.want {
|
||
|
t.Errorf("NumFractionalDigitsLegacy() = %v, want %v", got, tt.want)
|
||
|
}
|
||
|
})
|
||
|
}
|
||
|
}
|