Skip to content

Commit

Permalink
test: update test_iter_adapter_map
Browse files Browse the repository at this point in the history
  • Loading branch information
julio4 committed Jan 4, 2025
1 parent 874e64f commit bde6cf1
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions corelib/src/test/iter_test.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ use crate::iter::{IntoIterator, Iterator};

#[test]
fn test_iter_adapter_map() {
let mut i = 1;
for elem in (1..4_u8).into_iter().map(|x| 2 * x).map(|x| x + 1) {
assert_eq!(elem, i * 2 + 1);
i += 1;
}
let a = array![1, 2, 3];
let mut iter = a.into_iter().map(|x| 2 * x);

assert_eq!(iter.next(), Option::Some(2));
assert_eq!(iter.next(), Option::Some(4));
assert_eq!(iter.next(), Option::Some(6));
assert_eq!(iter.next(), Option::None);
}

0 comments on commit bde6cf1

Please sign in to comment.