Skip to content

Commit

Permalink
tests: add unit tests for map/map_ref
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Schreiner <[email protected]>
  • Loading branch information
henryiii authored and becheran committed Dec 19, 2024
1 parent 64ba3f1 commit 8c09cca
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3281,6 +3281,20 @@ mod test {
test_grid(&grid, 2, 3, Order::RowMajor, &[0, 0, 0, 0, 0, 0]);
}

#[test]
fn map() {
let grid: Grid<u8> = grid![[1,2,3][4,5,6]];
let mapped = grid.map(|x| x * 2);
test_grid(&mapped, 2, 3, Order::RowMajor, &[2, 4, 6, 8, 10, 12]);
}

#[test]
fn map_ref() {
let grid: Grid<u8> = grid![[1,2,3][4,5,6]];
let mapped = grid.map_ref(|x| *x * 2);
test_grid(&mapped, 2, 3, Order::RowMajor, &[2, 4, 6, 8, 10, 12]);
}

#[test]
#[allow(clippy::redundant_closure_for_method_calls)]
fn iter_rows() {
Expand Down

0 comments on commit 8c09cca

Please sign in to comment.