integration tests

This commit is contained in:
Henry Schimke
2022-12-10 17:43:58 -06:00
parent 20f8d15065
commit b1684ac698
7 changed files with 46 additions and 36 deletions

View File

@@ -159,8 +159,12 @@ pub trait OneDReader: Reader {
* @throws NotFoundException if counters cannot be filled entirely from row before running out
* of pixels
*/
fn recordPattern(&self, row: &BitArray, start: usize, counters: &mut [u32]) -> Result<(), Exceptions>
{
fn recordPattern(
&self,
row: &BitArray,
start: usize,
counters: &mut [u32],
) -> Result<(), Exceptions> {
let numCounters = counters.len();
// Arrays.fill(counters, 0, numCounters, 0);
counters.fill(0);
@@ -198,8 +202,7 @@ pub trait OneDReader: Reader {
row: &BitArray,
start: usize,
counters: &mut [u32],
) -> Result<(), Exceptions>
{
) -> Result<(), Exceptions> {
let mut start = start;
// This could be more efficient I guess
let mut numTransitionsLeft = counters.len() as isize;
@@ -229,8 +232,12 @@ pub trait OneDReader: Reader {
* @param maxIndividualVariance The most any counter can differ before we give up
* @return ratio of total variance between counters and pattern compared to total pattern size
*/
fn patternMatchVariance(&self, counters: &[u32], pattern: &[u32], maxIndividualVariance: f32) -> f32
{
fn patternMatchVariance(
&self,
counters: &[u32],
pattern: &[u32],
maxIndividualVariance: f32,
) -> f32 {
let mut maxIndividualVariance = maxIndividualVariance;
let numCounters = counters.len();
let mut total = 0.0;