good first issuehelp wanted
倉庫指標
- 星標
- (4,904 顆星)
- PR 合併指標
- (PR 指標待抓取)
描述
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
DumpMachinetoAssertEqualOnZeroState) - 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 aDumpDiffOnOneInputthat 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 #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_OneQubitand 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!