microsoft/qdk

Public

mirrored from https://github.com/microsoft/qdkAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v1.8.0

Branches

Tags

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

Clone

HTTPS

Download ZIP

katas/content/marking_oracles/num_div_3/Verification.qs

21lines · modecode

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