Explorar o código

test(set): move Set unit tests to integration tests

Danilo Gómez hai 1 ano
pai
achega
1f98bb6923
Modificáronse 2 ficheiros con 16 adicións e 17 borrados
  1. 0 17
      src/set.rs
  2. 16 0
      tests/count.rs

+ 0 - 17
src/set.rs

@@ -45,20 +45,3 @@ impl<T: Ord> Set<T> {
         self.count() - self.count_le(value)
     }
 }
-
-mod tests {
-    #[test]
-    fn test_count() {
-        let mut tree = super::Set::new();
-        for i in 1..11 {
-            assert!(tree.insert(i));
-            assert_eq!(tree.count(), i);
-        }
-        for i in 1..11 {
-            assert_eq!(tree.count_lt(&i), i - 1);
-            assert_eq!(tree.count_le(&i), i);
-            assert_eq!(tree.count_ge(&i), 11 - i);
-            assert_eq!(tree.count_gt(&i), 10 - i);
-        }
-    }
-}

+ 16 - 0
tests/count.rs

@@ -0,0 +1,16 @@
+use mini_avl::Set;
+
+#[test]
+fn test_count() {
+    let mut set = Set::new();
+    for i in 1..11 {
+        assert!(set.insert(i));
+        assert_eq!(set.count(), i);
+    }
+    for i in 1..11 {
+        assert_eq!(set.count_lt(&i), i - 1);
+        assert_eq!(set.count_le(&i), i);
+        assert_eq!(set.count_ge(&i), 11 - i);
+        assert_eq!(set.count_gt(&i), 10 - i);
+    }
+}