some work on x11 ext
This commit is contained in:
+30
-5
@@ -4,6 +4,7 @@
|
||||
|
||||
#include "bits.h"
|
||||
#include "fix.h"
|
||||
#include "mat.h"
|
||||
#include "std.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
@@ -18,7 +19,7 @@
|
||||
static bool com_test_fix(void) {
|
||||
bool anyfail = false;
|
||||
{
|
||||
double max_sqrt_deviation = 0.0f;
|
||||
double max_sqrt_deviation = 0.0;
|
||||
com_fix_t sqrt_accumulator = 0;
|
||||
com_fix_t sqrt_test_step = COM_FIX_FRACUNIT >> 2; /* Quarter step */
|
||||
for (int i = 0; i < COM_FIX_FRACUNIT << 1; ++i) {
|
||||
@@ -34,7 +35,7 @@ static bool com_test_fix(void) {
|
||||
}
|
||||
|
||||
{
|
||||
double max_sin_deviation = 0.0f;
|
||||
double max_sin_deviation = 0.0;
|
||||
com_fix_t sin_accumulator = -COM_FIX_PI * 4;
|
||||
com_fix_t sin_test_step = (COM_FIX_PI << 1) >> 10;
|
||||
for (int i = 0; i < 1024 * 32; ++i) {
|
||||
@@ -50,7 +51,7 @@ static bool com_test_fix(void) {
|
||||
}
|
||||
|
||||
{
|
||||
double max_cos_deviation = 0.0f;
|
||||
double max_cos_deviation = 0.0;
|
||||
com_fix_t cos_accumulator = -COM_FIX_PI * 4;
|
||||
com_fix_t cos_test_step = (COM_FIX_PI << 1) >> 10;
|
||||
for (int i = 0; i < 1024 * 32; ++i) {
|
||||
@@ -66,8 +67,8 @@ static bool com_test_fix(void) {
|
||||
}
|
||||
|
||||
{
|
||||
double max_sin_deviation = 0.0f;
|
||||
double max_cos_deviation = 0.0f;
|
||||
double max_sin_deviation = 0.0;
|
||||
double max_cos_deviation = 0.0;
|
||||
com_fix_t sincos_accumulator = -COM_FIX_PI * 4;
|
||||
com_fix_t sincos_test_step = (COM_FIX_PI << 1) >> 10;
|
||||
for (int i = 0; i < 1024 * 32; ++i) {
|
||||
@@ -105,6 +106,26 @@ static bool com_test_bits(void) {
|
||||
return anyfail;
|
||||
}
|
||||
|
||||
static bool com_test_mat(void) {
|
||||
bool anyfail = false;
|
||||
|
||||
com_mat_t const m0 = com_mat_identity();
|
||||
com_mat_t m1 = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16};
|
||||
for (int i = 0; i < 16; ++i)
|
||||
m1.a[i] *= COM_FIX_FRACUNIT;
|
||||
|
||||
com_mat_t const mul = com_mat_mul(m1, m0);
|
||||
com_mat_t const mul_reordered = com_mat_mul_reodered(com_mat_reoder(m1), m0);
|
||||
|
||||
for (int i = 0; i < 16; ++i) {
|
||||
TEST(mul.a[i] == mul_reordered.a[i]);
|
||||
if (mul.a[i] != mul_reordered.a[i])
|
||||
break;
|
||||
}
|
||||
|
||||
return anyfail;
|
||||
}
|
||||
|
||||
static bool com_test_run(void) {
|
||||
bool anyfail = false;
|
||||
if (com_test_fix()) {
|
||||
@@ -115,6 +136,10 @@ static bool com_test_run(void) {
|
||||
com_std_print('c', "com_bits tests failed!");
|
||||
anyfail = true;
|
||||
}
|
||||
if (com_test_mat()) {
|
||||
com_std_print('c', "com_mat tests failed!");
|
||||
anyfail = true;
|
||||
}
|
||||
return !anyfail;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user