diff --git a/.build.yml b/.build.yml index 6c1f59b..4f51403 100644 --- a/.build.yml +++ b/.build.yml @@ -8,19 +8,32 @@ tasks: rustup toolchain install nightly stable cd vivaldi-nc/ rustup run stable cargo fetch - - stable: | + - format: | rustup default stable cd vivaldi-nc/ cargo fmt --verbose --check + - lint: | + rustup default stable + cd vivaldi-nc/ cargo clippy --verbose + - stable: | + rustup default stable + cd vivaldi-nc/ cargo build --verbose - cargo test --verbose + cargo test --verbose --no-default-features --features f32 + cargo test --verbose --no-default-features --features f64 + - bench: | + rustup default stable + cd vivaldi-nc/ + cargo bench --verbose --no-default-features --features f32 + cargo bench --verbose --no-default-features --features f64 - nightly: | rustup default nightly cd vivaldi-nc/ cargo clippy --verbose ||: cargo build --verbose ||: - cargo test --verbose ||: + cargo test --verbose --no-default-features --features f32 ||: + cargo test --verbose --no-default-features --features f64 ||: - docs: | cd vivaldi-nc/ rustup run stable cargo doc --no-deps diff --git a/examples/planetlab.rs b/examples/planetlab.rs index 48c6307..a594020 100644 --- a/examples/planetlab.rs +++ b/examples/planetlab.rs @@ -2,6 +2,18 @@ // // for info on the format, see `NetLatency-Data/README.md` +// +// **** Features **** +// + +/// `FloatType` is a type alias for either `f32` or `f64` depending on cargo features +#[cfg(feature = "f32")] +type FloatType = f32; + +/// `FloatType` is a type alias for either `f32` or `f64` depending on cargo features +#[cfg(feature = "f64")] +type FloatType = f64; + use std::{ fs::File, io::{BufReader, Read}, @@ -85,7 +97,7 @@ fn main() { nc[i_local].update(&nc_remote, rtt_measured); // complete, now let's sum up the error - error = nc.iter().map(|n| n.error()).sum::() / NUM_NODES as f32; + error = nc.iter().map(|n| n.error()).sum::() / NUM_NODES as FloatType; assert!(error.is_finite()); if error < 5.0 { break;