mirror of
https://github.com/shopspring/decimal.git
synced 2024-11-22 20:40:48 +01:00
Add negative test values once.
This commit is contained in:
parent
3d6bb50c86
commit
9fc32a450f
1 changed files with 3 additions and 8 deletions
|
@ -28,14 +28,16 @@ var testTable = map[float64]string{
|
|||
.1000000000000008: "0.1000000000000008",
|
||||
}
|
||||
|
||||
func TestNewFromFloat(t *testing.T) {
|
||||
func init() {
|
||||
// add negatives
|
||||
for f, s := range testTable {
|
||||
if f > 0 {
|
||||
testTable[-f] = "-" + s
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestNewFromFloat(t *testing.T) {
|
||||
for f, s := range testTable {
|
||||
d := NewFromFloat(f)
|
||||
if d.String() != s {
|
||||
|
@ -60,13 +62,6 @@ func TestNewFromFloat(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestNewFromString(t *testing.T) {
|
||||
// add negatives
|
||||
for f, s := range testTable {
|
||||
if f > 0 {
|
||||
testTable[-f] = "-" + s
|
||||
}
|
||||
}
|
||||
|
||||
for _, s := range testTable {
|
||||
d, err := NewFromString(s)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in a new issue