Skip to content

Commit

Permalink
Merge pull request #14 from kpp/inc_coverage
Browse files Browse the repository at this point in the history
Increase code coverage
  • Loading branch information
kpp committed Aug 2, 2019
2 parents f4b9c35 + 4ac9527 commit b81c61a
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -926,6 +926,14 @@ mod tests {
assert_eq!(vec![1, 2, 3], executor::block_on(collect::<_, Vec<_>>(stream)));
}

#[test]
fn test_take_more_than_size() {
let stream = iter(1..=3);
let stream = take(stream, 10);

assert_eq!(vec![1, 2, 3], executor::block_on(collect::<_, Vec<_>>(stream)));
}

#[test]
fn test_repeat() {
let stream = repeat(9);
Expand Down Expand Up @@ -962,6 +970,14 @@ mod tests {
assert_eq!(vec![6, 7, 8, 9, 10], executor::block_on(collect::<_, Vec<_>>(stream)));
}

#[test]
fn test_skip_more_than_size() {
let stream = iter(1..=10);
let stream = skip(stream, 15);

assert!(executor::block_on(collect::<_, Vec<_>>(stream)).is_empty());
}

#[test]
fn test_zip() {
let stream1 = iter(1..=3);
Expand All @@ -988,6 +1004,14 @@ mod tests {
assert_eq!(vec![1, 2, 3, 4, 5], executor::block_on(collect::<_, Vec<_>>(stream)));
}

#[test]
fn test_take_while_more_than_size() {
let stream = iter(1..=3);
let stream = take_while(stream, |x| ready(*x <= 5));

assert_eq!(vec![1, 2, 3], executor::block_on(collect::<_, Vec<_>>(stream)));
}

#[test]
fn test_skip_while() {
let stream = iter(1..=10);
Expand All @@ -996,6 +1020,14 @@ mod tests {
assert_eq!(vec![6, 7, 8, 9, 10], executor::block_on(collect::<_, Vec<_>>(stream)));
}

#[test]
fn test_skip_while_more_than_size() {
let stream = iter(1..=3);
let stream = skip_while(stream, |x| ready(*x <= 5));

assert!(executor::block_on(collect::<_, Vec<_>>(stream)).is_empty());
}

#[test]
fn test_fold() {
let stream = iter(0..6);
Expand Down

0 comments on commit b81c61a

Please sign in to comment.