aboutsummaryrefslogtreecommitdiffhomepage
path: root/experimental/Intersection/QuadraticReduceOrder_Test.cpp
diff options
context:
space:
mode:
authorGravatar caryclark@google.com <caryclark@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-01-25 18:57:23 +0000
committerGravatar caryclark@google.com <caryclark@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-01-25 18:57:23 +0000
commit27accef223a27fba437f5e825d99edbae20a045b (patch)
treebba808edd5117406ec3d17f08baebdbbd4338a1a /experimental/Intersection/QuadraticReduceOrder_Test.cpp
parent76bd2540b55f31c8e72adb2fa72a88d7f4ba5374 (diff)
Intersection work in progress
Review URL: https://codereview.appspot.com/5576043 git-svn-id: http://skia.googlecode.com/svn/trunk@3087 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'experimental/Intersection/QuadraticReduceOrder_Test.cpp')
-rw-r--r--experimental/Intersection/QuadraticReduceOrder_Test.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/experimental/Intersection/QuadraticReduceOrder_Test.cpp b/experimental/Intersection/QuadraticReduceOrder_Test.cpp
new file mode 100644
index 0000000000..6e92329068
--- /dev/null
+++ b/experimental/Intersection/QuadraticReduceOrder_Test.cpp
@@ -0,0 +1,38 @@
+#include "CubicIntersection.h"
+#include "Intersection_Tests.h"
+#include "QuadraticIntersection_TestData.h"
+#include "TestUtilities.h"
+
+void QuadraticReduceOrder_Test() {
+ size_t index;
+ Quadratic reduce;
+ int order;
+ enum {
+ RunAll,
+ RunQuadraticLines,
+ RunQuadraticModLines,
+ RunNone
+ } run = RunAll;
+ int firstTestIndex = 0;
+#if 0
+ run = RunQuadraticLines;
+ firstTestIndex = 1;
+#endif
+ int firstQuadraticLineTest = run == RunAll ? 0 : run == RunQuadraticLines ? firstTestIndex : INT_MAX;
+ int firstQuadraticModLineTest = run == RunAll ? 0 : run == RunQuadraticModLines ? firstTestIndex : INT_MAX;
+
+ for (index = firstQuadraticLineTest; index < quadraticLines_count; ++index) {
+ const Quadratic& quad = quadraticLines[index];
+ order = reduceOrder(quad, reduce);
+ if (order != 2) {
+ printf("[%d] line quad order=%d\n", (int) index, order);
+ }
+ }
+ for (index = firstQuadraticModLineTest; index < quadraticModEpsilonLines_count; ++index) {
+ const Quadratic& quad = quadraticModEpsilonLines[index];
+ order = reduceOrder(quad, reduce);
+ if (order != 3) {
+ printf("[%d] line mod quad order=%d\n", (int) index, order);
+ }
+ }
+}