()
| 888 | |
| 889 | #[test] |
| 890 | fn truncate() { |
| 891 | let pool = &mut ListPool::<Inst>::new(); |
| 892 | |
| 893 | let i1 = Inst::new(1); |
| 894 | let i2 = Inst::new(2); |
| 895 | let i3 = Inst::new(3); |
| 896 | let i4 = Inst::new(4); |
| 897 | |
| 898 | let mut list = EntityList::from_slice(&[i1, i2, i3, i4, i1, i2, i3, i4], pool); |
| 899 | assert_eq!(list.as_slice(pool), &[i1, i2, i3, i4, i1, i2, i3, i4]); |
| 900 | list.truncate(6, pool); |
| 901 | assert_eq!(list.as_slice(pool), &[i1, i2, i3, i4, i1, i2]); |
| 902 | list.truncate(9, pool); |
| 903 | assert_eq!(list.as_slice(pool), &[i1, i2, i3, i4, i1, i2]); |
| 904 | list.truncate(2, pool); |
| 905 | assert_eq!(list.as_slice(pool), &[i1, i2]); |
| 906 | list.truncate(0, pool); |
| 907 | assert!(list.is_empty()); |
| 908 | } |
| 909 | |
| 910 | #[test] |
| 911 | fn copy_from() { |
nothing calls this directly
no test coverage detected