Skip to content

Commit

Permalink
Test retention of trailing zero.
Browse files Browse the repository at this point in the history
  • Loading branch information
finnbear committed Sep 23, 2024
1 parent b0aa34c commit ee25054
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/ext/rust_decimal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ impl<'a> Decode<'a> for Flags {
mod tests {
use crate::{decode, encode};
use rust_decimal::Decimal;
use std::str::FromStr;

#[test]
fn rust_decimal() {
Expand All @@ -93,11 +94,13 @@ mod tests {
Decimal::from(1) / Decimal::from(2),
Decimal::from(1),
Decimal::from(999999999999999999u64),
Decimal::from_str("3.100").unwrap()
];
for v in vs {
let d = decode::<Decimal>(&encode(&v)).unwrap();
assert_eq!(d, v);
assert_eq!(d.is_sign_negative(), v.is_sign_negative());
assert_eq!(d.scale(), v.scale());
}
}
}

0 comments on commit ee25054

Please sign in to comment.