Reduce logic duplication. Optimize assertArrayEquals()
for arrays of double, float and arrays of arrays.