Skip to content

Commit

Permalink
more testing, updated criterion
Browse files Browse the repository at this point in the history
  • Loading branch information
antonmarsden committed Aug 7, 2023
1 parent d85b634 commit d1323cd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ rand = "0.8.5"
serde_json = "1.0.104"

[dev-dependencies.criterion]
version = "0.3.4"
version = "0.5.1"
features = ["html_reports"]

[[bench]]
Expand Down
16 changes: 16 additions & 0 deletions src/view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,22 @@ fn calculate_view_dimensions<T>(start: Coordinate, end: Coordinate, toodee: &imp
(num_cols, num_rows, data_start..data_start + data_len)
}

#[cfg(test)]
mod tests {
use super::*;
use alloc::vec;

#[test]
fn calc_dims_view() {
let v = vec![1u32; 32];
let view = TooDeeView::new(4, 4, &v);
let (num_cols, num_rows, range) = calculate_view_dimensions((0, 1), (2,3), &view, 4);
assert_eq!(num_cols, 2);
assert_eq!(num_rows, 2);
assert_eq!(range, 4..10);
}
}

/// *Internal only* functions for calculating vector ranges.
trait TooDeeViewCommon<T>: TooDeeOps<T> {

Expand Down

0 comments on commit d1323cd

Please sign in to comment.