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

Function TestCmpOrder

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

Source from the content-addressed store, hash-verified

703}
704
705func TestCmpOrder(t *testing.T) {
706 tests := []struct {
707 s string
708 order int
709 }{
710 {s: "-NaN", order: -4},
711 {s: "-sNaN", order: -3},
712 {s: "-Infinity", order: -2},
713 {s: "-127", order: -1},
714 {s: "-1.00", order: -1},
715 {s: "-1", order: -1},
716 {s: "-0.000", order: -1},
717 {s: "-0", order: -1},
718 {s: "0", order: 1},
719 {s: "1.2300", order: 1},
720 {s: "1.23", order: 1},
721 {s: "1E+9", order: 1},
722 {s: "Infinity", order: 2},
723 {s: "sNaN", order: 3},
724 {s: "NaN", order: 4},
725 }
726
727 for _, tc := range tests {
728 t.Run(tc.s, func(t *testing.T) {
729 d, _, err := NewFromString(tc.s)
730 if err != nil {
731 t.Fatal(err)
732 }
733 o := d.cmpOrder()
734 if o != tc.order {
735 t.Fatalf("got %d, expected %d", o, tc.order)
736 }
737 })
738 }
739}
740
741func TestIsZero(t *testing.T) {
742 tests := []struct {

Callers

nothing calls this directly

Calls 3

NewFromStringFunction · 0.85
RunMethod · 0.80
cmpOrderMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…