-
Notifications
You must be signed in to change notification settings - Fork 190
Ch6 add exercise tests #78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
logShow $ hash 123 | ||
logShow (hash true) | ||
logShow (hash [1, 2, 3]) | ||
logShow (hash "testing") | ||
logShow (hash 'a') | ||
logShow ("foo" `hashEqual` "foo") | ||
logShow ("foo" `hashEqual` "bar") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These used to live in test/Main.purs
, but relocating them here, since the original location seems best for exercise tests.
@@ -0,0 +1,49 @@ | |||
module Test.Solutions where |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Specifying the file for solutions will enable easier comparison of solutions, similar to what's available in exercism.io
newtype Complex | ||
= Complex | ||
{ real :: Number | ||
, imaginary :: Number | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file contains code snippets directly from the chapter text for users to complete.
$ Assert.equal "1.0+2.0i" | ||
$ show | ||
$ Complex { real: 1.0, imaginary: 2.0 } | ||
{- Move this block comment starting point to enable more tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Readers can drag this line down to enable more tests as they tackle each exercise.
@milesfrain I'm starting my study of chapter 6. I've cloned and checked out your branch; will be testing over the next couple of days. |
I didn't add any testing instructions to the chapter text, but here's a quick summary of what to do: Just skip the first "Show Shape" exercise. This makes more sense to run as part of chapter 5 where all the other related code lives. When you get to the "Show instance for Complex" exercise in the second group, run Open Once that test passes, you can work on the next exercise, and move the block-comment starting point down a few lines in |
I thought the |
After a short learning curve, am successfully running through the Ch 6
learning using test-driven development and your instructions above.
I LOVE IT!!!
Purescript has a very clean testing framework, much more straightforward
than Elm. And it's so much easier than testing in a dynamic environment
like Ruby because of the "pure" code approach.
Truly a pleasure.
Now, your instructions above I believe are very helpful. Where are you
going to introduce them in the book?
…On Wed, Apr 15, 2020 at 5:35 PM milesfrain ***@***.***> wrote:
I didn't add any testing instructions to the chapter text, but here's a
quick summary of what to do:
Just skip the first "Show Shape" exercise. This makes more sense to run as
part of chapter 5 where all the other related code lives.
When you get to the "Show instance for Complex" exercise in the second
group, run spago test. It should fail because you haven't completed the
exercise yet.
Open test/Solutions.purs and complete the exercise by creating a Show
instance for Complex. Then run spago test again and it should pass. The
test will be a bit strict about the specific format of how these complex
numbers are printed, and you can look at test/Main.purs to figure out the
format that will work.
Once that test passes, you can work on the next exercise, and move the
block-comment starting point down a few lines in test/Main.purs to
include the tests for the next exercise.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#78 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAARH5DVSWDBOFDMJKJO76TRMZHFHANCNFSM4MHJZEVQ>
.
--
Scott Smith
http://twitter.com/_ofd (OldFartDeveloper)
|
Going to add the more long-winded testing instructions posted in #79 to either chapter 1 or 2 (with examples targeted to those specific chapters). Those chapters also need a bit of rework as described in #93. Also linking to this PR as a reminder to revisit test group numbering and testing exercises relating to previous chapters: milesfrain#1 |
Solutions here for reference.
No peaking at the solutions before you attempt the exercises!