TestMakeErrDecimalWithPrecision tests that WithPrecision generates a copy and not a reference.
(t *testing.T)
| 35 | // TestMakeErrDecimalWithPrecision tests that WithPrecision generates a copy |
| 36 | // and not a reference. |
| 37 | func TestMakeErrDecimalWithPrecision(t *testing.T) { |
| 38 | c := &Context{ |
| 39 | Precision: 5, |
| 40 | MaxExponent: 2, |
| 41 | } |
| 42 | nc := c.WithPrecision(c.Precision * 2) |
| 43 | ed := MakeErrDecimal(nc) |
| 44 | if ed.Ctx.Precision != 10 { |
| 45 | t.Fatalf("expected %d, got %d", 10, ed.Ctx.Precision) |
| 46 | } |
| 47 | if c.Precision != 5 { |
| 48 | t.Fatalf("expected %d, got %d", 5, c.Precision) |
| 49 | } |
| 50 | if c.MaxExponent != 2 { |
| 51 | t.Fatalf("expected %d, got %d", 2, c.MaxExponent) |
| 52 | } |
| 53 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…