MCPcopy
hub / github.com/shopspring/decimal / TestFloat64

Function TestFloat64

decimal_test.go:273–293  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

271}
272
273func TestFloat64(t *testing.T) {
274 for _, x := range testTable {
275 if x.inexact == "" || x.inexact == "-" {
276 continue
277 }
278 s := x.exact
279 d, err := NewFromString(s)
280 if err != nil {
281 t.Errorf("error while parsing %s", s)
282 } else if f, exact := d.Float64(); !exact || f != x.float {
283 t.Errorf("cannot represent exactly %s", s)
284 }
285 s = x.inexact
286 d, err = NewFromString(s)
287 if err != nil {
288 t.Errorf("error while parsing %s", s)
289 } else if f, exact := d.Float64(); exact || f != x.float {
290 t.Errorf("%s should be represented inexactly", s)
291 }
292 }
293}
294
295func TestNewFromStringErrs(t *testing.T) {
296 tests := []string{

Callers

nothing calls this directly

Calls 2

NewFromStringFunction · 0.85
Float64Method · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…