From 696bbbe767b0599e4fc7befc2eae7291fa1002c0 Mon Sep 17 00:00:00 2001
From: Martin Larralde <martin.larralde@embl.de>
Date: Fri, 21 Jun 2024 11:26:38 +0200
Subject: [PATCH] Fix unused imports in `lightmotif::pli` and reorganize unit
 tests

---
 lightmotif/src/pli/mod.rs  |  3 --
 lightmotif/src/scan.rs     |  5 ---
 lightmotif/tests/dna.rs    | 72 +++++++++++++++++++++++++++-----------
 lightmotif/tests/encode.rs | 20 +++++------
 lightmotif/tests/stripe.rs | 16 ++++-----
 5 files changed, 70 insertions(+), 46 deletions(-)

diff --git a/lightmotif/src/pli/mod.rs b/lightmotif/src/pli/mod.rs
index b6e8f4e..2a8d120 100644
--- a/lightmotif/src/pli/mod.rs
+++ b/lightmotif/src/pli/mod.rs
@@ -1,11 +1,8 @@
 //! Concrete implementations of the sequence scoring pipeline.
 
-use std::ops::Add;
 use std::ops::AddAssign;
 use std::ops::Range;
 
-use typenum::IsLessOrEqual;
-
 use crate::abc::Alphabet;
 use crate::abc::Dna;
 use crate::abc::Protein;
diff --git a/lightmotif/src/scan.rs b/lightmotif/src/scan.rs
index 07ce441..e4c9430 100644
--- a/lightmotif/src/scan.rs
+++ b/lightmotif/src/scan.rs
@@ -3,14 +3,9 @@ use std::cmp::Ordering;
 
 use super::abc::Alphabet;
 use super::pli::dispatch::Dispatch;
-use super::pli::platform::Avx2;
-use super::pli::platform::Backend;
-use super::pli::platform::Neon;
 use super::pwm::ScoringMatrix;
 use super::seq::StripedSequence;
-use crate::dense::DenseMatrix;
 use crate::num::StrictlyPositive;
-use crate::num::U32;
 use crate::pli::Maximum;
 use crate::pli::Pipeline;
 use crate::pli::Score;
