(t *testing.T)
| 331 | } |
| 332 | |
| 333 | func TestNumberRandom(t *testing.T) { |
| 334 | N := int(1e4) |
| 335 | if testing.Short() { |
| 336 | N = 0 |
| 337 | } |
| 338 | for i := 0; i < N; i++ { |
| 339 | b := RandNumBytes(true) |
| 340 | f, _ := strconv.ParseFloat(string(b), 64) |
| 341 | |
| 342 | b2 := make([]byte, len(b)) |
| 343 | copy(b2, b) |
| 344 | b2 = Number(b2, -1) |
| 345 | f2, _ := strconv.ParseFloat(string(b2), 64) |
| 346 | if math.Abs(f-f2) > 1e-6 { |
| 347 | fmt.Println("Bad:", f, "!=", f2, "in", string(b), "to", string(b2)) |
| 348 | } |
| 349 | } |
| 350 | } |
| 351 | |
| 352 | //////////////// |
| 353 |
nothing calls this directly
no test coverage detected
searching dependent graphs…