Skip to content

Commit

Permalink
OpenEXR/IlmImfTest/testHuf.cpp: Do the compressVerify() on determinis…
Browse files Browse the repository at this point in the history
…tic data sets.

Updated to run compressVerify() on the fill4() and fill5() data sets which are
deterministic across platforms.
Added a comment to explain how these DEK hash are determined aprior for code
defines.

Signed-off-by: Arkell Rasiah <arasiah@pixsystem.com>
  • Loading branch information
arkellr authored and cary-ilm committed Feb 5, 2020
1 parent 0042c45 commit 88246d9
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion OpenEXR/IlmImfTest/testHuf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,15 @@ compressUncompressSubset(const unsigned short raw[], int n)
// This check is intended to test for regressions
// in the hufCompress() result or difference results across OSes.
//
// The platform agnostic DEK hash of the huf compressed data for
// the set of numbers generated by fill4() and fill5().
// This DEK hash is determined from an aprior initial run of this
// test noting its value from the assert message compressVerify().
//
#define HUF_COMPRESS_DEK_HASH_FOR_FILL4_USHRT_MAX_PLUS_ONE 2956869585U
#define HUF_COMPRESS_DEK_HASH_FOR_FILL4_N 3414126535U
#define HUF_COMPRESS_DEK_HASH_FOR_FILL5_N 169791374U

void
compressVerify (const unsigned short raw[],
int n,
Expand Down Expand Up @@ -221,7 +230,6 @@ testHuf (const std::string&)
Array <unsigned short> raw (N);

fill1 (raw, N, 1, rand48); // test various symbol distributions
compressVerify(raw, N, 3762495704U);
compressUncompress (raw, N);
compressUncompressSubset (raw, N);
fill1 (raw, N, 10, rand48);
Expand Down Expand Up @@ -261,9 +269,11 @@ testHuf (const std::string&)
compressUncompressSubset (raw, N);

fill4 (raw, USHRT_MAX + 1);
compressVerify(raw, USHRT_MAX + 1, HUF_COMPRESS_DEK_HASH_FOR_FILL4_USHRT_MAX_PLUS_ONE);
compressUncompress (raw, USHRT_MAX + 1);
compressUncompressSubset (raw, USHRT_MAX + 1);
fill4 (raw, N);
compressVerify(raw, N, HUF_COMPRESS_DEK_HASH_FOR_FILL4_N);
compressUncompress (raw, N);
compressUncompressSubset (raw, N);

Expand All @@ -277,6 +287,7 @@ testHuf (const std::string&)
compressUncompress (raw, 3);

fill5 (raw, N); // test run-length coding of code table
compressVerify(raw, N, HUF_COMPRESS_DEK_HASH_FOR_FILL5_N);
compressUncompress (raw, N);
compressUncompressSubset (raw, N);

Expand Down

0 comments on commit 88246d9

Please sign in to comment.