Skip to content

Commit 15e4b2f

Browse files
committed
basic tests
1 parent b391bdd commit 15e4b2f

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/table_column.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,3 +123,23 @@ impl std::ops::IndexMut<crate::NodeId> for MutableTableColumn<'_, crate::NodeId>
123123
self.0.index_mut(usize::try_from(index).unwrap())
124124
}
125125
}
126+
127+
#[test]
128+
fn test_table_column() {
129+
use crate::NodeId;
130+
let v: Vec<NodeId> = vec![1.into(), 2.into()];
131+
let t = new_table_column(&v);
132+
let n = crate::SizeType::from(0);
133+
assert_eq!(t[n], v[0]);
134+
let n = NodeId::from(0);
135+
assert_eq!(t[n], v[0]);
136+
}
137+
138+
#[test]
139+
#[should_panic]
140+
fn test_table_column_null() {
141+
use crate::NodeId;
142+
let v: Vec<NodeId> = vec![1.into(), 2.into()];
143+
let t = new_table_column(&v);
144+
let _ = t[NodeId::NULL];
145+
}

0 commit comments

Comments
 (0)