summaryrefslogtreecommitdiff
path: root/exercises
diff options
context:
space:
mode:
authorliv <liv@fastmail.com>2019-02-15 12:06:05 +0100
committerliv <liv@fastmail.com>2019-02-15 12:06:05 +0100
commit02ceb0ba8c0f82cefaaa531aec06c12dc0400525 (patch)
treea1150109d27905fc3f397fbf348d192fab7cfb62 /exercises
parent17fa037a164134f7b8da097aec8d795f8549b236 (diff)
fix test command execution
seems like i forgot that you actually need to run executables created with `rustc --test`! this also reworks the "test1" exercise a bit closes #108
Diffstat (limited to 'exercises')
-rw-r--r--exercises/test1.rs17
1 files changed, 9 insertions, 8 deletions
diff --git a/exercises/test1.rs b/exercises/test1.rs
index f52513d..a477818 100644
--- a/exercises/test1.rs
+++ b/exercises/test1.rs
@@ -5,16 +5,17 @@
// Mary is buying apples. One apple usually costs 2 dollars, but if you buy
// more than 40 at once, each apple only costs 1! Write a function that calculates
-// the price of an order of apples given the order amount.
+// the price of an order of apples given the order amount. No hints this time!
-fn main() {
+// Put your function here!
+// fn ..... {
+
+// Don't modify this function!
+#[test]
+fn verify_test() {
let price1 = calculateprice(55);
let price2 = calculateprice(40);
- // Don't modify this!
- if price1 == 55 && price2 == 80 {
- println!("Good job!");
- } else {
- panic!("Uh oh! Wrong price!");
- }
+ assert_eq!(price1, 55);
+ assert_eq!(price2, 80);
}