diff --git a/test/Frontend/OpenQASM3/switch-default-only.qasm3 b/test/Frontend/OpenQASM3/switch-default-only.qasm3 new file mode 100644 index 000000000..79fa5a729 --- /dev/null +++ b/test/Frontend/OpenQASM3/switch-default-only.qasm3 @@ -0,0 +1,32 @@ +OPENQASM 3.0; +// RUN: qss-compiler -X=qasm --emit=ast-pretty %s | FileCheck %s --match-full-lines --check-prefix AST-PRETTY +// RUN: qss-compiler -X=qasm --emit=mlir %s --enable-circuits-from-qasm=false| FileCheck %s --match-full-lines --check-prefixes MLIR +// RUN: qss-compiler -X=qasm --emit=mlir %s --enable-circuits-from-qasm | FileCheck %s --match-full-lines --check-prefixes MLIR + +// +// This code is part of Qiskit. +// +// (C) Copyright IBM 2023, 2024. +// +// This code is licensed under the Apache License, Version 2.0 with LLVM +// Exceptions. You may obtain a copy of this license in the LICENSE.txt +// file in the root directory of this source tree. +// +// Any modifications or derivative works of this code must retain this +// copyright notice, and modified files need to carry a notice indicating +// that they have been altered from the originals. + +int i = 15; +qubit $0; +// MLIR: quir.switch %{{.*}}{ +// MLIR-NEXT: }[] +// AST-PRETTY: SwitchStatementNode(SwitchQuantity(name=i, type=ASTTypeIdentifier), +switch (i) { + // AST-PRETTY:statements=[ + // AST-PRETTY:], + // AST-PRETTY:default statement=[ + // AST-PRETTY:]) + default: { + } + break; +}