Skip to content

Commit

Permalink
test: Add failing test case for #1315 (#1316)
Browse files Browse the repository at this point in the history
Co-authored-by: Alec Edgington <54802828+cqc-alec@users.noreply.github.com>
  • Loading branch information
doug-q and cqc-alec authored Jul 16, 2024
1 parent a6a9b74 commit 6f8dac2
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion hugr-core/src/ops/custom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,13 @@ pub enum CustomOpError {

#[cfg(test)]
mod test {
use crate::extension::prelude::{QB_T, USIZE_T};
use crate::{
extension::prelude::{BOOL_T, QB_T, USIZE_T},
std_extensions::arithmetic::{
int_ops::{self, INT_OPS_REGISTRY},
int_types::INT_TYPES,
},
};

use super::*;

Expand All @@ -451,4 +457,23 @@ mod test {
assert!(op.is_opaque());
assert!(!op.is_extension_op());
}

#[test]
#[should_panic] // https://github.com/CQCL/hugr/issues/1315
fn resolve_opaque_op() {
let registry = &INT_OPS_REGISTRY;
let i0 = &INT_TYPES[0];
let opaque = OpaqueOp::new(
int_ops::EXTENSION_ID,
"itobool",
"description".into(),
vec![],
FunctionType::new(i0.clone(), BOOL_T),
);
let resolved =
super::resolve_opaque_op(Node::from(portgraph::NodeIndex::new(1)), &opaque, registry)
.unwrap()
.unwrap();
assert_eq!(resolved.def().name(), "itobool");
}
}

0 comments on commit 6f8dac2

Please sign in to comment.