mirror of
https://github.com/libretro/ppsspp.git
synced 2024-11-23 16:19:44 +00:00
Add a simple test of matrix transposes
This commit is contained in:
parent
75a9420b21
commit
9f2ec39a99
@ -287,12 +287,36 @@ bool TestVFPUSinCos() {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TestMatrixTranspose() {
|
||||
MatrixSize sz = M_4x4;
|
||||
int matrix = 0; // M000
|
||||
u8 cols[4];
|
||||
u8 rows[4];
|
||||
|
||||
GetMatrixColumns(matrix, sz, cols);
|
||||
GetMatrixRows(matrix, sz, rows);
|
||||
|
||||
int transposed = Xpose(matrix);
|
||||
u8 x_cols[4];
|
||||
u8 x_rows[4];
|
||||
|
||||
GetMatrixColumns(transposed, sz, x_cols);
|
||||
GetMatrixRows(transposed, sz, x_rows);
|
||||
|
||||
for (int i = 0; i < GetMatrixSide(sz); i++) {
|
||||
EXPECT_EQ_INT(cols[i], x_rows[i]);
|
||||
EXPECT_EQ_INT(x_cols[i], rows[i]);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void TestGetMatrix(int matrix, MatrixSize sz) {
|
||||
ILOG("Testing matrix %s", GetMatrixNotation(matrix, sz));
|
||||
u8 fullMatrix[16];
|
||||
|
||||
u8 cols[4];
|
||||
u8 rows[4];
|
||||
|
||||
GetMatrixColumns(matrix, sz, cols);
|
||||
GetMatrixRows(matrix, sz, rows);
|
||||
|
||||
@ -358,6 +382,7 @@ TestItem availableTests[] = {
|
||||
TEST_ITEM(MathUtil),
|
||||
TEST_ITEM(Parsers),
|
||||
TEST_ITEM(Jit),
|
||||
TEST_ITEM(MatrixTranspose)
|
||||
};
|
||||
|
||||
int main(int argc, const char *argv[]) {
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
#define EXPECT_TRUE(a) if (!(a)) { printf("%s:%i: Test Fail\n", __FUNCTION__, __LINE__); return false; }
|
||||
#define EXPECT_FALSE(a) if ((a)) { printf("%s:%i: Test Fail\n", __FUNCTION__, __LINE__); return false; }
|
||||
#define EXPECT_EQ_INT(a, b) if ((a) != (b)) { printf("%s:%i: Test Fail\n%d\nvs\n%d\n", __FUNCTION__, __LINE__, a, b); return false; }
|
||||
#define EXPECT_EQ_FLOAT(a, b) if ((a) != (b)) { printf("%s:%i: Test Fail\n%f\nvs\n%f\n", __FUNCTION__, __LINE__, a, b); return false; }
|
||||
#define EXPECT_APPROX_EQ_FLOAT(a, b) if (fabsf((a)-(b))>0.00001f) { printf("%s:%i: Test Fail\n%f\nvs\n%f\n", __FUNCTION__, __LINE__, a, b); /*return false;*/ }
|
||||
#define EXPECT_EQ_STR(a, b) if (a != b) { printf("%s: Test Fail\n%s\nvs\n%s\n", __FUNCTION__, a.c_str(), b.c_str()); return false; }
|
||||
|
Loading…
Reference in New Issue
Block a user