Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

Commit 2f9c6f2

Browse files
Simulator Classical Control Execution Tests (#297)
Added execution test projects for various simulators. Added tests to check measurements on qubits work. Added tests for conditions on measurement results.
1 parent d160a88 commit 2f9c6f2

15 files changed

+2863
-456
lines changed

Simulation.sln

Lines changed: 496 additions & 439 deletions
Large diffs are not rendered by default.

src/Simulation/Simulators.Tests/TestProjects/HoneywellExe/ClassicallyControlledSupportTests.qs

Lines changed: 746 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<Project Sdk="Microsoft.Quantum.Sdk/0.11.2006.3017-alpha">
2+
3+
<PropertyGroup>
4+
<OutputType>Library</OutputType>
5+
<TargetFramework>netcoreapp3.1</TargetFramework>
6+
<!-- we will provide our own -->
7+
<CsharpGeneration>false</CsharpGeneration>
8+
<IncludeQsharpCorePackages>false</IncludeQsharpCorePackages>
9+
<IncludeProviderPackages>false</IncludeProviderPackages>
10+
<NoEntryPoint>true</NoEntryPoint>
11+
<ExecutionTarget>honeywell.qpu</ExecutionTarget>
12+
</PropertyGroup>
13+
14+
<ItemGroup>
15+
<ProjectReference Include="..\..\..\CsharpGeneration\Microsoft.Quantum.CsharpGeneration.fsproj" PrivateAssets="All" IsQscReference="true" />
16+
<ProjectReference Include="..\..\..\QsharpCore\Microsoft.Quantum.QSharp.Core.csproj" />
17+
</ItemGroup>
18+
19+
<Target Name="BeforeCsharpCompile">
20+
<ItemGroup>
21+
<Compile Include="$(GeneratedFilesOutputPath)**/*.g.cs" Exclude="@(Compile)" AutoGen="true" />
22+
</ItemGroup>
23+
</Target>
24+
25+
</Project>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Copyright (c) Microsoft Corporation.
2+
// Licensed under the MIT License.
3+
4+
5+
namespace Microsoft.Quantum.Simulation.Testing.Honeywell.MeasurementSupportTests {
6+
7+
open Microsoft.Quantum.Intrinsic;
8+
9+
operation MeasureInMiddle() : Unit {
10+
using (qs = Qubit[2]) {
11+
H(qs[0]);
12+
let r1 = M(qs[0]);
13+
H(qs[1]);
14+
let r2 = M(qs[1]);
15+
Reset(qs[0]);
16+
Reset(qs[1]);
17+
}
18+
}
19+
20+
operation QubitAfterMeasurement() : Unit {
21+
using (q = Qubit()) {
22+
H(q);
23+
let r1 = M(q);
24+
H(q);
25+
let r2 = M(q);
26+
Reset(q);
27+
}
28+
}
29+
30+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<Project Sdk="Microsoft.Quantum.Sdk/0.11.2006.3017-alpha">
2+
3+
<PropertyGroup>
4+
<OutputType>Library</OutputType>
5+
<TargetFramework>netcoreapp3.1</TargetFramework>
6+
<!-- we will provide our own -->
7+
<CsharpGeneration>false</CsharpGeneration>
8+
<IncludeQsharpCorePackages>false</IncludeQsharpCorePackages>
9+
<IncludeProviderPackages>false</IncludeProviderPackages>
10+
<NoEntryPoint>true</NoEntryPoint>
11+
<ExecutionTarget>ionq.qpu</ExecutionTarget>
12+
</PropertyGroup>
13+
14+
<ItemGroup>
15+
<ProjectReference Include="..\..\..\CsharpGeneration\Microsoft.Quantum.CsharpGeneration.fsproj" PrivateAssets="All" IsQscReference="true" />
16+
<ProjectReference Include="..\..\..\QsharpCore\Microsoft.Quantum.QSharp.Core.csproj" />
17+
</ItemGroup>
18+
19+
<Target Name="BeforeCsharpCompile">
20+
<ItemGroup>
21+
<Compile Include="$(GeneratedFilesOutputPath)**/*.g.cs" Exclude="@(Compile)" AutoGen="true" />
22+
</ItemGroup>
23+
</Target>
24+
25+
</Project>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Copyright (c) Microsoft Corporation.
2+
// Licensed under the MIT License.
3+
4+
5+
namespace Microsoft.Quantum.Simulation.Testing.IonQ.MeasurementSupportTests {
6+
7+
open Microsoft.Quantum.Intrinsic;
8+
9+
operation MeasureInMiddle() : Unit {
10+
using (qs = Qubit[2]) {
11+
H(qs[0]);
12+
let r1 = M(qs[0]);
13+
H(qs[1]);
14+
let r2 = M(qs[1]);
15+
Reset(qs[0]);
16+
Reset(qs[1]);
17+
}
18+
}
19+
20+
operation QubitAfterMeasurement() : Unit {
21+
using (q = Qubit()) {
22+
H(q);
23+
let r1 = M(q);
24+
H(q);
25+
let r2 = M(q);
26+
Reset(q);
27+
}
28+
}
29+
30+
}

0 commit comments

Comments
 (0)