Generate more random test inputs
howjmay opened this issue · comments
The current test inputs are listed as following.
float *mTestFloatPointer1;
float *mTestFloatPointer2;
int32_t *mTestIntPointer1;
int32_t *mTestIntPointer2;
It seems the generated numbers are not quite random, which may reduce the coverage of tests.
Hi @howjmay ,
The test inputs are created by the following function in tests/impl.cpp
:
SSE2NEONTestImpl::SSE2NEONTestImpl(void)
{
mTestFloatPointer1 = (float *) platformAlignedAlloc(sizeof(__m128));
mTestFloatPointer2 = (float *) platformAlignedAlloc(sizeof(__m128));
mTestIntPointer1 = (int32_t *) platformAlignedAlloc(sizeof(__m128i));
mTestIntPointer2 = (int32_t *) platformAlignedAlloc(sizeof(__m128i));
srand(0);
for (uint32_t i = 0; i < MAX_TEST_VALUE; i++) {
mTestFloats[i] = ranf(-100000, 100000);
mTestInts[i] = (int32_t) ranf(-100000, 100000);
}
}
For my first glance, I think we can change the input of srand()
to some dynamic number (e.g., current timestamp).
We should stick to deterministic random number generation in the tests.
Therefore, this issue is not necessary anymore.