From 2ea94bfda48437c3979384df84704aa7109fbca1 Mon Sep 17 00:00:00 2001 From: numzero Date: Sun, 2 Nov 2025 02:48:56 +0300 Subject: [PATCH] make tests look a bit readable --- src/ops.rs | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/ops.rs b/src/ops.rs index 39c8b4c..e418cf2 100644 --- a/src/ops.rs +++ b/src/ops.rs @@ -44,23 +44,23 @@ mod tests { #[test] fn test_add() { - assert_eq!(F8::from(0b0011) + F8::from(0b0000), F8::from(0b0011)); - assert_eq!(F8::from(0b0000) + F8::from(0b0111), F8::from(0b0111)); - assert_eq!(F8::from(0b0011) + F8::from(0b0101), F8::from(0b1000)); - assert_eq!(F8::from(0b0101) + F8::from(0b0011), F8::from(0b1000)); - assert_eq!(F8::from(0b0011) + F8::from(0b0110), F8::from(0b1001)); - assert_eq!(F8::from(0b0011) + F8::from(0b0111), F8::from(0b1010)); - assert_eq!(F8::from(0b1100) + F8::from(0b0001), F8::from(0b1101)); + assert_eq!(F8::from(3) + F8::from(0), F8::from(3)); + assert_eq!(F8::from(0) + F8::from(7), F8::from(7)); + assert_eq!(F8::from(3) + F8::from(5), F8::from(8)); + assert_eq!(F8::from(5) + F8::from(3), F8::from(8)); + assert_eq!(F8::from(3) + F8::from(6), F8::from(9)); + assert_eq!(F8::from(3) + F8::from(7), F8::from(10)); + assert_eq!(F8::from(12) + F8::from(1), F8::from(13)); } #[test] fn test_sub() { - assert_eq!(F8::from(0b0011) - F8::from(0b0000), F8::from(0b0011)); - assert_eq!(F8::from(0b0000) - F8::from(0b0111), F8::from(0)); - assert_eq!(F8::from(0b0011) - F8::from(0b0101), F8::from(0)); - assert_eq!(F8::from(0b0101) - F8::from(0b0011), F8::from(0b0010)); - assert_eq!(F8::from(0b0110) - F8::from(0b0011), F8::from(0b0011)); - assert_eq!(F8::from(0b0111) - F8::from(0b0011), F8::from(0b0100)); - assert_eq!(F8::from(0b1100) - F8::from(0b0001), F8::from(0b1011)); + assert_eq!(F8::from(3) - F8::from(0), F8::from(3)); + assert_eq!(F8::from(0) - F8::from(7), F8::from(0)); + assert_eq!(F8::from(3) - F8::from(5), F8::from(0)); + assert_eq!(F8::from(5) - F8::from(3), F8::from(2)); + assert_eq!(F8::from(6) - F8::from(3), F8::from(3)); + assert_eq!(F8::from(7) - F8::from(3), F8::from(4)); + assert_eq!(F8::from(12) - F8::from(1), F8::from(11)); } }