mirror of
https://github.com/shopspring/decimal.git
synced 2024-11-22 20:40:48 +01:00
Add IntPart test.
This commit is contained in:
parent
0fb3379e01
commit
2f187e8d62
1 changed files with 15 additions and 0 deletions
|
@ -484,6 +484,21 @@ func TestDecimal_Overflow(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestIntPart(t *testing.T) {
|
||||||
|
for _, testCase := range []struct {
|
||||||
|
Dec string
|
||||||
|
IntPart int64
|
||||||
|
}{{"0.01", 0}, {"12.1", 12}, {"9999.999", 9999}, {"-32768.01234", -32768}} {
|
||||||
|
d, err := NewFromString(testCase.Dec)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
if d.IntPart() != testCase.IntPart {
|
||||||
|
t.Errorf("expect %d, got %d", testCase.IntPart, d.IntPart())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// old tests after this line
|
// old tests after this line
|
||||||
|
|
||||||
func TestDecimal_Scale(t *testing.T) {
|
func TestDecimal_Scale(t *testing.T) {
|
||||||
|
|
Loading…
Reference in a new issue