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",
|
.1000000000000008: "0.1000000000000008",
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestNewFromFloat(t *testing.T) {
|
func init() {
|
||||||
// add negatives
|
// add negatives
|
||||||
for f, s := range testTable {
|
for f, s := range testTable {
|
||||||
if f > 0 {
|
if f > 0 {
|
||||||
testTable[-f] = "-" + s
|
testTable[-f] = "-" + s
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestNewFromFloat(t *testing.T) {
|
||||||
for f, s := range testTable {
|
for f, s := range testTable {
|
||||||
d := NewFromFloat(f)
|
d := NewFromFloat(f)
|
||||||
if d.String() != s {
|
if d.String() != s {
|
||||||
|
@ -60,13 +62,6 @@ func TestNewFromFloat(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestNewFromString(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 {
|
for _, s := range testTable {
|
||||||
d, err := NewFromString(s)
|
d, err := NewFromString(s)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue