23 double A,
double B,
double C,
double D,
25 bool skipPathops =
false,
26 bool skipRootValidation =
false) {
30 "Invalid test case, up to 3 roots allowed");
32 for (
size_t i = 0;
i < expectedRoots.
size();
i++) {
33 double x = expectedRoots[
i];
36 if (!skipRootValidation) {
38 "Invalid test case root %zu. %.16f != 0",
i,
y);
43 "Invalid test case root %zu. Roots should be sorted in ascending order",
i);
51 double roots[3] = {0, 0, 0};
54 "Wrong number of roots returned %zu != %d", expectedRoots.
size(),
60 for (
int i = 0;
i < rootCount;
i++) {
63 "0 != %.16f at index %d",
roots[
i],
i);
67 "%.16f != %.16f at index %d", expectedRoots[
i],
roots[
i],
i);
73 double roots[3] = {0, 0, 0};
76 "Wrong number of roots returned %zu != %d", expectedRoots.
size(),
82 for (
int i = 0;
i < rootCount;
i++) {
85 "0 != %.16f at index %d",
roots[
i],
i);
89 "%.16f != %.16f at index %d", expectedRoots[
i],
roots[
i],
i);
100 {-1.650629191439388});
149 {-0.8507810593582122,
157 -0.33790159225463867, -0.81997990608215332,
158 -0.66327774524688721, -0.17884063720703125,
159 {-0.7995944894729731});
166 sk_bit_cast<double>(0xbf1a8de580000000),
167 sk_bit_cast<double>(0x4106c0c680000000),
169 sk_bit_cast<double>(0xc104c0ce80000000),
170 { -0.9550418733785169,
177 sk_bit_cast<double>(0x3c04040400000000),
178 sk_bit_cast<double>(0x4106c0c680000000),
180 sk_bit_cast<double>(0xc104c0ce80000000),
181 { -0.9550418733785169,
188 sk_bit_cast<double>(0x3eb0000000000000),
189 sk_bit_cast<double>(0x409278a560000000),
191 sk_bit_cast<double>(0xc092706160000000),
192 { -0.9991256228290017,
204 {-0.8507810593582122,
212 {-0.8507810593582122,
224 0, -0.01, 200000000000000, -120000000000000,
232 {-1.333333333333333});
251 double roots[3] = {0, 0, 0};
273 sk_bit_cast<double>(0xd5422020202020ff),
274 sk_bit_cast<double>(0x600fff202020ff20),
282 sk_bit_cast<double>(0xffffffffffff2020),
283 sk_bit_cast<double>(0x20202020202020ff),
284 sk_bit_cast<double>(0xff20202020202020),
291 double A,
double B,
double C,
double D,
296 "Invalid test case, up to 3 roots allowed");
298 for (
size_t i = 0;
i < expectedRoots.
size();
i++) {
299 double x = expectedRoots[
i];
301 "Invalid test case root %zu. Roots must be in [0, 1]",
i);
306 "Invalid test case root %zu. %.16f != 0",
i,
y);
310 "Invalid test case root %zu. Roots should be sorted in ascending order",
i);
316 double roots[3] = {0, 0, 0};
319 "Wrong number of roots returned %zu != %d",
320 expectedRoots.
size(), rootCount);
325 for (
int i = 0;
i < rootCount;
i++) {
328 "0 != %.16f at index %d",
roots[
i],
i);
332 "%.16f != %.16f at index %d", expectedRoots[
i],
roots[
i],
i);
338 double roots[3] = {0, 0, 0};
341 "Wrong number of roots returned %zu != %d",
342 expectedRoots.
size(), rootCount);
347 for (
int i = 0;
i < rootCount;
i++) {
350 "0 != %.16f at index %d",
roots[
i],
i);
354 "%.16f != %.16f at index %d", expectedRoots[
i],
roots[
i],
i);
360 double roots[3] = {0, 0, 0};
363 "Wrong number of roots returned %zu != %d", expectedRoots.
size(),
369 for (
int i = 0;
i < rootCount;
i++) {
375 "%.16f != %.16f at index %d", expectedRoots[
i],
roots[
i],
i);
427 double D = -0.0000100005;
428 double roots[3] = {0, 0, 0};
444 double roots[3] = {0, 0, 0};
static void testCubicValidT(skiatest::Reporter *reporter, std::string name, double A, double B, double C, double D, SkSpan< const double > expectedRoots)
DEF_TEST(CubicRootsReal_ActualCubics, reporter)
static void testCubicRootsReal(skiatest::Reporter *reporter, std::string name, double A, double B, double C, double D, SkSpan< const double > expectedRoots, bool skipPathops=false, bool skipRootValidation=false)
bool sk_double_nearly_zero(double a)
bool sk_doubles_nearly_equal_ulps(double a, double b, uint8_t maxUlpsDiff=16)
static std::vector< SkPDFIndirectReference > sort(const THashSet< SkPDFIndirectReference > &src)
#define REPORTER_ASSERT(r, cond,...)
static int BinarySearchRootsValidT(double A, double B, double C, double D, double solution[3])
static int RootsValidT(double A, double B, double C, double D, double solution[3])
static int RootsReal(double A, double B, double C, double D, double solution[3])
constexpr size_t size() const
static const char * begin(const StringSlice &s)
DEF_SWITCHES_START aot vmservice shared library name
SIN Vec< N, float > abs(const Vec< N, float > &x)
static int RootsReal(double A, double B, double C, double D, double t[3])
static int RootsValidT(const double A, const double B, const double C, double D, double s[3])