Skip to content

Commit

Permalink
WIP tests (broken)
Browse files Browse the repository at this point in the history
  • Loading branch information
spectria-limina committed Feb 15, 2024
1 parent 9240e7e commit 668137d
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions crates/bevy_math/src/primitives/dim2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,51 @@ impl CircularSegment {
}
}

#[cfg(test)]
mod arc_tests {
use super::*;

struct TestCase {
constructor: fn() -> Arc2d,
radius: f32,
half_angle: f32,
angle: f32,
length: f32,
circle_center: Vec2,
right_endpoint: f32,
left_endpoint: f32,
endpoints: [f32; 2],
midpoint: Vec2,
half_chord_length: f32,
chord_lenfth: f32,
chord_midpoint: Vec2,
apothem: f32,
sagitta: f32,
is_minor: bool,
is_major: bool,
}

static ZERO_ANGLE: TestCase = TestCase {
constructor: || Arc2d::new(1.0, 0.0),
radius: 1.0,
half_angle: 0.0,
angle: 0.0,
length: 0.0,
circle_center: Vec2::ORIGIN,
right_endpoint: Vec2::Y,
right_endpoint: Vec2::Y,
endpoints: [Vec2::Y, Vec2::Y],
midpoint: Vec2::Y,
half_chord_length: 0.0,
chord_lenfth: 0.0,
chord_midpoint: Vec2::Y,
apothem: 1.0,
sagitta: 0.0,
is_minor: true,
is_major: false,
};
}

/// An ellipse primitive
#[derive(Clone, Copy, Debug, PartialEq)]
#[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
Expand Down

0 comments on commit 668137d

Please sign in to comment.