Skip to content

Commit

Permalink
Normal #[test].
Browse files Browse the repository at this point in the history
  • Loading branch information
finnbear committed Sep 20, 2024
1 parent 427cae9 commit b4c4202
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/ext/rust_decimal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,23 @@ unsafe impl CheckedBitPattern for Flags {
impl<'a> Decode<'a> for Flags {
type Decoder = crate::int::CheckedIntDecoder<'a, Flags, u8>;
}

#[cfg(test)]
mod tests {
use crate::{decode, encode};
use rust_decimal::Decimal;

#[test]
fn rust_decimal() {
let vs = [
Decimal::from(0),
Decimal::from(-1),
Decimal::from(1) / Decimal::from(2),
Decimal::from(1),
Decimal::from(999999999999999999u64),
];
for v in vs {
assert_eq!(decode::<Decimal>(&encode(&v)).unwrap(), v);
}
}
}

0 comments on commit b4c4202

Please sign in to comment.