Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix broken ConstAngle::TAU #609

Merged
merged 2 commits into from
Sep 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion tket2/src/extension/angle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ impl ConstAngle {
/// The constant π
pub const PI: Self = Self::new_unchecked(1, 1);
/// The constant 2π
pub const TAU: Self = Self::new_unchecked(0, 1);
pub const TAU: Self = Self::new_unchecked(0, 0);
/// The constant π/2
pub const PI_2: Self = Self::new_unchecked(2, 1);
/// The constant π/4
Expand Down Expand Up @@ -411,4 +411,12 @@ mod test {

let _hugr = builder.finish_hugr_with_outputs([bool], &REGISTRY).unwrap();
}

#[rstest::rstest]
fn const_angle_statics(
#[values(ConstAngle::TAU, ConstAngle::PI, ConstAngle::PI_2, ConstAngle::PI_4)]
konst: ConstAngle,
) {
assert_eq!(ConstAngle::new(konst.log_denom(), konst.value()), Ok(konst));
}
}
Loading