Commit d10195ec authored by Berenger Bramas's avatar Berenger Bramas

Update unit test -- add a hard test for unaligned load/store

parent 917a20d5
......@@ -204,6 +204,32 @@ class TestAll : public UTester< TestAll< VecType > > {
equalToArray(VecType().setFromIndirectArray(reals, indirect), reals);
}
{
for(int idxOffsetIn = 0 ; idxOffsetIn < sizeof(RealType)*VecType::VecLength ; ++idxOffsetIn){
unsigned char* bufferIn[sizeof(RealType)*VecType::VecLength*2] = {0};
RealType* realsIn = reinterpret_cast<RealType*>(&bufferIn[idxOffsetIn]);
for (int idx = 0; idx < VecType::VecLength; ++idx) {
realsIn[idx] = RealType(idx);
}
VecType vec(realsIn);
equalToArray(vec, realsIn);
vec.setFromArray(realsIn);
equalToArray(vec, realsIn);
for(int idxOffsetOut = 0 ; idxOffsetOut < sizeof(RealType)*VecType::VecLength ; ++idxOffsetOut){
unsigned char* bufferOut[sizeof(RealType)*VecType::VecLength*2] = {0};
RealType* realsOut = reinterpret_cast<RealType*>(&bufferOut[idxOffsetOut]);
vec.storeInArray(realsOut);
for (int idx = 0; idx < VecType::VecLength; ++idx) {
UASSERTEEQUAL(realsOut[idx], realsIn[idx]);
}
}
}
}
{
RealType reals[VecType::VecLength];
int indirect[VecType::VecLength];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment