Parcourir la source

Remove useless redundant tests.

whitequark il y a 7 ans
Parent
commit
1a11e4db5a
2 fichiers modifiés avec 0 ajouts et 78 suppressions
  1. 0 39
      src/socket/raw.rs
  2. 0 39
      src/socket/udp.rs

+ 0 - 39
src/socket/raw.rs

@@ -207,42 +207,3 @@ impl<'a> IpPayload for RawRepr<'a> {
         payload.copy_from_slice(self.0);
     }
 }
-
-#[cfg(test)]
-mod test {
-    use super::*;
-
-    #[test]
-    pub fn test_buffer() {
-        let mut storage = vec![];
-        for _ in 0..5 {
-            storage.push(PacketBuffer::new(vec![0]))
-        }
-        let mut buffer = SocketBuffer::new(&mut storage[..]);
-
-        assert_eq!(buffer.empty(), true);
-        assert_eq!(buffer.full(), false);
-        buffer.enqueue().unwrap().size = 1;
-        assert_eq!(buffer.empty(), false);
-        assert_eq!(buffer.full(), false);
-        buffer.enqueue().unwrap().size = 2;
-        buffer.enqueue().unwrap().size = 3;
-        assert_eq!(buffer.dequeue().unwrap().size, 1);
-        assert_eq!(buffer.dequeue().unwrap().size, 2);
-        buffer.enqueue().unwrap().size = 4;
-        buffer.enqueue().unwrap().size = 5;
-        buffer.enqueue().unwrap().size = 6;
-        buffer.enqueue().unwrap().size = 7;
-        assert_eq!(buffer.enqueue().unwrap_err(), ());
-        assert_eq!(buffer.empty(), false);
-        assert_eq!(buffer.full(), true);
-        assert_eq!(buffer.dequeue().unwrap().size, 3);
-        assert_eq!(buffer.dequeue().unwrap().size, 4);
-        assert_eq!(buffer.dequeue().unwrap().size, 5);
-        assert_eq!(buffer.dequeue().unwrap().size, 6);
-        assert_eq!(buffer.dequeue().unwrap().size, 7);
-        assert_eq!(buffer.dequeue().unwrap_err(), ());
-        assert_eq!(buffer.empty(), true);
-        assert_eq!(buffer.full(), false);
-    }
-}

+ 0 - 39
src/socket/udp.rs

@@ -207,42 +207,3 @@ impl<'a> IpPayload for UdpRepr<'a> {
         self.emit(&mut packet, &repr.src_addr(), &repr.dst_addr())
     }
 }
-
-#[cfg(test)]
-mod test {
-    use super::*;
-
-    #[test]
-    pub fn test_buffer() {
-        let mut storage = vec![];
-        for _ in 0..5 {
-            storage.push(PacketBuffer::new(vec![0]))
-        }
-        let mut buffer = SocketBuffer::new(&mut storage[..]);
-
-        assert_eq!(buffer.empty(), true);
-        assert_eq!(buffer.full(),  false);
-        buffer.enqueue().unwrap().size = 1;
-        assert_eq!(buffer.empty(), false);
-        assert_eq!(buffer.full(),  false);
-        buffer.enqueue().unwrap().size = 2;
-        buffer.enqueue().unwrap().size = 3;
-        assert_eq!(buffer.dequeue().unwrap().size, 1);
-        assert_eq!(buffer.dequeue().unwrap().size, 2);
-        buffer.enqueue().unwrap().size = 4;
-        buffer.enqueue().unwrap().size = 5;
-        buffer.enqueue().unwrap().size = 6;
-        buffer.enqueue().unwrap().size = 7;
-        assert_eq!(buffer.enqueue().unwrap_err(), ());
-        assert_eq!(buffer.empty(), false);
-        assert_eq!(buffer.full(),  true);
-        assert_eq!(buffer.dequeue().unwrap().size, 3);
-        assert_eq!(buffer.dequeue().unwrap().size, 4);
-        assert_eq!(buffer.dequeue().unwrap().size, 5);
-        assert_eq!(buffer.dequeue().unwrap().size, 6);
-        assert_eq!(buffer.dequeue().unwrap().size, 7);
-        assert_eq!(buffer.dequeue().unwrap_err(), ());
-        assert_eq!(buffer.empty(), true);
-        assert_eq!(buffer.full(),  false);
-    }
-}