100-exercises-to-learn-rust
100-exercises-to-learn-rust copied to clipboard
Test case's name implies mutable reference but a regular reference is present - (03) ticket_v1 - (10) references_in_memory
Test case u64_mut_ref_size implies that the reference whose size is being tested is mutable, but the reference in the actual test case is immutable, just like in two other test cases which do not contain the word mut in their names.
If this exercise is supposed to test whether somebody understands that immutable and mutable references have the same size in memory, then the type in that test case should be &mut u64.
#[cfg(test)]
mod tests {
use super::Ticket;
use std::mem::size_of;
#[test]
fn u16_ref_size() {
assert_eq!(size_of::<&u16>(), todo!());
}
#[test]
fn u64_mut_ref_size() {
assert_eq!(size_of::<&u64>(), todo!());
}
#[test]
fn ticket_ref_size() {
assert_eq!(size_of::<&Ticket>(), todo!());
}
}