microsoft/qdk

Public

mirrored fromhttps://github.com/microsoft/qdkAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
alex/pythontelem

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

katas/content/marking_oracles/kth_bit/Verification.qs

22lines · modecode

1namespace Kata.Verification {
2 open Microsoft.Quantum.Katas;
3
4 function F_Kth_Bit(x : Bool[], k : Int) : Bool {
5 x[k]
6 }
7
8 @EntryPoint()
9 operation CheckSolution() : Bool {
10 for n in 3 .. 5 {
11 for k in 0 .. n - 1 {
12 if not CheckOracleImplementsFunction(n, Kata.Oracle_Kth_Bit(_, _, k), F_Kth_Bit(_, k)) {
13 Message($"Test failed for n = {n}, k = {k}");
14 return false;
15 }
16 }
17 }
18
19 Message("Correct!");
20 true
21 }
22}
23