testOpFormattedDataExport fails sometimes
jakirkham opened this issue · comments
jakirkham commented
The main test in testOpFormattedDataExport, testBasic, fails here sometimes. As this test takes random data (
) and is asserting the validity of that data ( ), it is possible that some types of random values are not acceptable. It would be nice to figure out the cause of this and fix it.jakirkham commented
Actually, the cause seems to be rather straightforward. As the type we are using is unsigned (
), we are getting a rollover error (i.e. sometimes we get255
), which is not less than or equal to 1
even though the two values may have been (i.e. 1
and 2
), but had their difference taken in a non-positive direction.jakirkham commented
This can be easily resolved several ways. We could simply promote the type before subtraction. Alternatively, if we need to maintain the same type, we could ensure we have the larger values in one array and the smaller ones in the other.