diff --git a/lightmotif/tests/dna.rs b/lightmotif/tests/dna.rs
index c5fb96d..6282428 100644
--- a/lightmotif/tests/dna.rs
+++ b/lightmotif/tests/dna.rs
@@ -197,7 +197,7 @@ mod generic {
     use super::*;
 
     #[test]
-    fn test_score() {
+    fn score() {
         let pli = Pipeline::generic();
         super::test_score::<U32, _>(&pli);
         super::test_score::<U16, _>(&pli);
@@ -205,7 +205,7 @@ mod generic {
     }
 
     #[test]
-    fn test_score_rows() {
+    fn score_rows() {
         let pli = Pipeline::generic();
         super::test_score_rows::<U32, _>(&pli);
         super::test_score_rows::<U16, _>(&pli);
@@ -213,14 +213,22 @@ mod generic {
     }
 
     #[test]
-    fn test_argmax() {
+    fn score_discrete() {
+        let pli = Pipeline::generic();
+        super::test_score_discrete::<U32, _>(&pli);
+        super::test_score_discrete::<U16, _>(&pli);
+        super::test_score_discrete::<U1, _>(&pli);
+    }
+
+    #[test]
+    fn argmax() {
         let pli = Pipeline::generic();
         super::test_argmax::<U32, _>(&pli);
         super::test_argmax::<U1, _>(&pli);
     }
 
     #[test]
-    fn test_threshold() {
+    fn threshold() {
         let pli = Pipeline::generic();
         super::test_threshold::<U32, _>(&pli);
     }
@@ -230,25 +238,31 @@ mod dispatch {
     use super::*;
 
     #[test]
-    fn test_score() {
+    fn score() {
         let pli = Pipeline::dispatch();
         super::test_score(&pli);
     }
 
     #[test]
-    fn test_score_rows() {
+    fn score_rows() {
         let pli = Pipeline::dispatch();
         super::test_score_rows(&pli);
     }
 
     #[test]
-    fn test_argmax() {
+    fn score_discrete() {
+        let pli = Pipeline::dispatch();
+        super::test_score_discrete(&pli);
+    }
+
+    #[test]
+    fn argmax() {
         let pli = Pipeline::dispatch();
         super::test_argmax(&pli);
     }
 
     #[test]
-    fn test_threshold() {
+    fn threshold() {
         let pli = Pipeline::dispatch();
         super::test_threshold(&pli);
     }
@@ -259,28 +273,34 @@ mod sse2 {
     use super::*;
 
     #[test]
-    fn test_score() {
+    fn score() {
         let pli = Pipeline::sse2().unwrap();
         super::test_score::<U32, _>(&pli);
         super::test_score::<U16, _>(&pli);
     }
 
     #[test]
-    fn test_score_rows() {
+    fn score_rows() {
         let pli = Pipeline::sse2().unwrap();
         super::test_score_rows::<U32, _>(&pli);
         super::test_score_rows::<U16, _>(&pli);
     }
 
+    // #[test]
+    // fn score_discrete() {
+    //     let pli = Pipeline::sse2().unwrap();
+    //     super::test_score_discrete(&pli);
+    // }
+
     #[test]
-    fn test_argmax() {
+    fn argmax() {
         let pli = Pipeline::sse2().unwrap();
         super::test_argmax::<U32, _>(&pli);
         super::test_argmax::<U16, _>(&pli);
     }
 
     #[test]
-    fn test_threshold() {
+    fn threshold() {
         let pli = Pipeline::sse2().unwrap();
         super::test_threshold::<U32, _>(&pli);
         super::test_threshold::<U16, _>(&pli);
@@ -292,25 +312,31 @@ mod avx2 {
     use super::*;
 
     #[test]
-    fn test_score() {
+    fn score() {
         let pli = Pipeline::avx2().unwrap();
         super::test_score::<U32, _>(&pli);
     }
 
     #[test]
-    fn test_score_rows() {
+    fn score_rows() {
         let pli = Pipeline::avx2().unwrap();
         super::test_score_rows::<U32, _>(&pli);
     }
 
     #[test]
-    fn test_argmax() {
+    fn score_discrete() {
+        let pli = Pipeline::avx2().unwrap();
+        super::test_score_discrete(&pli);
+    }
+
+    #[test]
+    fn argmax() {
         let pli = Pipeline::avx2().unwrap();
         super::test_argmax::<U32, _>(&pli);
     }
 
     #[test]
-    fn test_threshold() {
+    fn threshold() {
         let pli = Pipeline::avx2().unwrap();
         super::test_threshold::<U32, _>(&pli);
     }
@@ -321,25 +347,31 @@ mod neon {
     use super::*;
 
     #[test]
-    fn test_score() {
+    fn score() {
         let pli = Pipeline::neon().unwrap();
         super::test_score::<U16, _>(&pli);
     }
 
     #[test]
-    fn test_score_rows() {
+    fn score_rows() {
         let pli = Pipeline::neon().unwrap();
         super::test_score_rows::<U16, _>(&pli);
     }
 
+    // #[test]
+    // fn score_discrete() {
+    //     let pli = Pipeline::neon().unwrap();
+    //     super::test_score_discrete(&pli);
+    // }
+
     #[test]
-    fn test_argmax() {
+    fn argmax() {
         let pli = Pipeline::neon().unwrap();
         super::test_argmax::<U16, _>(&pli);
     }
 
     #[test]
-    fn test_threshold() {
+    fn threshold() {
         let pli = Pipeline::neon().unwrap();
         super::test_threshold::<U16, _>(&pli);
     }
diff --git a/lightmotif/tests/encode.rs b/lightmotif/tests/encode.rs
index 8376df4..497512e 100644
--- a/lightmotif/tests/encode.rs
+++ b/lightmotif/tests/encode.rs
@@ -29,13 +29,13 @@ mod generic {
     use super::*;
 
     #[test]
-    fn test_sequence() {
+    fn sequence() {
         let pli = Pipeline::generic();
         test_encode_sequence(&pli);
     }
 
     #[test]
-    fn test_unknown() {
+    fn unknown() {
         let pli = Pipeline::generic();
         test_encode_unknown(&pli);
     }
@@ -45,13 +45,13 @@ mod dispatch {
     use super::*;
 
     #[test]
-    fn test_sequence() {
+    fn sequence() {
         let pli = Pipeline::dispatch();
         test_encode_sequence(&pli);
     }
 
     #[test]
-    fn test_unknown() {
+    fn unknown() {
         let pli = Pipeline::dispatch();
         test_encode_unknown(&pli);
     }
@@ -62,13 +62,13 @@ mod sse2 {
     use super::*;
 
     #[test]
-    fn test_sequence() {
+    fn sequence() {
         let pli = Pipeline::sse2().unwrap();
         test_encode_sequence(&pli);
     }
 
     #[test]
-    fn test_unknown() {
+    fn unknown() {
         let pli = Pipeline::sse2().unwrap();
         test_encode_unknown(&pli);
     }
@@ -79,13 +79,13 @@ mod avx2 {
     use super::*;
 
     #[test]
-    fn test_sequence() {
+    fn sequence() {
         let pli = Pipeline::avx2().unwrap();
         test_encode_sequence(&pli);
     }
 
     #[test]
-    fn test_unknown() {
+    fn unknown() {
         let pli = Pipeline::avx2().unwrap();
         test_encode_unknown(&pli);
     }
@@ -96,13 +96,13 @@ mod neon {
     use super::*;
 
     #[test]
-    fn test_sequence() {
+    fn sequence() {
         let pli = Pipeline::neon().unwrap();
         test_encode_sequence(&pli);
     }
 
     #[test]
-    fn test_unknown() {
+    fn unknown() {
         let pli = Pipeline::neon().unwrap();
         test_encode_unknown(&pli);
     }
diff --git a/lightmotif/tests/stripe.rs b/lightmotif/tests/stripe.rs
index ff5520a..e60ffc8 100644
--- a/lightmotif/tests/stripe.rs
+++ b/lightmotif/tests/stripe.rs
@@ -48,25 +48,25 @@ mod generic {
     use super::*;
 
     #[test]
-    fn test_s1_c32() {
+    fn s1_c32() {
         let pli = Pipeline::generic();
         super::test_stripe::<U32, _>(&pli, S1);
     }
 
     #[test]
-    fn test_s2_c32() {
+    fn s2_c32() {
         let pli = Pipeline::generic();
         super::test_stripe::<U32, _>(&pli, S2);
     }
 
     #[test]
-    fn test_s1_c16() {
+    fn s1_c16() {
         let pli = Pipeline::generic();
         super::test_stripe::<U16, _>(&pli, S1);
     }
 
     #[test]
-    fn test_s2_c16() {
+    fn s2_c16() {
         let pli = Pipeline::generic();
         super::test_stripe::<U16, _>(&pli, S2);
     }
@@ -76,13 +76,13 @@ mod dispatch {
     use super::*;
 
     #[test]
-    fn test_s1_c32() {
+    fn s1_c32() {
         let pli = Pipeline::dispatch();
         super::test_stripe(&pli, S1);
     }
 
     #[test]
-    fn test_s2_c32() {
+    fn s2_c32() {
         let pli = Pipeline::dispatch();
         super::test_stripe(&pli, S2);
     }
@@ -93,13 +93,13 @@ mod avx2 {
     use super::*;
 
     #[test]
-    fn test_s1_c32() {
+    fn s1_c32() {
         let pli = Pipeline::avx2().unwrap();
         super::test_stripe(&pli, S1);
     }
 
     #[test]
-    fn test_s2_c32() {
+    fn s2_c32() {
         let pli = Pipeline::avx2().unwrap();
         super::test_stripe(&pli, S2);
     }
-- 
GitLab