added tests for vec converters
All checks were successful
Rust/spacepackets/pipeline/head This commit looks good
Rust/spacepackets/pipeline/pr-main This commit looks good

This commit is contained in:
Robin Müller 2024-02-17 13:27:28 +01:00
parent 60bf876dd3
commit 200593bfb4
Signed by: muellerr
GPG Key ID: A649FB78196E3849

View File

@ -406,6 +406,8 @@ mod tests {
assert_eq!(buf[1], 1); assert_eq!(buf[1], 1);
assert_eq!(my_enum.value(), 1); assert_eq!(my_enum.value(), 1);
assert_eq!(my_enum.value_typed(), 1); assert_eq!(my_enum.value_typed(), 1);
let vec = my_enum.to_vec();
assert_eq!(vec, buf[1..2]);
} }
#[test] #[test]
@ -421,6 +423,8 @@ mod tests {
assert_eq!(buf[2], 0x2f); assert_eq!(buf[2], 0x2f);
assert_eq!(my_enum.value(), 0x1f2f); assert_eq!(my_enum.value(), 0x1f2f);
assert_eq!(my_enum.value_typed(), 0x1f2f); assert_eq!(my_enum.value_typed(), 0x1f2f);
let vec = my_enum.to_vec();
assert_eq!(vec, buf[1..3]);
} }
#[test] #[test]
@ -454,6 +458,8 @@ mod tests {
assert_eq!(buf[4], 0x4f); assert_eq!(buf[4], 0x4f);
assert_eq!(my_enum.value(), 0x1f2f3f4f); assert_eq!(my_enum.value(), 0x1f2f3f4f);
assert_eq!(my_enum.value_typed(), 0x1f2f3f4f); assert_eq!(my_enum.value_typed(), 0x1f2f3f4f);
let vec = my_enum.to_vec();
assert_eq!(vec, buf[1..5]);
} }
#[test] #[test]
@ -489,6 +495,8 @@ mod tests {
assert_eq!(my_enum.value(), 0x1f2f3f4f5f); assert_eq!(my_enum.value(), 0x1f2f3f4f5f);
assert_eq!(my_enum.value_typed(), 0x1f2f3f4f5f); assert_eq!(my_enum.value_typed(), 0x1f2f3f4f5f);
assert_eq!(u64::from_be_bytes(buf), 0x1f2f3f4f5f); assert_eq!(u64::from_be_bytes(buf), 0x1f2f3f4f5f);
let vec = my_enum.to_vec();
assert_eq!(vec, buf);
} }
#[test] #[test]