mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-25 00:05:15 +00:00
fixedpoint: add Floor test
This commit is contained in:
parent
991dc4121c
commit
051755ec54
|
@ -3,8 +3,9 @@
|
||||||
package fixedpoint
|
package fixedpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/stretchr/testify/assert"
|
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestDelta(t *testing.T) {
|
func TestDelta(t *testing.T) {
|
||||||
|
@ -13,6 +14,12 @@ func TestDelta(t *testing.T) {
|
||||||
assert.InDelta(t, f1.Mul(f2).Float64(), 41.3, 1e-14)
|
assert.InDelta(t, f1.Mul(f2).Float64(), 41.3, 1e-14)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestFloor(t *testing.T) {
|
||||||
|
f1 := MustNewFromString("10.333333")
|
||||||
|
f2 := f1.Floor()
|
||||||
|
assert.Equal(t, "10", f2.String())
|
||||||
|
}
|
||||||
|
|
||||||
func TestInternal(t *testing.T) {
|
func TestInternal(t *testing.T) {
|
||||||
r := &reader{"1.1e-15", 0}
|
r := &reader{"1.1e-15", 0}
|
||||||
c, e := r.getCoef()
|
c, e := r.getCoef()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user