qsharp-runtime icon indicating copy to clipboard operation
qsharp-runtime copied to clipboard

Allow defining simulator parameters in Q# @Test attribute

Open tcNickolas opened this issue 2 years ago • 0 comments

Please describe what you would like the feature to accomplish.
I'd like to be able to configure simulator parameters when specifying the simulator to use via @Test attribute, similarly to how we can do it when creating a simulator by hand in C# driver. This would allow me to do things like setting a fixed seed for randomized tests in the Katas to make their results reproducible.

Describe the solution you'd like
I don't have a particular syntax in mind. For example, we could add a new @SimulatorParameter attribute to specify simulator parameters by name:

@Test("QuantumSimulator")
@SimulatorParameter("randomNumberGeneratorSeed", "42")
@SimulatorParameter("disableBorrowing", "true")
operation RandmizedTest() : Unit { ... }

Describe alternatives you've considered
I could revert to defining tests in C# with the simulator created manually, but this makes the code a lot less elegant and maintainable.

tcNickolas avatar Feb 18 '22 19:02 tcNickolas