This repository was archived by the owner on Aug 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
This repository was archived by the owner on Aug 21, 2024. It is now read-only.
Improve error messaging for the katas that allow it #176
Copy link
Copy link
Open
Labels
good first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is needed
Description
Several katas could have better error messaging:
- Superposition : the test harness could log the actual state of the system after prep vs the expected state before asserting that they are the same (the change would add state prep and logging using
DumpMachine
toAssertEqualOnZeroState
) - BasicGates : a similar improvement, but a bit more extra code to write a unified test wrapper (since all tests in it just use
AssertOperationsEqualReferenced
). Since the actual test compares the unitaries, we might want to add aDumpDiffOnOneInput
that would:- prepare some nice state like 0.8 |0⟩ + 0.6 |1⟩,
- apply the reference solution on it,
- dump the state to get expected state,
- repeat the sequence for the user's solution.
- the overall output should look similar to the style used in Superposition kata (as done in Improve error messaging for Superposition. #214)
- Measurements : the test harness already reports the number of incorrect classifications; in addition, it can print the states which were misclassified in human-readable format, taking an array of string representations of states as an extra parameter to operations like
DistinguishTwoStates_OneQubit
and logging the mismatches. We'd have to be careful not to log 50 lines of mismatches, though... Maybe keep track of different kinds of mismatches and report aggregates in the end of the test (e.g., "Classified |0⟩ as |1⟩ 15 times, classified |1⟩ as |0⟩ 21 times")? - JointMeasurements : same as in Measurements
- DeutschJozsaAlgorithm
- SolveSATWithGrover
- and GraphColoring : use logging approach similar to RippleCarryAdder to produce more readable results for testing oracles on basis states (so that the solver knows which input state is processed incorrectly, not just that there is an error).
There are probably other katas that allow similar improvements - please share the ideas in the comments!
Metadata
Metadata
Assignees
Labels
good first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is needed