checkmatrix testcase