mirror of
https://github.com/kmc7468/cs220.git
synced 2026-11-04 00:00:33 +09:00
Update assignment02 tests
This commit is contained in:
1 parent
b0da24b45f
commit
45225857e9
1 file changed
+12
@@ -25,8 +25,20 @@ mod test {
|
||||
assert_eq!(up3(1_000_000), 1_594_323);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_gcd() {
|
||||
assert_eq!(gcd(5, 1), 1);
|
||||
assert_eq!(gcd(3, 3), 3);
|
||||
assert_eq!(gcd(2, 6), 2);
|
||||
assert_eq!(gcd(24, 18), 6);
|
||||
assert_eq!(gcd(20, 63), 1);
|
||||
assert_eq!(gcd(0, 33), 33);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_sum_array() {
|
||||
assert_eq!(sum_array(&[]), 0);
|
||||
assert_eq!(sum_array(&[1]), 1);
|
||||
assert_eq!(sum_array(&[1, 2, 3, 4, 5, 100]), 115);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user