(t *testing.T)
| 627 | } |
| 628 | |
| 629 | func TestContextSetStringt(t *testing.T) { |
| 630 | tests := []struct { |
| 631 | s string |
| 632 | c *Context |
| 633 | expect string |
| 634 | }{ |
| 635 | { |
| 636 | s: "1.234", |
| 637 | c: &BaseContext, |
| 638 | expect: "1.234", |
| 639 | }, |
| 640 | { |
| 641 | s: "1.234", |
| 642 | c: BaseContext.WithPrecision(2), |
| 643 | expect: "1.2", |
| 644 | }, |
| 645 | } |
| 646 | for i, tc := range tests { |
| 647 | t.Run(fmt.Sprintf("%d: %s", i, tc.s), func(t *testing.T) { |
| 648 | d := new(Decimal) |
| 649 | if _, _, err := tc.c.SetString(d, tc.s); err != nil { |
| 650 | t.Fatal(err) |
| 651 | } |
| 652 | got := d.String() |
| 653 | if got != tc.expect { |
| 654 | t.Fatalf("expected: %s, got: %s", tc.expect, got) |
| 655 | } |
| 656 | }) |
| 657 | } |
| 658 | } |
| 659 | |
| 660 | func TestQuantize(t *testing.T) { |
| 661 | tests := []struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…