MCPcopy Create free account
hub / github.com/cockroachdb/apd / TestFloat64

Function TestFloat64

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

Source from the content-addressed store, hash-verified

326}
327
328func TestFloat64(t *testing.T) {
329 tests := []float64{
330 0,
331 1,
332 -1,
333 math.MaxFloat32,
334 math.SmallestNonzeroFloat32,
335 math.MaxFloat64,
336 math.SmallestNonzeroFloat64,
337 }
338
339 for _, tc := range tests {
340 t.Run(fmt.Sprint(tc), func(t *testing.T) {
341 d := new(Decimal)
342 d.SetFloat64(tc)
343 f, err := d.Float64()
344 if err != nil {
345 t.Fatal(err)
346 }
347 if tc != f {
348 t.Fatalf("expected %v, got %v", tc, f)
349 }
350 })
351 }
352}
353
354func TestCeil(t *testing.T) {
355 tests := map[float64]int64{

Callers

nothing calls this directly

Calls 3

RunMethod · 0.80
SetFloat64Method · 0.80
Float64Method · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…