summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbdou Seck <djily02016@gmail.com>2020-12-12 13:45:37 -0500
committerAbdou Seck <djily02016@gmail.com>2021-01-08 13:21:00 -0500
commit0b9220c1fc5ae32438f64bf2f5bf5f47d33e3f3f (patch)
treee31119feb6049af7c0ba276837396c404a7eb3e3
parent0d65753fdb41be12310bec970123911aaee76235 (diff)
Add looks_done method to Exercise to expose a resolution state
-rw-r--r--src/exercise.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/exercise.rs b/src/exercise.rs
index 283b2b9..7afa230 100644
--- a/src/exercise.rs
+++ b/src/exercise.rs
@@ -232,6 +232,16 @@ path = "{}.rs""#,
State::Pending(context)
}
+
+ // Check that the exercise looks to be solved using self.state()
+ // This is not the best way to check since
+ // the user can just remove the "I AM NOT DONE" string fromm the file
+ // without actually having solved anything.
+ // The only other way to truly check this would to compile and run
+ // the exercise; which would be both costly and counterintuitive
+ pub fn looks_done(&self) -> bool {
+ self.state() == State::Done
+ }
}
impl Display for Exercise {