(t *testing.T)
| 312 | } |
| 313 | |
| 314 | func TestDecimalRandom(t *testing.T) { |
| 315 | N := int(1e4) |
| 316 | if testing.Short() { |
| 317 | N = 0 |
| 318 | } |
| 319 | for i := 0; i < N; i++ { |
| 320 | b := RandNumBytes(false) |
| 321 | f, _ := strconv.ParseFloat(string(b), 64) |
| 322 | |
| 323 | b2 := make([]byte, len(b)) |
| 324 | copy(b2, b) |
| 325 | b2 = Decimal(b2, -1) |
| 326 | f2, _ := strconv.ParseFloat(string(b2), 64) |
| 327 | if math.Abs(f-f2) > 1e-6 { |
| 328 | fmt.Println("Bad:", f, "!=", f2, "in", string(b), "to", string(b2)) |
| 329 | } |
| 330 | } |
| 331 | } |
| 332 | |
| 333 | func TestNumberRandom(t *testing.T) { |
| 334 | N := int(1e4) |
nothing calls this directly
no test coverage detected
searching dependent graphs…