Skip to content

Commit

Permalink
Add a test for previous commit.
Browse files Browse the repository at this point in the history
I said I would not, but here it is.
  • Loading branch information
jlapeyre committed Jan 20, 2024
1 parent f6c93b8 commit 4eb5fc1
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion crates/oq3_semantics/tests/from_string_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,10 +266,31 @@ fn test_from_string_assign_indexed() {
qubit q;
bit[2] c;
c[0] = measure q;
bit k;
k = measure q;
"#;
let (program, errors, _symbol_table) = parse_string(code);
let assignment = match &program[2] {
asg::Stmt::Assignment(assignment) => assignment,
_ => unreachable!(),
};
assignment.rvalue().expression();
matches!(
assignment.rvalue().expression(),
asg::Expr::MeasureExpression(_)
);

let assignment = match &program[4] {
asg::Stmt::Assignment(assignment) => assignment,
_ => unreachable!(),
};
assignment.rvalue().expression();
matches!(
assignment.rvalue().expression(),
asg::Expr::MeasureExpression(_)
);
assert!(errors.is_empty());
assert_eq!(program.len(), 3);
assert_eq!(program.len(), 5);
}

#[test]
Expand Down

0 comments on commit 4eb5fc1

Please sign in to comment.