Problem 1.1 - New test helper and tests for problem 1.1
DISCLAIMER: This is my first time in a while forking and making a PR.
I recently came across this repo and I am willing to contribute the best I can.
This PR aims to solve 2 problems:
- The ability to craft your algorithm and run it against some test cases
For example, if you open up any of the problems in the repo, like this one, you will accidentally see the solution. There should be a separate place where people can JUST attempt the problems after they have read the problem from the book.
This way, we can still offer a set of test cases which users can test against, while still abiding by Gayle's order that is:
do not contain the actual questions
- A nice way to see how your solution performed

The caveats to merging:
This is a small PR but a big feature. This would require:
- Adding a playground (
index.js) across all the problems in all the chapters - Rewriting the current
console.logtests to instead to have the newtest()test - Possibly crafting new assertion methods depending on the specifications of the algorithm
Please comment, edit or provide criticism to the PR. But in general, I think the playground is a feature we should be going for!
Looks good so far, let me review it some time later in the week. Thanks for the PR! 🎉
Let me know if there any comments or concerns or any way I can improve!
Okay, let me rethink and come back. Thank you @profnandaa.
In addition, just so we are on the same page, it's not just as simple as replacing console.log with the test keyword, since test helper takes a callback.
For some of them, it can be very easily translatable... For example:

Again, this is mainly just aesthetics and better testing. The console.log and test can coexist, so we don't have to pick and choose just ONE.
Do you want me to go ahead and make the description/title of the test optional?
I was thinking of something like:
test(fn(params), expectedResults);
Then abstract all the nice stuff under test(), perhaps including up to the line number where the test is failing?