Skip to content

Commit

Permalink
two more tests to increase code coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Apr 25, 2023
1 parent 00e0bfd commit a30bfda
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/iterators.rs
Expand Up @@ -116,3 +116,33 @@ fn insert_and_into_iterate() -> Result<()> {
assert_eq!(58, sum);
Ok(())
}

#[test]
fn iterate_with_blanks() -> Result<()> {
let mut m: Map<&str, i32, 10> = Map::new();
m.insert("one", 1);
m.insert("two", 3);
m.insert("three", 5);
m.remove(&"two");
let mut sum = 0;
for (_k, v) in m.iter() {
sum += v;
}
assert_eq!(6, sum);
Ok(())
}

#[test]
fn into_iterate_with_blanks() -> Result<()> {
let mut m: Map<&str, i32, 10> = Map::new();
m.insert("one", 1);
m.insert("two", 3);
m.insert("three", 5);
m.remove(&"two");
let mut sum = 0;
for (_k, v) in m.into_iter() {
sum += v;
}
assert_eq!(6, sum);
Ok(())
}

0 comments on commit a30bfda

Please sign in to comment.