summaryrefslogtreecommitdiff
path: root/tests/gdmatrix/bug00402.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/gdmatrix/bug00402.c')
-rw-r--r--tests/gdmatrix/bug00402.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/gdmatrix/bug00402.c b/tests/gdmatrix/bug00402.c
new file mode 100644
index 0000000..15529b6
--- /dev/null
+++ b/tests/gdmatrix/bug00402.c
@@ -0,0 +1,30 @@
+#include "gd.h"
+#include <stdio.h>
+#include "gdtest.h"
+#include <math.h>
+int main()
+{
+ double matrix[6] = {
+ 0.000000, 0.150000,
+ 0.150000, -0.000000,
+ 0.000000, 0.000000
+ };
+ double matrix_inv[6];
+ double matrix_inv_exp[6] = {
+ 0.0000000000, 6.6666666667,
+ 6.6666666667, -0.0000000000,
+ -0.0000000000, 0.0000000000
+ };
+
+ int res = gdAffineInvert(matrix_inv, matrix);
+
+ for (int i=0; i < 6; i++) {
+ double rounded_res = round(matrix_inv[i] * 10);
+ double rounded_exp = round(matrix_inv_exp[i] * 10);
+ if (rounded_res != rounded_exp) {
+ printf("%i failed %f exp %f", i, matrix_inv[i], matrix_inv_exp[i]);
+ return -1;
+ }
+ }
+ return res;
+}