From d8561c73fda8f88924bf90aabadf21f56c736fcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Seunghyun=20Mun=20=28=EB=AC=B8=EC=8A=B9=ED=98=84=29?= Date: Thu, 27 Oct 2022 21:56:39 +0900 Subject: [PATCH] Session1 Rust Study --- exercises/intro/intro2.rs | 5 ++--- exercises/tests/tests1.rs | 4 ++-- exercises/tests/tests2.rs | 4 +--- exercises/tests/tests3.rs | 6 ++---- 4 files changed, 7 insertions(+), 12 deletions(-) diff --git a/exercises/intro/intro2.rs b/exercises/intro/intro2.rs index efc1af20..7ba39ca8 100644 --- a/exercises/intro/intro2.rs +++ b/exercises/intro/intro2.rs @@ -2,8 +2,7 @@ // Make the code print a greeting to the world. // Execute `rustlings hint intro2` or use the `hint` watch subcommand for a hint. -// I AM NOT DONE - fn main() { - println!("Hello {}!"); + let greeting = "World"; + println!("Hello {}!", greeting); } diff --git a/exercises/tests/tests1.rs b/exercises/tests/tests1.rs index 8b6ea374..3563e8e7 100644 --- a/exercises/tests/tests1.rs +++ b/exercises/tests/tests1.rs @@ -7,12 +7,12 @@ // pass! Make the test fail! // Execute `rustlings hint tests1` or use the `hint` watch subcommand for a hint. -// I AM NOT DONE #[cfg(test)] mod tests { #[test] fn you_can_assert() { - assert!(); + let x = 1; + assert!(x != 1); } } diff --git a/exercises/tests/tests2.rs b/exercises/tests/tests2.rs index a5ac15b1..69e79ebb 100644 --- a/exercises/tests/tests2.rs +++ b/exercises/tests/tests2.rs @@ -3,12 +3,10 @@ // pass! Make the test fail! // Execute `rustlings hint tests2` or use the `hint` watch subcommand for a hint. -// I AM NOT DONE - #[cfg(test)] mod tests { #[test] fn you_can_assert_eq() { - assert_eq!(); + assert_eq!(1, 2); } } diff --git a/exercises/tests/tests3.rs b/exercises/tests/tests3.rs index 196a81a0..28b0ebe0 100644 --- a/exercises/tests/tests3.rs +++ b/exercises/tests/tests3.rs @@ -4,8 +4,6 @@ // we expect to get when we call `is_even(5)`. // Execute `rustlings hint tests3` or use the `hint` watch subcommand for a hint. -// I AM NOT DONE - pub fn is_even(num: i32) -> bool { num % 2 == 0 } @@ -16,11 +14,11 @@ mod tests { #[test] fn is_true_when_even() { - assert!(); + assert!(is_even(6)); } #[test] fn is_false_when_odd() { - assert!(); + assert!(!is_even(5)); } }