Skip to content
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
5 changes: 4 additions & 1 deletion .github/workflows/ci-full-test-suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ jobs:
key: ${{ runner.os }}-${{ steps.install-rust.outputs.cachekey }}

- name: Test all crates
run: cargo test --all --verbose --features "use_serde"
run: cargo test --workspace --all-targets --verbose --features "use_serde"

- name: Test documentation
run: cargo test --workspace --doc --verbose --features "use_serde"

- name: Test si
run: cargo test --verbose --no-default-features --features "f32 si"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-min-test-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ jobs:
toolchain: ${{ matrix.toolchain }}

- name: Test all crates
run: cargo test --all --verbose --features "use_serde"
run: cargo test --workspace --verbose --features "use_serde"
4 changes: 2 additions & 2 deletions .github/workflows/ci-tool-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ jobs:
key: tools-${{ runner.os }}-${{ steps.install-rust.outputs.cachekey }}

- name: Clippy
run: cargo clippy --all --tests -- -D warnings
run: cargo clippy --workspace --all-targets -- -D warnings

- name: Rustfmt
run: cargo fmt --all -- --check

- name: Rustdoc
run: cargo doc --all --no-deps
run: cargo doc --workspace --lib --bins --examples --no-deps
env:
RUSTDOCFLAGS: '-D warnings'

Expand Down
4 changes: 2 additions & 2 deletions src/quantity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,9 @@ macro_rules! quantity {
where
V: $crate::Conversion<V>,
{
test! {
/// Check unit validity to ensure the unit is valid for the underlying storage type.
#[cfg(test)]
fn is_valid() -> bool;
fn is_valid() -> bool;}
}

unit_units! {
Expand Down
20 changes: 10 additions & 10 deletions src/si/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,16 +173,16 @@ mod tests {
let s = ((*v).clone() - r.clone()).to_u64();
let n = (r * (V::one() / &ns)).to_u32();

return match (s, n) {
(Some(s), Some(n)) => TestResult::from_bool(
match (Time::try_from(Duration::new(s, n)), V::from_u64(s), V::from_u32(n)) {
(Ok(t), Some(s), Some(n)) => t == Time::new::<second>(s) + Time::new::<nanosecond>(n),
(Err(TryFromError::Overflow), None, _) => true,
(Err(TryFromError::Overflow), _, None) => true,
_ => false,
}),
_ => TestResult::discard(),
}
match (s, n) {
(Some(s), Some(n)) => TestResult::from_bool(
match (Time::try_from(Duration::new(s, n)), V::from_u64(s), V::from_u32(n)) {
(Ok(t), Some(s), Some(n)) => t == Time::new::<second>(s) + Time::new::<nanosecond>(n),
(Err(TryFromError::Overflow), None, _) => true,
(Err(TryFromError::Overflow), _, None) => true,
_ => false,
}),
_ => TestResult::discard(),
}
}
}
}
Expand Down
26 changes: 13 additions & 13 deletions src/unit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ macro_rules! unit_units {
}

impl super::Conversion<V> for super::$unit {
#[cfg(test)]
test! {
#[inline(always)]
#[allow(clippy::eq_op)]
#[allow(clippy::approx_constant)]
Expand All @@ -177,7 +177,7 @@ macro_rules! unit_units {
let c = <Self as $crate::Conversion<V>>::coefficient().to_f64();

r == c
}
}}
})+
}

Expand Down Expand Up @@ -208,7 +208,7 @@ macro_rules! unit_units {
}

impl super::Conversion<V> for super::$unit {
#[cfg(test)]
test! {
#[inline(always)]
#[allow(clippy::eq_op)]
#[allow(clippy::approx_constant)]
Expand All @@ -223,14 +223,14 @@ macro_rules! unit_units {
let r = $coefficient;
let c = numer / denom;

return r == c
return r == c;
}
}
}
}

false
}
}}
})+
}

Expand Down Expand Up @@ -266,7 +266,7 @@ macro_rules! unit_units {
}

impl super::Conversion<V> for super::$unit {
#[cfg(test)]
test! {
#[inline(always)]
#[allow(clippy::eq_op)]
#[allow(clippy::approx_constant)]
Expand All @@ -280,14 +280,14 @@ macro_rules! unit_units {
let r = $coefficient;
let c = numer / denom;

return r == c
return r == c;
}
}
}
}

false
}
}}
})+
}

Expand Down Expand Up @@ -317,7 +317,7 @@ macro_rules! unit_units {
}

impl super::Conversion<V> for super::$unit {
#[cfg(test)]
test! {
#[inline(always)]
#[allow(clippy::eq_op)]
#[allow(clippy::approx_constant)]
Expand All @@ -332,14 +332,14 @@ macro_rules! unit_units {
let r = $coefficient;
let c = numer / denom;

return r == c
return r == c;
}
}
}
}

false
}
}}
})+
}

Expand All @@ -364,7 +364,7 @@ macro_rules! unit_units {
}

impl super::Conversion<V> for super::$unit {
#[cfg(test)]
test! {
#[inline(always)]
#[allow(clippy::eq_op)]
#[allow(clippy::approx_constant)]
Expand All @@ -375,7 +375,7 @@ macro_rules! unit_units {
let c = <Self as $crate::Conversion<V>>::coefficient().to_f64();

r == c
}
}}
})+
}
};
Expand Down