Skip to content

Commit

Permalink
Reuse encoders/decoders in RANS interop tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
cmnbroad committed Nov 25, 2024
1 parent e99c9a4 commit cd4eae4
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/test/java/htsjdk/samtools/cram/RANSInteropTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ public class RANSInteropTest extends HtsjdkTest {
public static final String COMPRESSED_RANS4X8_DIR = "r4x8";
public static final String COMPRESSED_RANSNX16_DIR = "r4x16";

private RANSEncode rans4x8Encoder = new RANS4x8Encode();
private RANSDecode rans4x8Decoder = new RANS4x8Decode();
private RANSNx16Encode ransNx16Encoder = new RANSNx16Encode();
private RANSNx16Decode ransNx16Decoder = new RANSNx16Decode();

// enumerates the different flag combinations
public Object[][] get4x8RoundTripTestCases() throws IOException {

Expand All @@ -50,8 +55,8 @@ public Object[][] get4x8RoundTripTestCases() throws IOException {
.forEach(path ->
rans4x8ParamsOrderList.stream().map(rans4x8ParamsOrder -> new Object[]{
path,
new RANS4x8Encode(),
new RANS4x8Decode(),
rans4x8Encoder,
rans4x8Decoder,
new RANS4x8Params(rans4x8ParamsOrder)
}).forEach(testCases::add));
return testCases.toArray(new Object[][]{});
Expand Down Expand Up @@ -83,8 +88,8 @@ public Object[][] getNx16RoundTripTestCases() throws IOException {
.forEach(path ->
ransNx16ParamsFormatFlagList.stream().map(ransNx16ParamsFormatFlag -> new Object[]{
path,
new RANSNx16Encode(),
new RANSNx16Decode(),
ransNx16Encoder,
ransNx16Decoder,
new RANSNx16Params(ransNx16ParamsFormatFlag)
}).forEach(testCases::add));
return testCases.toArray(new Object[][]{});
Expand All @@ -101,7 +106,7 @@ public Object[][] get4x8DecodeOnlyTestCases() throws IOException {
Object[] objects = new Object[]{
path,
CRAMInteropTestUtils.getUnCompressedFilePath(path),
new RANS4x8Decode()
rans4x8Decoder
};
testCases.add(objects);
}
Expand All @@ -119,7 +124,7 @@ public Object[][] getNx16DecodeOnlyTestCases() throws IOException {
Object[] objects = new Object[]{
path,
CRAMInteropTestUtils.getUnCompressedFilePath(path),
new RANSNx16Decode()
ransNx16Decoder
};
testCases.add(objects);
}
Expand Down

0 comments on commit cd4eae4

Please sign in to comment.