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

resistor-color-duo and property tests #867

Closed
sshine opened this issue Oct 14, 2019 · 7 comments
Closed

resistor-color-duo and property tests #867

sshine opened this issue Oct 14, 2019 · 7 comments

Comments

@sshine
Copy link
Contributor

sshine commented Oct 14, 2019

After #865, resistor-color-duo's value :: (Color, Color) -> Int is ideal for property testing.

Some properties that can be tested:

  • value (Black, x) < 10 for all x
  • value (x, y) >= 10 for all x except Black and all y
  • show (value (x, y)) == reverse (show (value (y, x))) for all x, y except Black.
  • (Color, Color) is isomorphic to [0..99] (or: all colors have a unique value).
  • Associativity: Kind of tricky because you can't get the value of a single Color:
    value (k, x) <= value (k, y) && value (k, y) <= value (k, z)
      ⇒ value (k, x) <= value (k, z)
    
    value (x, k) <= value (y, k) && value (y, k) <= value (z, k)
      ⇒ value (k, x) <= value (k, z)
    

Considering how simple this exercise is, adding all these property tests with the purpose to aid students is slightly overkill. (It could use a few more unit tests for basic coverage, though.)

So I thought: Why not encourage property testing in .meta/hints.md?

In the style of #843, add one or two property tests and encourage others.

A pull request that proposes this awaits for #865 to merge.

@chiroptical
Copy link
Contributor

So I thought: Why not encourage property testing in .meta/hints.md?

Basically, you want to show the student how to write a QuickCheck property test and then suggest a few properties to test? (with links to documentation etc?)

@sshine
Copy link
Contributor Author

sshine commented Oct 26, 2019

Yes, that was my thought.

@sshine
Copy link
Contributor Author

sshine commented Nov 18, 2019

@barrymoo: If you'd like, #865 has now been merged and this issue is ready to be worked on.

@chiroptical
Copy link
Contributor

@sshine I was going to work on this today, but I noticed the Hints section is no longer displayed on the exercism website? Cases where we have implemented the Data.Text library aren't mentioned.

@sshine
Copy link
Contributor Author

sshine commented Dec 8, 2019

@barrymoo: Thank you for noticing!

@iHiD: Can you explain why #865, which was merged a month ago, which adds a hint to the README and updates test/Tests.hs, does not get updated on the website? Is this a bug, or is there a precondition that I'm not aware of?

@iHiD
Copy link
Member

iHiD commented Dec 10, 2019

Hello. It's there for me when I go to the track anew and check. Maybe you're versions of the exercise are out of date? Do you see the button to click to update it?

Screenshot 2019-12-10 at 11 38 52

@chiroptical
Copy link
Contributor

@iHiD Updating worked for me. I am hoping to work on this soon!

tejasbubane added a commit to tejasbubane/haskell that referenced this issue Apr 18, 2020
tejasbubane added a commit to tejasbubane/haskell that referenced this issue Apr 18, 2020
tejasbubane added a commit to tejasbubane/haskell that referenced this issue Apr 19, 2020
@sshine sshine closed this as completed in 02b0582 Nov 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants