int main (int argc, const char **argv) { int res = 0; size_t i, j; for (i = 0; i < num_angle_tests; i ++) { if (!test_angle (test_angles[i])) res = 1; } for (i = 0; i < num_angle_tests; i ++) { for (j = 0; j < num_scale_tests; j ++) { if (!test_transform (test_angles[i], test_scales[j])) res = 1; } } for (i = 0; i < num_angle_tests; i ++) { for (j = 0; j < num_scale_tests; j ++) { if (!test_transform2 (test_angles[i], test_scales[j])) res = 1; } } for (i = 0; i < num_angle_tests; i ++) { for (j = 0; j < num_scale_tests; j ++) { if (!test_inverse (test_angles[i], test_scales[j])) res = 1; } } return res; }
int main(int argc, char **argv) { int i; char testfile[NC_MAX_NAME + 1]; printf("\n*** Testing coordinate systems.\n"); /*nc_set_log_level(3);*/ /* Go thru formats and run all tests for each of two (for netCDF-3 * only builds), or 3 (for netCDF-4 builds) different formats. */ for (i = NUM_FORMATS; i >= 1; i--) { switch (i) { case NC_FORMAT_CLASSIC: nc_set_default_format(NC_FORMAT_CLASSIC, NULL); fprintf(stderr, "\nSwitching to netCDF classic format.\n"); strcpy(testfile, "tst_coords_classic.nc"); break; case NC_FORMAT_64BIT: nc_set_default_format(NC_FORMAT_64BIT, NULL); fprintf(stderr, "\nSwitching to 64-bit offset format.\n"); strcpy(testfile, "tst_coords_64bit.nc"); break; #ifdef USE_NETCDF4 case NC_FORMAT_NETCDF4_CLASSIC: nc_set_default_format(NC_FORMAT_NETCDF4_CLASSIC, NULL); strcpy(testfile, "tst_coords_netcdf4_classic.nc"); fprintf(stderr, "\nSwitching to netCDF-4 format (with NC_CLASSIC_MODEL).\n"); break; case NC_FORMAT_NETCDF4: /* actually it's _CLASSIC. */ nc_set_default_format(NC_FORMAT_NETCDF4, NULL); strcpy(testfile, "tst_coords_netcdf4.nc"); fprintf(stderr, "\nSwitching to netCDF-4 format.\n"); break; #endif default: fprintf(stderr, "Unexpected format!\n"); return 2; } printf("*** creating coordinate axis..."); test_axis(testfile); SUMMARIZE_ERR; printf("*** creating coordinate system..."); test_system(testfile); SUMMARIZE_ERR; printf("*** assigning a coordinate system..."); test_system_assign(testfile); SUMMARIZE_ERR; printf("*** creating coordinate transform..."); test_transform(testfile); SUMMARIZE_ERR; printf("*** assigning a coordinate transform..."); test_transform_assign(testfile); SUMMARIZE_ERR; } FINAL_RESULTS; }
void TestPath(skiatest::Reporter* reporter) { { SkSize size; size.fWidth = 3.4f; size.width(); size = SkSize::Make(3,4); SkISize isize = SkISize::Make(3,4); } SkTSize<SkScalar>::Make(3,4); SkPath p, p2; SkRect bounds, bounds2; REPORTER_ASSERT(reporter, p.isEmpty()); REPORTER_ASSERT(reporter, 0 == p.countPoints()); REPORTER_ASSERT(reporter, 0 == p.getSegmentMasks()); REPORTER_ASSERT(reporter, p.isConvex()); REPORTER_ASSERT(reporter, p.getFillType() == SkPath::kWinding_FillType); REPORTER_ASSERT(reporter, !p.isInverseFillType()); REPORTER_ASSERT(reporter, p == p2); REPORTER_ASSERT(reporter, !(p != p2)); REPORTER_ASSERT(reporter, p.getBounds().isEmpty()); bounds.set(0, 0, SK_Scalar1, SK_Scalar1); p.addRoundRect(bounds, SK_Scalar1, SK_Scalar1); check_convex_bounds(reporter, p, bounds); // we have quads or cubics REPORTER_ASSERT(reporter, p.getSegmentMasks() & kCurveSegmentMask); REPORTER_ASSERT(reporter, !p.isEmpty()); p.reset(); REPORTER_ASSERT(reporter, 0 == p.getSegmentMasks()); REPORTER_ASSERT(reporter, p.isEmpty()); p.addOval(bounds); check_convex_bounds(reporter, p, bounds); REPORTER_ASSERT(reporter, !p.isEmpty()); p.reset(); p.addRect(bounds); check_convex_bounds(reporter, p, bounds); // we have only lines REPORTER_ASSERT(reporter, SkPath::kLine_SegmentMask == p.getSegmentMasks()); REPORTER_ASSERT(reporter, !p.isEmpty()); REPORTER_ASSERT(reporter, p != p2); REPORTER_ASSERT(reporter, !(p == p2)); // does getPoints return the right result REPORTER_ASSERT(reporter, p.getPoints(NULL, 5) == 4); SkPoint pts[4]; int count = p.getPoints(pts, 4); REPORTER_ASSERT(reporter, count == 4); bounds2.set(pts, 4); REPORTER_ASSERT(reporter, bounds == bounds2); bounds.offset(SK_Scalar1*3, SK_Scalar1*4); p.offset(SK_Scalar1*3, SK_Scalar1*4); REPORTER_ASSERT(reporter, bounds == p.getBounds()); REPORTER_ASSERT(reporter, p.isRect(NULL)); bounds2.setEmpty(); REPORTER_ASSERT(reporter, p.isRect(&bounds2)); REPORTER_ASSERT(reporter, bounds == bounds2); // now force p to not be a rect bounds.set(0, 0, SK_Scalar1/2, SK_Scalar1/2); p.addRect(bounds); REPORTER_ASSERT(reporter, !p.isRect(NULL)); test_isRect(reporter); SkPoint pt; p.moveTo(SK_Scalar1, 0); p.getLastPt(&pt); REPORTER_ASSERT(reporter, pt.fX == SK_Scalar1); REPORTER_ASSERT(reporter, !p.isEmpty()); test_zero_length_paths(reporter); test_convexity(reporter); test_convexity2(reporter); test_close(reporter); p.reset(); p.moveTo(0, 0); p.quadTo(100, 100, 200, 200); REPORTER_ASSERT(reporter, SkPath::kQuad_SegmentMask == p.getSegmentMasks()); REPORTER_ASSERT(reporter, !p.isEmpty()); p.cubicTo(100, 100, 200, 200, 300, 300); REPORTER_ASSERT(reporter, kCurveSegmentMask == p.getSegmentMasks()); REPORTER_ASSERT(reporter, !p.isEmpty()); p.reset(); p.moveTo(0, 0); p.cubicTo(100, 100, 200, 200, 300, 300); REPORTER_ASSERT(reporter, SkPath::kCubic_SegmentMask == p.getSegmentMasks()); REPORTER_ASSERT(reporter, !p.isEmpty()); test_flattening(reporter); test_transform(reporter); test_bounds(reporter); }