nick8325 / nick8325/quickcheck

`coverTable` is silent if key isn't `tabulate`d

Open
#254 8 comments 0 reactions 0 assignees View on GitHub

A pull request for this has already been merged.

  • #391 by @MaximilianAlgehed — merged
discussion
Dominant language
Haskell
Stars
790
Forks
130
Avg merge
16h 41m
Merged PRs (30d)
2

Description

When used as intended, coverTable gives a coverage warning:

> quickCheck $ coverTable "A" [("B", 10)] $ tabulate "A" ["A"] ()
+++ OK, passed 1 test.

A (1 in total):
100% A

Table 'A' had only 0% B, but expected 10%

If one messes up and accidentally uses the wrong key, say "C" instead of "A", when calling coverTable it silently succeeds:

> quickCheck $ coverTable "C" [("B", 10)] $ tabulate "A" ["A"] ()
+++ OK, passed 1 test.

A (1 in total):
100% A

It would be nice to have a warning in this case?

(In my actual use case I abuse the keys of tabulate to be from-states and the values to be to-states in a finite state automata.)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the coverTable and tabulate entry points and inspect the discussion and linked pull request #391. Confirm how a missing table key is handled, then ensure the incorrect-key case produces a warning and that the existing intended-use behavior remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.