minor refactoring in matrix tests