]> git.lizzy.rs Git - rust.git/commitdiff
add test case for filter+count
authorAndre Bogus <bogusandre@gmail.com>
Wed, 18 Jan 2017 12:55:47 +0000 (13:55 +0100)
committerAndre Bogus <bogusandre@gmail.com>
Wed, 18 Jan 2017 12:55:47 +0000 (13:55 +0100)
src/libcoretest/iter.rs

index 99d312930533f31ec482d683f6c2e4010014c5f3..05a674e05d5be8dd80d080419535257f5d338330 100644 (file)
@@ -191,6 +191,12 @@ fn test_iterator_enumerate_count() {
     assert_eq!(xs.iter().count(), 6);
 }
 
+#[test]
+fn test_iterator_filter_count() {
+    let xs = [0, 1, 2, 3, 4, 5, 6, 7, 8];
+    assert_eq!(xs.iter().filter(|x| x % 2 == 0).count(), 5);
+}
+
 #[test]
 fn test_iterator_peekable() {
     let xs = vec![0, 1, 2, 3, 4, 5];