mirror of
https://github.com/kmc7468/cs220.git
synced 2025-12-14 22:18:46 +00:00
@@ -13,7 +13,7 @@ pub(crate) fn add(lhs: usize, rhs: usize) -> usize {
|
|||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Adds two unsigned words. If underflow happens, just wrap around.
|
/// Subtracts two unsigned words. If overflow happens, just wrap around.
|
||||||
pub(crate) fn sub(lhs: usize, rhs: usize) -> usize {
|
pub(crate) fn sub(lhs: usize, rhs: usize) -> usize {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ mod test {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn sub_underflow() {
|
fn sub_overflow() {
|
||||||
assert_eq!(sub(usize::MIN, 1), usize::MAX);
|
assert_eq!(sub(usize::MIN, 1), usize::MAX);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user