summaryrefslogtreecommitdiff
path: root/exercises/17_tests
diff options
context:
space:
mode:
authormo8it <mo8it@proton.me>2024-04-17 22:46:21 +0200
committermo8it <mo8it@proton.me>2024-04-17 22:46:21 +0200
commitcb9f1ac9ce3c834b0cca964b6809b74508f80b54 (patch)
treef168d86b6035d7d9e357ac53cd36c2b8928f399b /exercises/17_tests
parentd83cc69afecf59fba184755591d73c7208988574 (diff)
Require a main function in all exercises
Diffstat (limited to 'exercises/17_tests')
-rw-r--r--exercises/17_tests/tests1.rs4
-rw-r--r--exercises/17_tests/tests2.rs4
-rw-r--r--exercises/17_tests/tests3.rs4
-rw-r--r--exercises/17_tests/tests4.rs8
4 files changed, 18 insertions, 2 deletions
diff --git a/exercises/17_tests/tests1.rs b/exercises/17_tests/tests1.rs
index bde2108..d32ace1 100644
--- a/exercises/17_tests/tests1.rs
+++ b/exercises/17_tests/tests1.rs
@@ -10,6 +10,10 @@
// Execute `rustlings hint tests1` or use the `hint` watch subcommand for a
// hint.
+fn main() {
+ // You can optionally experiment here.
+}
+
#[cfg(test)]
mod tests {
#[test]
diff --git a/exercises/17_tests/tests2.rs b/exercises/17_tests/tests2.rs
index aea5c0e..501c44b 100644
--- a/exercises/17_tests/tests2.rs
+++ b/exercises/17_tests/tests2.rs
@@ -6,6 +6,10 @@
// Execute `rustlings hint tests2` or use the `hint` watch subcommand for a
// hint.
+fn main() {
+ // You can optionally experiment here.
+}
+
#[cfg(test)]
mod tests {
#[test]
diff --git a/exercises/17_tests/tests3.rs b/exercises/17_tests/tests3.rs
index d815e05..a2093cf 100644
--- a/exercises/17_tests/tests3.rs
+++ b/exercises/17_tests/tests3.rs
@@ -11,6 +11,10 @@ pub fn is_even(num: i32) -> bool {
num % 2 == 0
}
+fn main() {
+ // You can optionally experiment here.
+}
+
#[cfg(test)]
mod tests {
use super::*;
diff --git a/exercises/17_tests/tests4.rs b/exercises/17_tests/tests4.rs
index 0972a5b..a50323c 100644
--- a/exercises/17_tests/tests4.rs
+++ b/exercises/17_tests/tests4.rs
@@ -7,7 +7,7 @@
struct Rectangle {
width: i32,
- height: i32
+ height: i32,
}
impl Rectangle {
@@ -16,10 +16,14 @@ impl Rectangle {
if width <= 0 || height <= 0 {
panic!("Rectangle width and height cannot be negative!")
}
- Rectangle {width, height}
+ Rectangle { width, height }
}
}
+fn main() {
+ // You can optionally experiment here.
+}
+
#[cfg(test)]
mod tests {
use super::*;