MCPcopy
hub / github.com/shopspring/decimal / TestNewFromStringErrs

Function TestNewFromStringErrs

decimal_test.go:295–341  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

293}
294
295func TestNewFromStringErrs(t *testing.T) {
296 tests := []string{
297 "",
298 "qwert",
299 "-",
300 ".",
301 "-.",
302 ".-",
303 "234-.56",
304 "234-56",
305 "2-",
306 "..",
307 "2..",
308 "..2",
309 ".5.2",
310 "8..2",
311 "8.1.",
312 "1e",
313 "1-e",
314 "1e9e",
315 "1ee9",
316 "1ee",
317 "1eE",
318 "1e-",
319 "1e-.",
320 "1e1.2",
321 "123.456e1.3",
322 "1e-1.2",
323 "123.456e-1.3",
324 "123.456Easdf",
325 "123.456e" + strconv.FormatInt(math.MinInt64, 10),
326 "123.456e" + strconv.FormatInt(math.MinInt32, 10),
327 "512.99 USD",
328 "$99.99",
329 "51,850.00",
330 "20_000_000.00",
331 "$20_000_000.00",
332 }
333
334 for _, s := range tests {
335 _, err := NewFromString(s)
336
337 if err == nil {
338 t.Errorf("error expected when parsing %s", s)
339 }
340 }
341}
342
343func TestNewFromStringDeepEquals(t *testing.T) {
344 type StrCmp struct {

Callers

nothing calls this directly

Calls 1

NewFromStringFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…