Update tests

This commit is contained in:
Minseong Jang
2022-09-01 10:41:56 +09:00
parent 2e60eea753
commit c2df180b2e
2 changed files with 7 additions and 4 deletions

View File

@@ -3,22 +3,22 @@ mod test {
use super::super::assignment01::*;
#[test]
fn add_7_3() {
fn test_add_7_3() {
assert_eq!(add(7, 3), 10);
}
#[test]
fn add_overflow() {
fn test_add_overflow() {
assert_eq!(add(usize::MAX, 1), usize::MIN);
}
#[test]
fn sub_7_3() {
fn test_sub_7_3() {
assert_eq!(sub(7, 3), 4);
}
#[test]
fn sub_overflow() {
fn test_sub_overflow() {
assert_eq!(sub(usize::MIN, 1), usize::MAX);
}
}

View File

@@ -18,6 +18,7 @@ mod test {
#[test]
fn test_up3() {
assert_eq!(up3(1), 1);
assert_eq!(up3(6), 9);
assert_eq!(up3(9), 9);
assert_eq!(up3(10), 27);
@@ -31,6 +32,8 @@ mod test {
#[test]
fn test_chooses() {
assert_eq!(chooses(0), vec![1]);
assert_eq!(chooses(1), vec![1, 1]);
assert_eq!(chooses(5), vec![1, 5, 10, 10, 5, 1]);
assert_eq!(chooses(6), vec![1, 6, 15, 20, 15, 6, 1]);
}