From 1f2f1d8ba6bffdb8e837f7c4b9b28a5938d8e352 Mon Sep 17 00:00:00 2001 From: Karan Kadam Date: Sun, 25 Dec 2022 16:39:29 +1030 Subject: [PATCH] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20added=20solutions=20for?= =?UTF-8?q?=20tests=20exercises?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- exercises/tests/tests1.rs | 4 +--- exercises/tests/tests2.rs | 5 ++--- exercises/tests/tests3.rs | 6 ++---- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/exercises/tests/tests1.rs b/exercises/tests/tests1.rs index 8b6ea374..479f182b 100644 --- a/exercises/tests/tests1.rs +++ b/exercises/tests/tests1.rs @@ -7,12 +7,10 @@ // 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!(); + assert!(true); } } diff --git a/exercises/tests/tests2.rs b/exercises/tests/tests2.rs index a5ac15b1..17a7abd6 100644 --- a/exercises/tests/tests2.rs +++ b/exercises/tests/tests2.rs @@ -3,12 +3,11 @@ // 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!(); + let num = 1; + assert_eq!(num, 1); } } diff --git a/exercises/tests/tests3.rs b/exercises/tests/tests3.rs index 196a81a0..37fe63f6 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(32)); } #[test] fn is_false_when_odd() { - assert!(); + assert!(!is_even(15)); } }