mirror of
https://github.com/shopspring/decimal.git
synced 2024-11-23 04:40:49 +01:00
make Value() test more realistic
This commit is contained in:
parent
54efccb61f
commit
db8f550fda
1 changed files with 4 additions and 4 deletions
|
@ -879,17 +879,17 @@ func TestDecimal_Value(t *testing.T) {
|
||||||
var decimalPtr *Decimal
|
var decimalPtr *Decimal
|
||||||
value, err := decimalPtr.Value()
|
value, err := decimalPtr.Value()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("(*Decimal)(<nil>) failed with message: %s", err)
|
t.Errorf("(*Decimal)(<nil>).Value() failed with message: %s", err)
|
||||||
} else if value != nil {
|
} else if value != nil {
|
||||||
t.Errorf("%v is not nil", value)
|
t.Errorf("%v is not nil", value)
|
||||||
}
|
}
|
||||||
|
|
||||||
// check that normal case is handled appropriately
|
// check that normal case is handled appropriately
|
||||||
a := New(1234, 2)
|
a := New(1234, -2)
|
||||||
expected := "123400"
|
expected := "12.34"
|
||||||
value, err = a.Value()
|
value, err = a.Value()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Decimal(123400).Value() failed with message: %s", err)
|
t.Errorf("Decimal(12.34).Value() failed with message: %s", err)
|
||||||
} else if value.(string) != expected {
|
} else if value.(string) != expected {
|
||||||
t.Errorf("%s does not equal to %s", a, expected)
|
t.Errorf("%s does not equal to %s", a, expected)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue