mirror of
https://github.com/kmc7468/cs220.git
synced 2025-12-15 22:48:45 +00:00
25 lines
420 B
Rust
25 lines
420 B
Rust
#[cfg(test)]
|
|
mod test {
|
|
use super::super::assignment01::*;
|
|
|
|
#[test]
|
|
fn test_add_7_3() {
|
|
assert_eq!(add(7, 3), 10);
|
|
}
|
|
|
|
#[test]
|
|
fn test_add_overflow() {
|
|
assert_eq!(add(usize::MAX, 1), usize::MIN);
|
|
}
|
|
|
|
#[test]
|
|
fn test_sub_7_3() {
|
|
assert_eq!(sub(7, 3), 4);
|
|
}
|
|
|
|
#[test]
|
|
fn test_sub_overflow() {
|
|
assert_eq!(sub(usize::MIN, 1), usize::MAX);
|
|
}
|
|
}
|