microsoft/qdk
Publicmirrored from https://github.com/microsoft/qdkAvailable
katas/content/marking_oracles/num_div_3/Verification.qs
21lines · modecode
| 1 | namespace Kata.Verification { |
| 2 | import KatasUtils.*; |
| 3 | import Std.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 | |