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

Function TestDecimal_RoundDownAndStringFixed

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

Source from the content-addressed store, hash-verified

1444}
1445
1446func TestDecimal_RoundDownAndStringFixed(t *testing.T) {
1447 type testData struct {
1448 input string
1449 places int32
1450 expected string
1451 expectedFixed string
1452 }
1453 tests := []testData{
1454 {"1.454", 0, "1", ""},
1455 {"1.454", 1, "1.4", ""},
1456 {"1.454", 2, "1.45", ""},
1457 {"1.454", 3, "1.454", ""},
1458 {"1.454", 4, "1.454", "1.4540"},
1459 {"1.454", 5, "1.454", "1.45400"},
1460 {"1.554", 0, "1", ""},
1461 {"1.554", 1, "1.5", ""},
1462 {"1.554", 2, "1.55", ""},
1463 {"0.554", 0, "0", ""},
1464 {"0.454", 0, "0", ""},
1465 {"0.454", 5, "0.454", "0.45400"},
1466 {"0", 0, "0", ""},
1467 {"0", 1, "0", "0.0"},
1468 {"0", 2, "0", "0.00"},
1469 {"0", -1, "0", ""},
1470 {"5", 2, "5", "5.00"},
1471 {"5", 1, "5", "5.0"},
1472 {"5", 0, "5", ""},
1473 {"500", 2, "500", "500.00"},
1474 {"500", -2, "500", ""},
1475 {"545", -1, "540", ""},
1476 {"545", -2, "500", ""},
1477 {"545", -3, "0", ""},
1478 {"545", -4, "0", ""},
1479 {"499", -3, "0", ""},
1480 {"499", -4, "0", ""},
1481 {"1.1001", 2, "1.10", ""},
1482 {"-1.1001", 2, "-1.10", ""},
1483 {"-1.454", 0, "-1", ""},
1484 {"-1.454", 1, "-1.4", ""},
1485 {"-1.454", 2, "-1.45", ""},
1486 {"-1.454", 3, "-1.454", ""},
1487 {"-1.454", 4, "-1.454", "-1.4540"},
1488 {"-1.454", 5, "-1.454", "-1.45400"},
1489 {"-1.554", 0, "-1", ""},
1490 {"-1.554", 1, "-1.5", ""},
1491 {"-1.554", 2, "-1.55", ""},
1492 {"-0.554", 0, "0", ""},
1493 {"-0.454", 0, "0", ""},
1494 {"-0.454", 5, "-0.454", "-0.45400"},
1495 {"-5", 2, "-5", "-5.00"},
1496 {"-5", 1, "-5", "-5.0"},
1497 {"-5", 0, "-5", ""},
1498 {"-500", 2, "-500", "-500.00"},
1499 {"-500", -2, "-500", ""},
1500 {"-545", -1, "-540", ""},
1501 {"-545", -2, "-500", ""},
1502 {"-545", -3, "0", ""},
1503 {"-545", -4, "0", ""},

Callers

nothing calls this directly

Calls 4

NewFromStringFunction · 0.85
EqualMethod · 0.80
StringFixedMethod · 0.80
RoundDownMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…