MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / TEST

Function TEST

Engine/source/math/test/mMatrixTest.cpp:42–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40#endif
41
42TEST(MatrixF, MultiplyImplmentations)
43{
44 F32 m1[16], m2[16], mrC[16];
45
46 // I am not positive that the best way to do this is to use random numbers
47 // but I think that using some kind of standard matrix may not always catch
48 // all problems.
49 for (S32 i = 0; i < 16; i++)
50 {
51 m1[i] = gRandGen.randF();
52 m2[i] = gRandGen.randF();
53 }
54
55 // C will be the baseline
56 default_matF_x_matF_C(m1, m2, mrC);
57
58#if defined(WIN32) && defined(TORQUE_CPU_X86)
59 // Check the CPU info
60 U32 cpuProperties = Platform::SystemInfo.processor.properties;
61 bool same;
62
63 // Test SSE if it is available
64 F32 mrSSE[16];
65 if (cpuProperties & CPU_PROP_SSE)
66 {
67 SSE_MatrixF_x_MatrixF(m1, m2, mrSSE);
68
69 same = true;
70 for (S32 i = 0; i < 16; i++)
71 same &= mIsEqual(mrC[i], mrSSE[i]);
72
73 EXPECT_TRUE(same) << "Matrix multiplication verification failed. (C vs. SSE)";
74 }
75
76 same = true;
77#endif
78
79 // If Altivec exists, test it!
80#if defined(__VEC__)
81 bool same = false;
82 F32 mrVEC[16];
83
84 vec_MatrixF_x_MatrixF(m1, m2, mrVEC);
85
86 for (S32 i = 0; i < 16; i++)
87 same &= isEqual(mrC[i], mrVEC[i]);
88
89 EXPECT_TRUE(same) << "Matrix multiplication verification failed. (C vs. Altivec)";
90#endif
91}
92
93#endif

Callers

nothing calls this directly

Calls 5

default_matF_x_matF_CFunction · 0.85
SSE_MatrixF_x_MatrixFFunction · 0.85
mIsEqualFunction · 0.85
isEqualFunction · 0.85
randFMethod · 0.80

Tested by

no test coverage detected