1#![warn(missing_docs, clippy::pedantic, clippy::all, clippy::nursery)]
2#![allow(clippy::suboptimal_flops)]
3#![doc = include_str!("../README.md")]
4#![no_std]
5
6#[cfg(not(any(feature = "std", feature = "libm")))]
7compile_error!("Either the std or the libm feature is required");
8
9#[cfg(feature = "alloc")]
10extern crate alloc;
11
12#[cfg(feature = "std")]
13extern crate std;
14
15#[cfg(feature = "glam")]
19pub extern crate glam;
20
21mod base;
22pub use base::*;
23
24pub mod f32;
26pub mod f64;
28
29#[cfg(test)]
30mod tests {
31 use super::{NoPathError, PathType, SegmentType, f32, f64};
32
33 #[test]
34 fn size_of_items() {
35 assert_eq!(size_of::<f32::PosRot>(), 12);
36 assert_eq!(size_of::<f64::PosRot>(), 24);
37 assert_eq!(size_of::<f32::DubinsPath>(), 32);
38 assert_eq!(size_of::<f64::DubinsPath>(), 64);
39 assert_eq!(size_of::<PathType>(), 1);
40 assert_eq!(size_of::<SegmentType>(), 1);
41 assert_eq!(size_of::<NoPathError>(), 0);
42 }
43
44 #[test]
45 fn mod2pi_test() {
46 assert!(f32::mod2pi(-f32::from_bits(1)) >= 0.);
47 assert!(f32::mod2pi(core::f32::consts::TAU).abs() < f32::EPSILON);
48 assert!(f64::mod2pi(-f64::from_bits(1)) >= 0.);
49 assert!(f64::mod2pi(core::f64::consts::TAU).abs() < f64::EPSILON);
50 }
51}