From e9e46c37c5c3b6c192d21c3c503957a2492e02e6 Mon Sep 17 00:00:00 2001 From: Jake Selig Date: Wed, 29 Nov 2023 09:55:17 -0700 Subject: [PATCH] chore: add tests to reproduce compilation failure --- crates/lib/src/compiler/libquil.rs | 17 +++++++++++++++++ crates/lib/src/compiler/quilc.rs | 17 +++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/crates/lib/src/compiler/libquil.rs b/crates/lib/src/compiler/libquil.rs index f6b3f90db..3f00ca787 100644 --- a/crates/lib/src/compiler/libquil.rs +++ b/crates/lib/src/compiler/libquil.rs @@ -344,4 +344,21 @@ MEASURE 1 ro[1] } ); } + + #[tokio::test] + async fn test_parametric_compilation() { + let client = quilc_client(); + let isa = TargetDevice::try_from(aspen_9_isa()) + .expect("aspen-9 compiler isa should become TargetDevice"); + const PARAMETRIC_PROGRAM: &str = r#" +PRAGMA INITIAL_REWIRING "PARTIAL" +DECLARE ro BIT +DECLARE theta REAL +RX(theta) 0 +MEASURE 0 ro +"#; + client + .compile_program(PARAMETRIC_PROGRAM, isa, CompilerOpts::new()) + .expect("program should compile"); + } } diff --git a/crates/lib/src/compiler/quilc.rs b/crates/lib/src/compiler/quilc.rs index d6a03ff42..c5d3588fb 100644 --- a/crates/lib/src/compiler/quilc.rs +++ b/crates/lib/src/compiler/quilc.rs @@ -490,4 +490,21 @@ MEASURE 1 ro[1] } ); } + + #[tokio::test] + async fn test_parametric_compilation() { + let client = rpcq_client().await; + let isa = TargetDevice::try_from(aspen_9_isa()) + .expect("aspen-9 compiler isa should become TargetDevice"); + const PARAMETRIC_PROGRAM: &str = r#" +PRAGMA INITIAL_REWIRING "PARTIAL" +DECLARE ro BIT +DECLARE theta REAL +RX(theta) 0 +MEASURE 0 ro +"#; + client + .compile_program(PARAMETRIC_PROGRAM, isa, CompilerOpts::new()) + .expect("program should compile"); + } }