Skip to content

Commit

Permalink
Add more test cases to test_from_str
Browse files Browse the repository at this point in the history
  • Loading branch information
akubera committed May 12, 2023
1 parent 08ac947 commit 11cf120
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3038,12 +3038,17 @@ mod bigdecimal_tests {
("1.23E+3", 123, -1),
("1.23E-8", 123, 10),
("-1.23E-10", -123, 12),
("123_", 123, 0),
("31_862_140.830_686_979", 31862140830686979, 9),
("-1_1.2_2", -1122, 2),
("999.521_939", 999521939, 6),
("679.35_84_03E-2", 679358403, 8),
("271576662.__E4", 271576662, -4),
];

for &(source, val, scale) in vals.iter() {
let x = BigDecimal::from_str(source).unwrap();
assert_eq!(x.int_val.to_i32().unwrap(), val);
assert_eq!(x.int_val.to_i64().unwrap(), val);
assert_eq!(x.scale, scale);
}
}
Expand Down

0 comments on commit 11cf120

Please sign in to comment.