microsoft/qdk
Publicmirrored fromhttps://github.com/microsoft/qdkAvailable
katas/content/marking_oracles/contains_substring_p/Verification.qs
21lines · modecode
| 1 | namespace Kata.Verification { |
| 2 | open Microsoft.Quantum.Katas; |
| 3 | |
| 4 | @EntryPoint() |
| 5 | operation CheckSolution() : Bool { |
| 6 | for (n, p, r) in [ |
| 7 | (2, 1, [true]), |
| 8 | (3, 0, [false, true]), |
| 9 | (4, 1, [true, true, false]), |
| 10 | (5, 3, [false]) |
| 11 | ] { |
| 12 | if not CheckOracleImplementsFunction(n, Kata.Oracle_ContainsSubstringAtPosition(_, _, r, p), F_ContainsSubstringAtPosition(_, r, p)) { |
| 13 | Message($"Test failed for n = {n}, p = {p}, r = {r}"); |
| 14 | return false; |
| 15 | } |
| 16 | } |
| 17 | |
| 18 | Message("Correct!"); |
| 19 | true |
| 20 | } |
| 21 | } |
| 22 | |