(t *testing.T)
| 386 | } |
| 387 | |
| 388 | func TestFloor(t *testing.T) { |
| 389 | tests := map[float64]int64{ |
| 390 | 0: 0, |
| 391 | -0.1: -1, |
| 392 | 0.1: 0, |
| 393 | -0.9: -1, |
| 394 | 0.9: 0, |
| 395 | -1: -1, |
| 396 | 1: 1, |
| 397 | -1.1: -2, |
| 398 | 1.1: 1, |
| 399 | } |
| 400 | |
| 401 | for f, r := range tests { |
| 402 | t.Run(fmt.Sprint(f), func(t *testing.T) { |
| 403 | d, err := new(Decimal).SetFloat64(f) |
| 404 | if err != nil { |
| 405 | t.Fatal(err) |
| 406 | } |
| 407 | _, err = testCtx.Floor(d, d) |
| 408 | if err != nil { |
| 409 | t.Fatal(err) |
| 410 | } |
| 411 | i, err := d.Int64() |
| 412 | if err != nil { |
| 413 | t.Fatal(err) |
| 414 | } |
| 415 | if i != r { |
| 416 | t.Fatalf("got %v, expected %v", i, r) |
| 417 | } |
| 418 | }) |
| 419 | } |
| 420 | } |
| 421 | |
| 422 | func TestFormat(t *testing.T) { |
| 423 | tests := map[string]struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…