(t *testing.T)
| 141 | } |
| 142 | |
| 143 | func TestTableExp10(t *testing.T) { |
| 144 | tests := []struct { |
| 145 | pow int64 |
| 146 | str string |
| 147 | }{ |
| 148 | { |
| 149 | pow: 0, |
| 150 | str: "1", |
| 151 | }, |
| 152 | { |
| 153 | pow: 1, |
| 154 | str: "10", |
| 155 | }, |
| 156 | { |
| 157 | pow: 5, |
| 158 | str: "100000", |
| 159 | }, |
| 160 | { |
| 161 | pow: powerTenTableSize + 1, |
| 162 | str: "1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", |
| 163 | }, |
| 164 | } |
| 165 | |
| 166 | for i, test := range tests { |
| 167 | var tmpE BigInt |
| 168 | d := tableExp10(test.pow, &tmpE) |
| 169 | if s := d.String(); s != test.str { |
| 170 | t.Errorf("%d: expected PowerOfTenDec(%d) to give %s, got %s", i, test.pow, test.str, s) |
| 171 | } |
| 172 | } |
| 173 | } |
| 174 | |
| 175 | // TestNumDigitsLargeNegative is a regression test for a bug where NumDigits |
| 176 | // would panic with a nil pointer dereference when processing large negative |
nothing calls this directly
no test coverage detected
searching dependent graphs…