skia2/experimental/Intersection/QuadraticReduceOrder_Test.cpp
caryclark@google.com c682590538 save work in progress
git-svn-id: http://skia.googlecode.com/svn/trunk@3141 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-02-03 22:07:47 +00:00

39 lines
1.2 KiB
C++

#include "CurveIntersection.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);
}
}
}