summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/tests1.rs49
-rw-r--r--tests/tests2.rs44
-rw-r--r--tests/tests3.rs43
-rw-r--r--tests/tests4.rs19
4 files changed, 0 insertions, 155 deletions
diff --git a/tests/tests1.rs b/tests/tests1.rs
deleted file mode 100644
index 959ed85..0000000
--- a/tests/tests1.rs
+++ /dev/null
@@ -1,49 +0,0 @@
-// tests1.rs
-// Tests are important to ensure that your code does what you think it should do.
-// Tests can be run on this file with the following command:
-// rustc --test tests1.rs
-
-// This test has a problem with it -- make the test compile! Make the test
-// pass! Make the test fail! Scroll down for hints :)
-
-#[cfg(test)]
-mod tests {
- #[test]
- fn you_can_assert() {
- assert!();
- }
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-// You don't even need to write any code to test -- you can just test values and run that, even
-// though you wouldn't do that in real life :) `assert!` is a macro that needs an argument.
-// Depending on the value of the argument, `assert!` will do nothing (in which case the test will
-// pass) or `assert!` will panic (in which case the test will fail). So try giving different values
-// to `assert!` and see which ones compile, which ones pass, and which ones fail :)
diff --git a/tests/tests2.rs b/tests/tests2.rs
deleted file mode 100644
index 6775d61..0000000
--- a/tests/tests2.rs
+++ /dev/null
@@ -1,44 +0,0 @@
-// tests2.rs
-// This test has a problem with it -- make the test compile! Make the test
-// pass! Make the test fail! Scroll down for hints :)
-
-#[cfg(test)]
-mod tests {
- #[test]
- fn you_can_assert_eq() {
- assert_eq!();
- }
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-// Like the previous exercise, you don't need to write any code to get this test to compile and
-// run. `assert_eq!` is a macro that takes two arguments and compares them. Try giving it two
-// values that are equal! Try giving it two arguments that are different! Try giving it two values
-// that are of different types! Try switching which argument comes first and which comes second!
diff --git a/tests/tests3.rs b/tests/tests3.rs
deleted file mode 100644
index e041f38..0000000
--- a/tests/tests3.rs
+++ /dev/null
@@ -1,43 +0,0 @@
-// tests3.rs
-// This test isn't testing our function -- make it do that in such a way that
-// the test passes. Then write a second test that tests that we get the result
-// we expect to get when we call `is_even(5)`. Scroll down for hints!
-
-pub fn is_even(num: i32) -> bool {
- num % 2 == 0
-}
-
-#[cfg(test)]
-mod tests {
- use super::*;
-
- #[test]
- fn is_true_when_even() {
- assert!(false);
- }
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-// You can call a function right where you're passing arguments to `assert!` -- so you could do
-// something like `assert!(having_fun())`. If you want to check that you indeed get false, you
-// can negate the result of what you're doing using `!`, like `assert!(!having_fun())`.
diff --git a/tests/tests4.rs b/tests/tests4.rs
deleted file mode 100644
index 23d444a..0000000
--- a/tests/tests4.rs
+++ /dev/null
@@ -1,19 +0,0 @@
-// tests4.rs
-// This test isn't testing our function -- make it do that in such a way that
-// the test passes. Then write a second test that tests that we get the result
-// we expect to get when we call `times_two` with a negative number.
-// No hints, you can do this :)
-
-pub fn times_two(num: i32) -> i32 {
- num * 2
-}
-
-#[cfg(test)]
-mod tests {
- use super::*;
-
- #[test]
- fn returns_twice_of_positive_numbers() {
- assert_eq!(4, 4);
- }
-}