harden and speed up path op unit tests

PathOps tests internal routines direcctly. Check to make sure that
test points, lines, quads, curves, triangles, and bounds read from
arrays are valid (i.e., don't contain NaN) before calling the
test function.

Repurpose the test flags.
- make 'v' verbose test region output against path output
- make 'z' single threaded (before it made it multithreaded)

The latter change speeds up tests run by the buildbot by 2x to 3x.

BUG=

Review URL: https://codereview.chromium.org/19374003

git-svn-id: http://skia.googlecode.com/svn/trunk@10107 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tests/PathOpsCubicReduceOrderTest.cpp b/tests/PathOpsCubicReduceOrderTest.cpp
index d7518ab..7b89bbe 100644
--- a/tests/PathOpsCubicReduceOrderTest.cpp
+++ b/tests/PathOpsCubicReduceOrderTest.cpp
@@ -6,6 +6,7 @@
  */
 #include "PathOpsCubicIntersectionTestData.h"
 #include "PathOpsQuadIntersectionTestData.h"
+#include "PathOpsTestCommon.h"
 #include "SkIntersections.h"
 #include "SkPathOpsRect.h"
 #include "SkReduceOrder.h"
@@ -102,6 +103,7 @@
 
     for (index = firstPointDegeneratesTest; index < pointDegenerates_count; ++index) {
         const SkDCubic& cubic = pointDegenerates[index];
+        SkASSERT(ValidCubic(cubic));
         order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics, SkReduceOrder::kFill_Style);
         if (order != 1) {
             SkDebugf("[%d] pointDegenerates order=%d\n", static_cast<int>(index), order);
@@ -110,6 +112,7 @@
     }
     for (index = firstNotPointDegeneratesTest; index < notPointDegenerates_count; ++index) {
         const SkDCubic& cubic = notPointDegenerates[index];
+        SkASSERT(ValidCubic(cubic));
         order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics, SkReduceOrder::kFill_Style);
         if (order == 1) {
             SkDebugf("[%d] notPointDegenerates order=%d\n", static_cast<int>(index), order);
@@ -118,6 +121,7 @@
     }
     for (index = firstLinesTest; index < lines_count; ++index) {
         const SkDCubic& cubic = lines[index];
+        SkASSERT(ValidCubic(cubic));
         order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics, SkReduceOrder::kFill_Style);
         if (order != 2) {
             SkDebugf("[%d] lines order=%d\n", static_cast<int>(index), order);
@@ -126,6 +130,7 @@
     }
     for (index = firstNotLinesTest; index < notLines_count; ++index) {
         const SkDCubic& cubic = notLines[index];
+        SkASSERT(ValidCubic(cubic));
         order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics, SkReduceOrder::kFill_Style);
         if (order == 2) {
             SkDebugf("[%d] notLines order=%d\n", static_cast<int>(index), order);
@@ -134,6 +139,7 @@
     }
     for (index = firstModEpsilonTest; index < modEpsilonLines_count; ++index) {
         const SkDCubic& cubic = modEpsilonLines[index];
+        SkASSERT(ValidCubic(cubic));
         order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics, SkReduceOrder::kFill_Style);
         if (order == 2) {
             SkDebugf("[%d] line mod by epsilon order=%d\n", static_cast<int>(index), order);
@@ -142,6 +148,7 @@
     }
     for (index = firstLessEpsilonTest; index < lessEpsilonLines_count; ++index) {
         const SkDCubic& cubic = lessEpsilonLines[index];
+        SkASSERT(ValidCubic(cubic));
         order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics, SkReduceOrder::kFill_Style);
         if (order != 2) {
             SkDebugf("[%d] line less by epsilon/2 order=%d\n", static_cast<int>(index), order);
@@ -150,6 +157,7 @@
     }
     for (index = firstNegEpsilonTest; index < negEpsilonLines_count; ++index) {
         const SkDCubic& cubic = negEpsilonLines[index];
+        SkASSERT(ValidCubic(cubic));
         order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics, SkReduceOrder::kFill_Style);
         if (order != 2) {
             SkDebugf("[%d] line neg by epsilon/2 order=%d\n", static_cast<int>(index), order);
@@ -158,6 +166,7 @@
     }
     for (index = firstQuadraticPointTest; index < quadraticPoints_count; ++index) {
         const SkDQuad& quad = quadraticPoints[index];
+        SkASSERT(ValidQuad(quad));
         SkDCubic cubic = quad.toCubic();
         order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics, SkReduceOrder::kFill_Style);
         if (order != 1) {
@@ -167,6 +176,7 @@
     }
     for (index = firstQuadraticLineTest; index < quadraticLines_count; ++index) {
         const SkDQuad& quad = quadraticLines[index];
+        SkASSERT(ValidQuad(quad));
         SkDCubic cubic = quad.toCubic();
         order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics, SkReduceOrder::kFill_Style);
         if (order != 2) {
@@ -176,6 +186,7 @@
     }
     for (index = firstQuadraticModLineTest; index < quadraticModEpsilonLines_count; ++index) {
         const SkDQuad& quad = quadraticModEpsilonLines[index];
+        SkASSERT(ValidQuad(quad));
         SkDCubic cubic = quad.toCubic();
         order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics, SkReduceOrder::kFill_Style);
         if (order != 3) {
@@ -187,6 +198,7 @@
     // test if computed line end points are valid
     for (index = firstComputedLinesTest; index < lines_count; ++index) {
         const SkDCubic& cubic = lines[index];
+        SkASSERT(ValidCubic(cubic));
         bool controlsInside = controls_inside(cubic);
         order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics,
                 SkReduceOrder::kStroke_Style);