Skip to content

Commit

Permalink
add test for record count regarding equivalence of reflected locus ID…
Browse files Browse the repository at this point in the history
… pairs; #395
  • Loading branch information
vreuter committed Dec 11, 2024
1 parent 8dac0fb commit 4eda4a1
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/test/scala/TestComputeLocusPairwiseDistances.scala
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,19 @@ class TestComputeLocusPairwiseDistances extends AnyFunSuite, ScalaCheckPropertyC
}
}

test("Record count / number of records is as expected -- locus ID pairs are unordered (equivalent when reflected). Issue #395"):
// For this test, fix the randomisation to use a single field of view and a single trace ID.
given Arbitrary[(PositionName, TraceId)] = Gen.const(PositionName.unsafe("P0001.zarr") -> TraceId.unsafe(0)).toArbitrary
given Arbitrary[Inputs] = arbitrary[Inputs].flatMap(makeTraceUniqueInLoci).toArbitrary

forAll (Gen.resize(15, arbitrary[Inputs])) { inputs =>
val n = inputs.length
val numExp = n * (n - 1) / 2
val outputs = inputRecordsToOutputRecords(NonnegativeInt.indexed(inputs))
val numObs = outputs.size
numObs shouldEqual numExp
}

/** Treat trace ID generation equivalently to ROI index generation. */
given arbitraryForTraceId(using arbRoiIdx: Arbitrary[RoiIndex]): Arbitrary[TraceId] = arbRoiIdx.map(TraceId.fromRoiIndex)

Expand Down

0 comments on commit 4eda4a1

Please sign in to comment.