From 328d73f305d828eb81c8848b742865bc51d09e46 Mon Sep 17 00:00:00 2001 From: Yu Zhang Date: Thu, 6 Feb 2025 15:12:45 +0800 Subject: [PATCH] add test to show the bugs --- strconv/decimal.mbt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/strconv/decimal.mbt b/strconv/decimal.mbt index 69ab544a1..7173daaeb 100644 --- a/strconv/decimal.mbt +++ b/strconv/decimal.mbt @@ -601,6 +601,16 @@ fn Decimal::to_string(self : Decimal) -> String { Show::to_string(self) } +test "from_int64" { + let d = Decimal::from_int64(-1) + inspect!(d.to_string(), content="0") +} + +test "to_string" { + let d = parse_decimal!("-1") + inspect!(d.to_string(), content="1") +} + test "new" { let hpd = Decimal::from_int64(1L) assert_eq!(hpd.digits.length(), 800)