From 8872b8347ccf174f1c165476dcf249682495898f Mon Sep 17 00:00:00 2001 From: Martin Larralde <martin.larralde@embl.de> Date: Thu, 20 Jun 2024 17:08:57 +0200 Subject: [PATCH] Reorganize tests for `Stripe` implementations --- lightmotif/tests/stripe.rs | 85 ++++++++++++++++++++++++-------------- 1 file changed, 54 insertions(+), 31 deletions(-) diff --git a/lightmotif/tests/stripe.rs b/lightmotif/tests/stripe.rs index 9f2828a..ff5520a 100644 --- a/lightmotif/tests/stripe.rs +++ b/lightmotif/tests/stripe.rs @@ -44,40 +44,63 @@ fn test_stripe<C: Unsigned + NonZero, P: Stripe<Dna, C>>(pli: &P, sequence: &str } } -#[test] -fn test_stripe_generic() { - let pli = Pipeline::generic(); - test_stripe::<U32, _>(&pli, S1); - test_stripe::<U32, _>(&pli, S2); - test_stripe::<U16, _>(&pli, S1); - test_stripe::<U16, _>(&pli, S2); -} +mod generic { + use super::*; + + #[test] + fn test_s1_c32() { + let pli = Pipeline::generic(); + super::test_stripe::<U32, _>(&pli, S1); + } + + #[test] + fn test_s2_c32() { + let pli = Pipeline::generic(); + super::test_stripe::<U32, _>(&pli, S2); + } -#[test] -fn test_stripe_dispatch() { - let pli = Pipeline::dispatch(); - test_stripe(&pli, S1); - test_stripe(&pli, S2); + #[test] + fn test_s1_c16() { + let pli = Pipeline::generic(); + super::test_stripe::<U16, _>(&pli, S1); + } + + #[test] + fn test_s2_c16() { + let pli = Pipeline::generic(); + super::test_stripe::<U16, _>(&pli, S2); + } } -// #[cfg(target_feature = "sse2")] -// #[test] -// fn test_stripe_sse2() { -// let pli = Pipeline::sse2().unwrap(); -// test_stripe(&pli); -// } +mod dispatch { + use super::*; -#[cfg(target_feature = "avx2")] -#[test] -fn test_stripe_avx2() { - let pli = Pipeline::avx2().unwrap(); - test_stripe(&pli, S1); - test_stripe(&pli, S2); + #[test] + fn test_s1_c32() { + let pli = Pipeline::dispatch(); + super::test_stripe(&pli, S1); + } + + #[test] + fn test_s2_c32() { + let pli = Pipeline::dispatch(); + super::test_stripe(&pli, S2); + } } -// #[cfg(target_feature = "neon")] -// #[test] -// fn test_stripe_neon() { -// let pli = Pipeline::neon().unwrap(); -// test_stripe(&pli); -// } +#[cfg(target_feature = "avx2")] +mod avx2 { + use super::*; + + #[test] + fn test_s1_c32() { + let pli = Pipeline::avx2().unwrap(); + super::test_stripe(&pli, S1); + } + + #[test] + fn test_s2_c32() { + let pli = Pipeline::avx2().unwrap(); + super::test_stripe(&pli, S2); + } +} -- GitLab