Skip to content
New issue

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

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

Already on GitHub? # to your account

Fix doc tests #193

Merged
merged 1 commit into from
Jun 27, 2023
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions .github/workflows/rust.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ jobs:

- name: All integration tests (release)
run: cargo test --release --test "*"

- name: Doc Test
run: cargo test --doc

lints:
name: Lints
Expand Down
3 changes: 2 additions & 1 deletion src/od/simulator/trackdata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ where
/// The Pcg64Mcg is chosen because it is fast, space efficient, and has a good statistical distribution.
///
/// # Errors
/// + A specific measurement is requested but the noise on that measurement type is not configured.
/// + A specific measurement is requested but the noise on that measurement type is not configured.
///
fn measure(
&mut self,
epoch: Epoch,
Expand Down
55 changes: 34 additions & 21 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ fn test_tilde_matrix() {
/// # Example
///
/// ```
/// use nyx_space::utils::is_diagonal;
/// use nyx_space::linalg::Matrix3;
///
/// let m = Matrix3::new(1.0, 0.0, 0.0,
/// 0.0, 2.0, 0.0,
/// 0.0, 0.0, 3.0);
Expand Down Expand Up @@ -117,7 +120,11 @@ pub fn is_diagonal(m: &Matrix3<f64>) -> bool {
/// # Example
///
/// ```
/// let eigenvalues = OVector::from_vec(vec![Complex::new(-1.0, 0.0), Complex::new(0.0, 1.0)]);
/// use nyx_space::utils::are_eigenvalues_stable;
/// use nyx_space::linalg::Vector2;
/// use nalgebra::Complex;
///
/// let eigenvalues = Vector2::new(Complex::new(-1.0, 0.0), Complex::new(0.0, 1.0));
/// assert_eq!(are_eigenvalues_stable(eigenvalues), true);
/// ```
/// # Source
Expand Down Expand Up @@ -227,26 +234,28 @@ pub fn kronecker(a: f64, b: f64) -> f64 {
///
/// # Arguments
///
/// * `angle` - The angle of rotation in radians.
/// * `angle_rad` - The angle of rotation in radians.
///
/// # Warning
///
/// This function returns a matrix for a COORDINATE SYSTEM rotation by `angle` radians.
/// When this matrix is applied to a vector, it rotates the vector by `-angle` radians, not `angle` radians.
/// This function returns a matrix for a COORDINATE SYSTEM rotation by `angle_rad` radians.
/// When this matrix is applied to a vector, it rotates the vector by `-angle_rad` radians, not `angle_rad` radians.
/// Applying the matrix to a vector yields the vector's representation relative to the rotated coordinate system.
///
/// # Example
///
/// ```
/// let angle = std::f64::consts::PI / 2.0;
/// let rotation_matrix = r1(angle);
/// use nyx_space::utils::r1;
///
/// let angle_rad = std::f64::consts::PI / 2.0;
/// let rotation_matrix = r1(angle_rad);
/// ```
///
/// # Source
///
/// [NAIF SPICE Toolkit](https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/eul2xf_c.html)
pub fn r1(angle: f64) -> Matrix3<f64> {
let (s, c) = angle.sin_cos();
pub fn r1(angle_rad: f64) -> Matrix3<f64> {
let (s, c) = angle_rad.sin_cos();
Matrix3::new(1.0, 0.0, 0.0, 0.0, c, s, 0.0, -s, c)
}

Expand Down Expand Up @@ -274,22 +283,24 @@ fn test_r1() {
///
/// # Warning
///
/// This function returns a matrix for a COORDINATE SYSTEM rotation by `angle` radians.
/// When this matrix is applied to a vector, it rotates the vector by `-angle` radians, not `angle` radians.
/// This function returns a matrix for a COORDINATE SYSTEM rotation by `angle_rad` radians.
/// When this matrix is applied to a vector, it rotates the vector by `-angle_rad` radians, not `angle_rad` radians.
/// Applying the matrix to a vector yields the vector's representation relative to the rotated coordinate system.
///
/// # Example
///
/// ```
/// let angle = std::f64::consts::PI / 2.0;
/// let rotation_matrix = r2(angle);
/// use nyx_space::utils::r2;
///
/// let angle_rad = std::f64::consts::PI / 2.0;
/// let rotation_matrix = r2(angle_rad);
/// ```
///
/// # Source
///
/// [NAIF SPICE Toolkit](https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/eul2xf_c.html)
pub fn r2(angle: f64) -> Matrix3<f64> {
let (s, c) = angle.sin_cos();
pub fn r2(angle_rad: f64) -> Matrix3<f64> {
let (s, c) = angle_rad.sin_cos();
Matrix3::new(c, 0.0, -s, 0.0, 1.0, 0.0, s, 0.0, c)
}

Expand All @@ -313,26 +324,28 @@ fn test_r2() {
///
/// # Arguments
///
/// * `angle` - The angle of rotation in radians.
/// * `angle_rad` - The angle of rotation in radians.
///
/// # Warning
///
/// This function returns a matrix for a COORDINATE SYSTEM rotation by `angle` radians.
/// When this matrix is applied to a vector, it rotates the vector by `-angle` radians, not `angle` radians.
/// This function returns a matrix for a COORDINATE SYSTEM rotation by `angle_rad` radians.
/// When this matrix is applied to a vector, it rotates the vector by `-angle_rad` radians, not `angle_rad` radians.
/// Applying the matrix to a vector yields the vector's representation relative to the rotated coordinate system.
///
/// # Example
///
/// ```
/// let angle = std::f64::consts::PI / 2.0;
/// let rotation_matrix = r3(angle);
/// use nyx_space::utils::r3;
///
/// let angle_rad = std::f64::consts::PI / 2.0;
/// let rotation_matrix = r3(angle_rad);
/// ```
///
/// # Source
///
/// [NAIF SPICE Toolkit](https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/eul2xf_c.html)
pub fn r3(angle: f64) -> Matrix3<f64> {
let (s, c) = angle.sin_cos();
pub fn r3(angle_rad: f64) -> Matrix3<f64> {
let (s, c) = angle_rad.sin_cos();
Matrix3::new(c, s, 0.0, -s, c, 0.0, 0.0, 0.0, 1.0)
}

Expand Down