add extra rule for negative integers
authoralfadur
Sun, 14 Oct 2018 19:28:24 +0300
changeset 13926 fed924791e06
parent 13925 3f0576157749
child 13927 d4874de4736b
add extra rule for negative integers
rust/fpnum/src/lib.rs
--- a/rust/fpnum/src/lib.rs	Sun Oct 14 18:23:19 2018 +0200
+++ b/rust/fpnum/src/lib.rs	Sun Oct 14 19:28:24 2018 +0300
@@ -273,6 +273,7 @@
 macro_rules! fp {
     (-$n: tt / $d: tt) => { FPNum::new(-$n, $d) };
     ($n: tt / $d: tt) => { FPNum::new($n, $d) };
+    (-$n: tt) => { FPNum::from(-$n) };
     ($n: tt) => { FPNum::from($n) };
 }
 
@@ -328,19 +329,6 @@
 }
 
 #[test]
-fn ord() {
-    let z = FPNum::from(0);;
-    let n1_5 = FPNum::new(3, 2);
-    let n2_25 = FPNum::new(9, 4);
-
-    assert!(!(z > z));
-    assert!(!(z < z));
-    assert!(n2_25 > n1_5);
-    assert!(-n2_25 < n1_5);
-    assert!(-n2_25 < -n1_5);
-}
-
-#[test]
 fn arith() {
     let n1_5 = fp!(3/2);
     let n2_25 = fp!(9/4);