Skip to content

Commit 51ba374

Browse files
view: tests of the 0d extent (#738)
Summary: tests for the expected properties of `Extent` in the 0d case. Pull Request resolved: #738 Reviewed By: mariusae Differential Revision: D79496690 Pulled By: shayne-fletcher fbshipit-source-id: 6c8d7bcd36c86371e8b6eb36a285f49a1e953423
1 parent 35503b8 commit 51ba374

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

ndslice/src/view.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -792,6 +792,16 @@ mod test {
792792
assert_eq!(format!("{}", empty_extent), "");
793793
}
794794

795+
#[test]
796+
fn test_extent_0d() {
797+
let e = Extent::new(vec![], vec![]).unwrap();
798+
assert_eq!(e.len(), 1);
799+
let points: Vec<_> = e.iter().collect();
800+
assert_eq!(points.len(), 1);
801+
assert_eq!(points[0].coords(), &[]);
802+
assert_eq!(points[0].rank(), 0);
803+
}
804+
795805
#[test]
796806
fn test_point_display() {
797807
let extent = Extent::new(vec!["x".into(), "y".into(), "z".into()], vec![4, 5, 6]).unwrap();

0 commit comments

Comments
 (0)