Skip to content
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

Improve and distribute epsilon-delta test function across exercises #110

Open
4 tasks
sshine opened this issue Oct 15, 2018 · 2 comments
Open
4 tasks

Improve and distribute epsilon-delta test function across exercises #110

sshine opened this issue Oct 15, 2018 · 2 comments

Comments

@sshine
Copy link
Contributor

sshine commented Oct 15, 2018

Before 4c5fd1d, no tests used Expect.nearTo. Since the canonical test data expresses expected values with some unknown imprecision (e.g. 31.69 when the result is 31.68808781), it is up to the language track to make test cases succeed correctly and meaningfully.

Since Standard ML has no standard test framework, we distribute a testlib.sml along with each exercise. The OCaml track uses OUnit2's cmp_float which I've adapted in testlib.sml for the space-age exercise.

This task consists of three parts. Feel free to pick any of these.

Evaluation

Distribution

  • Create a testlib.sml in the root directory that contains Expect.nearTo. This way we can introduce a policy that in order to update testlib.sml, we must also update this reference to it.
  • Copy this testlib.sml to all existing exercises; even though they don't depend on epsilon-delta tests, it is easier to have only one version of testlib.sml.

Assertion

  • Create a CI script that asserts that all testlib.sml in the repository have the same checksum.
@guygastineau
Copy link
Contributor

Oh, hah, I found this discrepancy in the tests from my other work on #206 and #205. I guess I have done everything except for the final step. Maybe I should add a script and CI action to verify the checksums of all testlib.sml files to #206 in order to satisfy this issue entirely.

@guygastineau
Copy link
Contributor

@sshine Do you think our current implementation of nearTo is good enough, or should we use the full example you posted in the linked post? I don't really care enough to scrutinize their differences too much. FWIW, nearTo as it is in the testlib.sml for space age is immediately obvious.

guygastineau added a commit to guygastineau/sml that referenced this issue Jun 14, 2022
I wrote a brief note about keeping testlib.sml in sync for all
exercises in the track, and I mentioned 'make redeploy-testlib' as the
provided tool for handling this requirement.

I did not elaborate on a policy, because we still don't really have
one.  Further work related to exercism#110 should result in a clear policy,
and at that point the README.md might need some more updating.
ErikSchierboom pushed a commit that referenced this issue Jun 20, 2022
* Script to redeploy testlib.sml to all exercises on changes.

The directory name `sml-bin` makes the most sense to me for these sml
"scripts".  Adding them to the makefile also makes it even easier to
use these than it is when using "#! /usr/bin/env -S poly --script" as
a shebang line.  Consequently this should be portable to any Windows
system that has GNU make installed, so it is probably better than the
shebang.  In the code I used the path library to help make things OS
portable, but I haven't ever used SML on Windows, so it is untested
for that enironment.

* Change file perms to 664 for sml-bin/redeploy-testlib.sml

I had set it to 775 when it had a shebang and lived in `bin`.  Trying
to execute it will fail, so it shouldn't be executable.

* Make redeploy-testlib phone as well.

* Use qualified names.

I shouldn't have combined to actions but I did.  I removed all
unnecessary semicolons while refactoring to use qualified names.
Sorry.

* Format redeploy-testlib.sml like teslib.sml

I also found and removed two more unnecessary semicolons.

* Include testlib sync policy in the README.

I wrote a brief note about keeping testlib.sml in sync for all
exercises in the track, and I mentioned 'make redeploy-testlib' as the
provided tool for handling this requirement.

I did not elaborate on a policy, because we still don't really have
one.  Further work related to #110 should result in a clear policy,
and at that point the README.md might need some more updating.

* Formatting, names, parentheses.

* Update README.md

Co-authored-by: Victor Goff <[email protected]>

* Add spaces inside tuples.

* Use scripts directory instead of sml-bin.

* Add a documenting comment to redeploy-testlib.sml.

Initially, I thought it must be clear enough from the title/name of
the script itself, but on further reflection, a documenting comment
might help a non-native english speaker avoid the difficulties of
ambiguity.

Co-authored-by: Victor Goff <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants