-// After all this nit-picking about I/O details, let me show you quickly something unrelated,
-// but really nice: Rust's built-in support for testing.
-// Now that the user can run our program on loads of inputs, we better make sure that it is correct.
-// To be able to test the result of `vec_min`, we first have to write a function that
-// is able to test equality if `SimethingOrNothing`. So let's quickly do that.
-
-// `equals` performs pattern-matching on both `self` and `other` to test the two for being
-// equal. Because we are lazy, we want to write only one `match`. so we group the two into a
-// pair such that we can match on both of them at once. You can read the first arm of the match
-// as testing whether `(self, other)` is `(Nothing, Nothing)`, which is the case exactly if
-// both `self` and `other` are `Nothing`. Similar so for the second arm.
-impl SomethingOrNothing<i32> {
- pub fn equals(self, other: Self) -> bool {
- match (self, other) {
- (Nothing , Nothing ) => true,
- (Something(n), Something(m)) => n == m,
- // `_` is the syntax for "I don't care", so this is how you add a default case to your `match`.
- _ => false,
- }
- }
-}
-
-// Now we are almost done! Writing a test in Rust is shockingly simple. Just write a function
-// that takes no arguments as returns nothing, and add `#[test]` right in front of it.
-// That's called an *attribute*, and the `test` attribute, well, declares the function to
-// be a test.
-
-// Within the function, we can then use `panic!` to indicate test failure. Helpfully, there's
-// a macro `assert!` that panics if its argument becomes `false`.
-// Using `assert!` and our brand-new `equals`, we can now call `vec_min` with some lists
-// and make sure it returns The Right Thing.
-#[test]
-fn test_vec_min() {
- assert!(vec_min(vec![6,325,33,532,5,7]).equals(Something(5)));
- assert!(vec_min(vec![6,325,33,532]).equals(Something(6)));
-}
-// To execute the test, run `cargo test`. It should tell you that everything is all right.
-// Now that was simple, wasn't it?
-//
-// **Exercise**: Add a case to `test_vec_min` that checks the behavior on empty lists.
+// **Exercise**: Define a trait `Print` to write a generic version of `SomethingOrNothing::print`.
+// Implement that trait for `i32`, and change the code above to use it.
+// I will again provide a skeleton for this solution. It also shows how to attach bounds to generic
+// implementations (just compare it to the `impl` block from the previous exercise).
+// You can read this as "For all types `T` satisfying the `Print` trait, I provide an implementation
+// for `SomethingOrNothing<T>`".