Add tests for `first`, `first_mut`, `last`, and `last_mut`.
@@ -126,6 +126,18 @@ fn filled_with() {
assert_eq!(v[3], 4);
}
+#[test]
+fn first() {
+ let v = staticvec![1, 2, 3];
+ assert_eq!(*v.first().unwrap(), 1);
+}
+
+#[test]
+fn first_mut() {
+ let mut v = staticvec![1, 2, 3];
+ assert_eq!(*v.first_mut().unwrap(), 1);
+}
+
#[test]
fn from() {
assert_eq!(
@@ -189,6 +201,18 @@ fn is_not_full() {
assert!(v.is_not_full());
}
+#[test]
+fn last() {
+ let v = staticvec![1, 2, 3];
+ assert_eq!(*v.last().unwrap(), 3);
+}
+
+#[test]
+fn last_mut() {
+ let mut v = staticvec![1, 2, 3];
+ assert_eq!(*v.last_mut().unwrap(), 3);
+}
+
#[test]
fn len() {
let a = staticvec![1, 2, 3];
