From 256932fde5a64d0204a0e93beb38901c70043916 Mon Sep 17 00:00:00 2001 From: Vinzent Steinberg Date: Fri, 26 Apr 2024 11:57:50 +0200 Subject: [PATCH] Refactor macro tests --- tests/integration/macros.rs | 18 +++++++++++++++++- tests/integration/main.rs | 4 ---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/tests/integration/macros.rs b/tests/integration/macros.rs index 350ac18..8d0be03 100644 --- a/tests/integration/macros.rs +++ b/tests/integration/macros.rs @@ -2,7 +2,7 @@ use average::{concatenate, Estimate, Max, Min}; -concatenate!(pub MinMax, [Min, min], [Max, max]); +concatenate!(MinMax, [Min, min], [Max, max]); #[test] fn concatenate_simple() { @@ -68,3 +68,19 @@ fn concatenate_moments_quantile() { assert_eq!(e.sample_variance(), 2.5); assert_eq!(e.quantile(), 3.0); } + +#[test] +fn concatenate_pub() { + mod submodule { + use average::{concatenate, Min, Max, Estimate}; + concatenate!(pub MinMax, [Min, min], [Max, max]); + } + + let mut s = submodule::MinMax::new(); + for i in 1..6 { + s.add(f64::from(i)); + } + + assert_eq!(s.min(), 1.0); + assert_eq!(s.max(), 5.0); +} diff --git a/tests/integration/main.rs b/tests/integration/main.rs index 2199f1a..33e5870 100644 --- a/tests/integration/main.rs +++ b/tests/integration/main.rs @@ -21,7 +21,3 @@ mod skewness; mod streaming_stats; mod weighted_mean; mod covariance; - -// Ensure that the struct defined by macro is accessible -#[allow(unused_imports)] -use macros::MinMax;