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

Function createDivTestCases

decimal_test.go:1971–1996  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1969}
1970
1971func createDivTestCases() []DivTestCase {
1972 res := make([]DivTestCase, 0)
1973 var n int32 = 5
1974 a := []int{1, 2, 3, 6, 7, 10, 100, 14, 5, 400, 0, 1000000, 1000000 + 1, 1000000 - 1}
1975 for s := -1; s < 2; s = s + 2 { // 2
1976 for s2 := -1; s2 < 2; s2 = s2 + 2 { // 2
1977 for e1 := -n; e1 <= n; e1++ { // 2n+1
1978 for e2 := -n; e2 <= n; e2++ { // 2n+1
1979 var prec int32
1980 for prec = -n; prec <= n; prec++ { // 2n+1
1981 for _, v1 := range a { // 11
1982 for _, v2 := range a { // 11, even if 0 is skipped
1983 sign1 := New(int64(s), 0)
1984 sign2 := New(int64(s2), 0)
1985 d := sign1.Mul(New(int64(v1), e1))
1986 d2 := sign2.Mul(New(int64(v2), e2))
1987 res = append(res, DivTestCase{d, d2, prec})
1988 }
1989 }
1990 }
1991 }
1992 }
1993 }
1994 }
1995 return res
1996}
1997
1998func TestDecimal_QuoRem2(t *testing.T) {
1999 for _, tc := range createDivTestCases() {

Callers 4

Benchmark_DivideOriginalFunction · 0.85
Benchmark_DivideNewFunction · 0.85
TestDecimal_QuoRem2Function · 0.85
TestDecimal_DivRound2Function · 0.85

Calls 2

NewFunction · 0.85
MulMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…