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

Function TestCmp

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

Source from the content-addressed store, hash-verified

143}
144
145func TestCmp(t *testing.T) {
146 tests := []struct {
147 x, y string
148 c int
149 }{
150 {x: "1", y: "10", c: -1},
151 {x: "1", y: "1e1", c: -1},
152 {x: "1e1", y: "1", c: 1},
153 {x: ".1e1", y: "100e-1", c: -1},
154
155 {x: ".1e1", y: "100e-2", c: 0},
156 {x: "1", y: ".1e1", c: 0},
157 {x: "1", y: "1", c: 0},
158 }
159 for _, tc := range tests {
160 t.Run(fmt.Sprintf("%s, %s", tc.x, tc.y), func(t *testing.T) {
161 x := newDecimal(t, testCtx, tc.x)
162 y := newDecimal(t, testCtx, tc.y)
163 c := x.Cmp(y)
164 if c != tc.c {
165 t.Fatalf("expected: %d, got: %d", tc.c, c)
166 }
167 })
168 }
169}
170
171func TestModf(t *testing.T) {
172 tests := []struct {

Callers

nothing calls this directly

Calls 3

newDecimalFunction · 0.85
RunMethod · 0.80
CmpMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…