Update assignment02 tests

This commit is contained in:
Minseong Jang
2022-09-02 08:13:27 +09:00
parent b0da24b45f
commit 45225857e9

View File

@@ -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);
}