Fix SnappyOutputStreamTest for big-endian platforms

This commit is contained in:
Bryan Chan 2015-06-29 14:50:27 -04:00
parent 73fa77bc4e
commit d8600ed65e
1 changed files with 4 additions and 2 deletions

View File

@ -163,8 +163,10 @@ public class SnappyOutputStreamTest
// Compress the data once so that we know the expected size:
byte[] expectedCompressedData = compressAsChunks(orig, Integer.MAX_VALUE);
// Hardcoding an expected compressed size here will catch regressions that lower the
// compression quality:
assertEquals(91013, expectedCompressedData.length);
// compression quality. On little-endian platforms, the expected size is 91013; on
// big-endian platforms, the expected size is 90943.
assertTrue(String.format("unexpected compressed data size (%d)", expectedCompressedData.length),
(expectedCompressedData.length == 91013 || expectedCompressedData.length == 90943));
// The chunk size should not affect the size of the compressed output:
int[] chunkSizes = new int[] {1, 100, 1023, 1024, 10000};
for (int chunkSize : chunkSizes) {