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

Method Run

gda_test.go:254–307  ·  view source on GitHub ↗
(c *Context, done chan error, d, x, y *Decimal)

Source from the content-addressed store, hash-verified

252}
253
254func (tc TestCase) Run(c *Context, done chan error, d, x, y *Decimal) (res Condition, err error) {
255 switch tc.Operation {
256 case "abs":
257 res, err = c.Abs(d, x)
258 case "add":
259 res, err = c.Add(d, x, y)
260 case "compare":
261 res, err = c.Cmp(d, x, y)
262 case "cuberoot":
263 res, err = c.Cbrt(d, x)
264 case "divide":
265 res, err = c.Quo(d, x, y)
266 case "divideint":
267 res, err = c.QuoInteger(d, x, y)
268 case "exp":
269 res, err = c.Exp(d, x)
270 case "ln":
271 res, err = c.Ln(d, x)
272 case "log10":
273 res, err = c.Log10(d, x)
274 case "minus":
275 res, err = c.Neg(d, x)
276 case "multiply":
277 res, err = c.Mul(d, x, y)
278 case "plus":
279 res, err = c.Add(d, x, decimalZero)
280 case "power":
281 res, err = c.Pow(d, x, y)
282 case "quantize":
283 res, err = c.Quantize(d, x, y.Exponent)
284 case "reduce":
285 _, res, err = c.Reduce(d, x)
286 case "remainder":
287 res, err = c.Rem(d, x, y)
288 case "squareroot":
289 res, err = c.Sqrt(d, x)
290 case "subtract":
291 res, err = c.Sub(d, x, y)
292 case "tointegral":
293 res, err = c.RoundToIntegralValue(d, x)
294 case "tointegralx":
295 res, err = c.RoundToIntegralExact(d, x)
296
297 // Below used only in benchmarks. Tests call it themselves.
298 case "comparetotal":
299 x.CmpTotal(y)
300 case "tosci":
301 _ = x.String()
302
303 default:
304 done <- fmt.Errorf("unknown operation: %s", tc.Operation)
305 }
306 return
307}
308
309// BenchmarkGDA benchmarks a GDA test. It should not be used without specifying
310// a sub-benchmark to run. For example:

Callers 15

TestNumDigitsFunction · 0.80
TestDecomposerRoundTripFunction · 0.80
TestDecomposerComposeFunction · 0.80
TestBigIntFillBytesFunction · 0.80
TestParseDecTestFunction · 0.80
TestGDAFunction · 0.80
BenchmarkGDAFunction · 0.80
gdaTestFunction · 0.80

Calls 15

CbrtMethod · 0.80
CmpTotalMethod · 0.80
AbsMethod · 0.45
AddMethod · 0.45
CmpMethod · 0.45
QuoMethod · 0.45
QuoIntegerMethod · 0.45
ExpMethod · 0.45
LnMethod · 0.45
Log10Method · 0.45
NegMethod · 0.45
MulMethod · 0.45

Tested by

no test coverage detected