Skip to content

Commit 3b3c6d3

Browse files
Merge pull request #723 from barendgehrels/test/mark_failures
[test] update testsuite
2 parents 4cab526 + a09b9f4 commit 3b3c6d3

21 files changed

Lines changed: 333 additions & 143 deletions

test/algorithms/buffer/buffer_countries.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,11 @@ int test_main(int, char* [])
239239
#if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_ORDER)
240240
test_all<false, bg::model::point<default_test_type, 2, bg::cs::cartesian> >();
241241
#endif
242-
242+
243+
#if defined(BOOST_GEOMETRY_TEST_FAILURES)
244+
BoostGeometryWriteExpectedFailures(1, BG_NO_FAILURES);
245+
#endif
246+
243247
return 0;
244248
}
245249

test/algorithms/buffer/buffer_linestring.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,5 +410,10 @@ int test_main(int, char* [])
410410
#if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE)
411411
test_invalid<true, bg::model::point<long double, 2, bg::cs::cartesian> >();
412412
#endif
413+
414+
#if defined(BOOST_GEOMETRY_TEST_FAILURES)
415+
BoostGeometryWriteExpectedFailures(2, 2);
416+
#endif
417+
413418
return 0;
414419
}

test/algorithms/buffer/buffer_linestring_aimes.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -446,12 +446,9 @@ void test_aimes()
446446
double aimes_width = static_cast<double>(width) / 1000000.0;
447447
for (int i = 0; i < n; i++)
448448
{
449-
#if ! defined(BOOST_GEOMETRY_USE_RESCALING) && ! defined(BOOST_GEOMETRY_TEST_FAILURES)
450-
if (i > 10)
451-
{
452-
// Several cases (11,20,40 etc) are still reported as invalid
453-
settings.test_validity = false;
454-
}
449+
#if ! defined(BOOST_GEOMETRY_USE_RESCALING)
450+
// Without rescaling, several cases are still reported as invalid
451+
settings.set_test_validity(i <= 10);
455452
#endif
456453
std::ostringstream name;
457454
try
@@ -485,5 +482,10 @@ int test_main(int, char* [])
485482

486483
test_aimes<bg::model::point<default_test_type, 2, bg::cs::cartesian> >();
487484

485+
#if defined(BOOST_GEOMETRY_TEST_FAILURES)
486+
// Non-rescaled reports 22 failures (failures in validity only)
487+
BoostGeometryWriteExpectedFailures(BG_NO_FAILURES, 22);
488+
#endif
489+
488490
return 0;
489491
}

test/algorithms/buffer/buffer_multi_linestring.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,10 @@ void test_all()
197197
test_one<multi_linestring_type, polygon>("mysql_23023665_1_20",
198198
mysql_23023665_1, join_round32, end_flat, 1, 1, 350.1135, 2.0);
199199

200-
#if ! defined(BOOST_GEOMETRY_USE_RESCALING)
200+
#if ! defined(BOOST_GEOMETRY_USE_RESCALING) || defined(BOOST_GEOMETRY_TEST_FAILURES)
201201
{
202-
ut_settings settings(10.0);
202+
// Cases failing with rescaling
203+
ut_settings settings(10.0, false);
203204
test_one<multi_linestring_type, polygon>("ticket_13444_1",
204205
ticket_13444, join_round32, end_round32, 3, 0, 11801.7832, 1.0, settings);
205206
test_one<multi_linestring_type, polygon>("ticket_13444_3",
@@ -222,5 +223,8 @@ int test_main(int, char* [])
222223
test_all<false, bg::model::point<default_test_type, 2, bg::cs::cartesian> >();
223224
#endif
224225

226+
#if defined(BOOST_GEOMETRY_TEST_FAILURES)
227+
BoostGeometryWriteExpectedFailures(10, BG_NO_FAILURES);
228+
#endif
225229
return 0;
226230
}

test/algorithms/buffer/buffer_multi_point.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,5 +220,9 @@ int test_main(int, char* [])
220220
std::cout << "Skipping some tests in debug or unknown mode" << std::endl;
221221
#endif
222222

223+
#if defined(BOOST_GEOMETRY_TEST_FAILURES)
224+
BoostGeometryWriteExpectedFailures(BG_NO_FAILURES);
225+
#endif
226+
223227
return 0;
224228
}

test/algorithms/buffer/buffer_multi_polygon.cpp

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,13 @@ static std::string const mysql_report_2015_07_05_1
307307
static std::string const mysql_report_2015_07_05_2
308308
= "MULTIPOLYGON(((19777 -21893,3.22595e+307 6.86823e+307,-40 -13,19777 -21893)),((-1322 4851,8.49998e+307 3.94481e+307,75 -69,8.64636e+307 3.94909e+307,-1.15292e+18 7.20576e+16,-1322 4851)))";
309309

310+
#if ! defined(BOOST_GEOMETRY_USE_RESCALING) \
311+
&& defined(BOOST_GEOMETRY_USE_KRAMER_RULE) \
312+
&& ! defined(BOOST_GEOMETRY_TEST_FAILURES)
313+
// These testcases are failing for non-rescaled Kramer rule
314+
#define BOOST_GEOMETRY_EXCLUDE
315+
#endif
316+
310317
template <bool Clockwise, typename P>
311318
void test_all()
312319
{
@@ -396,17 +403,13 @@ void test_all()
396403
test_one<multi_polygon_type, polygon_type>("rt_d", rt_d, join_miter, end_flat, 19.8823, 0.3);
397404
test_one<multi_polygon_type, polygon_type>("rt_e", rt_e, join_miter, end_flat, 15.1198, 0.3);
398405
test_one<multi_polygon_type, polygon_type>("rt_f", rt_f, join_miter, end_flat, 4.60853, 0.3);
399-
#if defined(BOOST_GEOMETRY_USE_RESCALING) || ! defined(BOOST_GEOMETRY_USE_KRAMER_RULE) || defined(BOOST_GEOMETRY_TEST_FAILURES)
400406
test_one<multi_polygon_type, polygon_type>("rt_g1", rt_g1, join_miter, end_flat, 30.3137, 1.0);
401407
test_one<multi_polygon_type, polygon_type>("rt_g2", rt_g2, join_miter, end_flat, 18.5711, 1.0);
402-
#endif
403408

404409
test_one<multi_polygon_type, polygon_type>("rt_h", rt_h, join_round, end_flat, 47.6012, 1.0);
405410
test_one<multi_polygon_type, polygon_type>("rt_h", rt_h, join_miter, end_flat, 61.7058, 1.0);
406411
test_one<multi_polygon_type, polygon_type>("rt_i", rt_i, join_round, end_flat, 10.7528, 1.0);
407-
#if defined(BOOST_GEOMETRY_USE_RESCALING) || ! defined(BOOST_GEOMETRY_USE_KRAMER_RULE) || defined(BOOST_GEOMETRY_TEST_FAILURES)
408412
test_one<multi_polygon_type, polygon_type>("rt_i", rt_i, join_miter, end_flat, 13.6569, 1.0);
409-
#endif
410413
test_one<multi_polygon_type, polygon_type>("rt_j", rt_j, join_round, end_flat, 28.7309, 1.0);
411414
test_one<multi_polygon_type, polygon_type>("rt_j", rt_j, join_miter, end_flat, 35.1421, 1.0);
412415
test_one<multi_polygon_type, polygon_type>("rt_k", rt_k, join_round, end_flat, 42.0092, 1.0);
@@ -437,9 +440,7 @@ void test_all()
437440
test_one<multi_polygon_type, polygon_type>("rt_p7", rt_p7, join_miter, end_flat, 26.2279, 1.0);
438441
#endif
439442

440-
#if defined(BOOST_GEOMETRY_USE_RESCALING) || ! defined(BOOST_GEOMETRY_USE_KRAMER_RULE) || defined(BOOST_GEOMETRY_TEST_FAILURES)
441443
test_one<multi_polygon_type, polygon_type>("rt_p8", rt_p8, join_miter, end_flat, 29.0563, 1.0);
442-
#endif
443444
test_one<multi_polygon_type, polygon_type>("rt_p9", rt_p9, join_miter, end_flat, 26.1421, 1.0);
444445
test_one<multi_polygon_type, polygon_type>("rt_p10", rt_p10, join_miter, end_flat, 23.3995, 1.0);
445446

@@ -448,21 +449,19 @@ void test_all()
448449
test_one<multi_polygon_type, polygon_type>("rt_p13", rt_p13, join_miter, end_flat, 19.9142, 1.0);
449450
test_one<multi_polygon_type, polygon_type>("rt_p14", rt_p14, join_miter, end_flat, 20.8284, 1.0);
450451
test_one<multi_polygon_type, polygon_type>("rt_p15", rt_p15, join_miter, end_flat, 23.6569, 1.0);
451-
#if defined(BOOST_GEOMETRY_USE_KRAMER) || defined(BOOST_GEOMETRY_TEST_FAILURES)
452452
test_one<multi_polygon_type, polygon_type>("rt_p16", rt_p16, join_miter, end_flat, 23.4853, 1.0);
453-
#endif
454453

455454
test_one<multi_polygon_type, polygon_type>("rt_p17", rt_p17, join_miter, end_flat, 25.3137, 1.0);
456455

457-
#if defined(BOOST_GEOMETRY_USE_RESCALING) || ! defined(BOOST_GEOMETRY_USE_KRAMER_RULE) || defined(BOOST_GEOMETRY_TEST_FAILURES)
456+
#if ! defined(BOOST_GEOMETRY_EXCLUDE)
458457
test_one<multi_polygon_type, polygon_type>("rt_p18", rt_p18, join_miter, end_flat, 23.3137, 1.0);
459458
#endif
460459
test_one<multi_polygon_type, polygon_type>("rt_p19", rt_p19, join_miter, end_flat, 25.5637, 1.0);
461-
#if defined(BOOST_GEOMETRY_USE_RESCALING) || ! defined(BOOST_GEOMETRY_USE_KRAMER_RULE) || defined(BOOST_GEOMETRY_TEST_FAILURES)
460+
#if ! defined(BOOST_GEOMETRY_EXCLUDE)
462461
test_one<multi_polygon_type, polygon_type>("rt_p20", rt_p20, join_miter, end_flat, 25.4853, 1.0);
463462
#endif
464463
test_one<multi_polygon_type, polygon_type>("rt_p21", rt_p21, join_miter, end_flat, 17.1716, 1.0);
465-
#if defined(BOOST_GEOMETRY_USE_RESCALING) || ! defined(BOOST_GEOMETRY_USE_KRAMER_RULE) || defined(BOOST_GEOMETRY_TEST_FAILURES)
464+
#if ! defined(BOOST_GEOMETRY_EXCLUDE)
466465
test_one<multi_polygon_type, polygon_type>("rt_p22", rt_p22, join_miter, end_flat, 26.5711, 1.0);
467466
#endif
468467

@@ -471,13 +470,11 @@ void test_all()
471470
test_one<multi_polygon_type, polygon_type>("rt_q2", rt_q2, join_miter, end_flat, 0.9697, -0.25);
472471

473472
test_one<multi_polygon_type, polygon_type>("rt_r", rt_r, join_miter, end_flat, 21.0761, 1.0);
474-
#if defined(BOOST_GEOMETRY_USE_RESCALING) || ! defined(BOOST_GEOMETRY_USE_KRAMER_RULE) || defined(BOOST_GEOMETRY_TEST_FAILURES)
473+
#if ! defined(BOOST_GEOMETRY_EXCLUDE)
475474
test_one<multi_polygon_type, polygon_type>("rt_s1", rt_s1, join_miter, end_flat, 20.4853, 1.0);
476475
#endif
477476

478-
#if defined(BOOST_GEOMETRY_USE_KRAMER) || defined(BOOST_GEOMETRY_TEST_FAILURES)
479477
test_one<multi_polygon_type, polygon_type>("rt_s2", rt_s2, join_miter, end_flat, 24.6495, 1.0);
480-
#endif
481478

482479
test_one<multi_polygon_type, polygon_type>("rt_t1", rt_t, join_miter, end_flat, 15.6569, 1.0);
483480
test_one<multi_polygon_type, polygon_type>("rt_t2", rt_t, join_miter, end_flat, 0.1679, -0.25);
@@ -496,17 +493,15 @@ void test_all()
496493

497494
test_one<multi_polygon_type, polygon_type>("rt_u8", rt_u8, join_miter, end_flat, 70.9142, 1.0);
498495
test_one<multi_polygon_type, polygon_type>("rt_u9", rt_u9, join_miter, end_flat, 59.3063, 1.0);
499-
#if defined(BOOST_GEOMETRY_USE_RESCALING) || defined(BOOST_GEOMETRY_TEST_FAILURES)
500-
test_one<multi_polygon_type, polygon_type>("rt_u10", rt_u10, join_miter, end_flat, 144.0858, 1.0); // PG: 144.085786772487
501-
#endif
502-
test_one<multi_polygon_type, polygon_type>("rt_u10_51", rt_u10, join_miter, end_flat, 0.1674, -0.51); // PG: 0.167380307629637
496+
test_one<multi_polygon_type, polygon_type>("rt_u10", rt_u10, join_miter, end_flat, 144.0858, 1.0);
497+
test_one<multi_polygon_type, polygon_type>("rt_u10_51", rt_u10, join_miter, end_flat, 0.1674, -0.51);
503498
test_one<multi_polygon_type, polygon_type>("rt_u10_c_51", rt_u10_c, join_miter, end_flat, 0.066952, -0.51);
504499

505-
506-
// TODO: now one small triangle missing due to clusters/uu turns
507-
test_one<multi_polygon_type, polygon_type>("rt_u10_50", rt_u10, join_miter, end_flat, 0.2145, -0.50, ut_settings::ignore_validity()); // PG: 0.214466094067263
508-
test_one<multi_polygon_type, polygon_type>("rt_u10_45", rt_u10, join_miter, end_flat, 1.3000, -0.45); // PG: 1.30004221251301
509-
test_one<multi_polygon_type, polygon_type>("rt_u10_25", rt_u10, join_miter, end_flat, 9.6682, -0.25); // PG: 9.66820888343117
500+
test_one<multi_polygon_type, polygon_type>("rt_u10_51", rt_u10, join_miter, end_flat, 0.1674, -0.51);
501+
// TODO: invalid - making a bow-tie
502+
test_one<multi_polygon_type, polygon_type>("rt_u10_50", rt_u10, join_miter, end_flat, 0.2145, -0.50, ut_settings::ignore_validity()); // False positive
503+
test_one<multi_polygon_type, polygon_type>("rt_u10_45", rt_u10, join_miter, end_flat, 1.3000, -0.45);
504+
test_one<multi_polygon_type, polygon_type>("rt_u10_25", rt_u10, join_miter, end_flat, 9.6682, -0.25);
510505

511506
test_one<multi_polygon_type, polygon_type>("rt_u11", rt_u11, join_miter, end_flat, 131.3995, 1.0);
512507
test_one<multi_polygon_type, polygon_type>("rt_u11_50", rt_u11, join_miter, end_flat, 0.04289, -0.50);
@@ -555,5 +550,9 @@ int test_main(int, char* [])
555550
test_all<false, bg::model::point<default_test_type, 2, bg::cs::cartesian> >();
556551
#endif
557552

553+
#if defined(BOOST_GEOMETRY_TEST_FAILURES)
554+
BoostGeometryWriteExpectedFailures(1, 9);
555+
#endif
556+
558557
return 0;
559558
}

test/algorithms/buffer/buffer_point.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,10 @@ int test_main(int, char* [])
3737
#if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_ORDER)
3838
test_all<false, bg::model::point<default_test_type, 2, bg::cs::cartesian> >();
3939
#endif
40+
41+
#if defined(BOOST_GEOMETRY_TEST_FAILURES)
42+
BoostGeometryWriteExpectedFailures(BG_NO_FAILURES);
43+
#endif
44+
4045
return 0;
4146
}

test/algorithms/buffer/buffer_polygon.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ void test_all()
533533

534534
{
535535
ut_settings settings;
536-
settings.test_validity = false;
536+
settings.set_test_validity(false);
537537

538538
// Tickets
539539
test_one<polygon_type, polygon_type>("ticket_10398_1_5", ticket_10398_1, join_miter, end_flat, 494.7192, 0.5, settings);
@@ -591,7 +591,7 @@ void test_all()
591591
// Test issue 555 as reported (-0.000001) and some variants
592592
bg::strategy::buffer::join_round jr(180);
593593
bg::strategy::buffer::end_round er(180);
594-
#if ! defined(BOOST_GEOMETRY_USE_RESCALING)
594+
#if ! defined(BOOST_GEOMETRY_USE_RESCALING) || defined(BOOST_GEOMETRY_TEST_FAILURES)
595595
// With rescaling the interior ring is missing
596596
test_one<polygon_type, polygon_type>("issue_555", issue_555, jr, er, 4520.7942, -0.000001);
597597
#endif
@@ -866,6 +866,10 @@ int test_main(int, char* [])
866866
test_all<bg::model::point<tt, 2, bg::cs::cartesian> >();
867867
#endif
868868

869+
#endif
870+
871+
#if defined(BOOST_GEOMETRY_TEST_FAILURES)
872+
BoostGeometryWriteExpectedFailures(2, 1);
869873
#endif
870874

871875
return 0;

test/algorithms/buffer/test_buffer.hpp

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -95,17 +95,11 @@ template<> struct EndTestProperties<boost::geometry::strategy::buffer::end_flat>
9595
static std::string name() { return "flat"; }
9696
};
9797

98-
struct ut_settings
98+
struct ut_settings : public ut_base_settings
9999
{
100-
double tolerance;
101-
bool test_validity;
102-
bool test_area;
103-
bool use_ln_area;
104-
int points_per_circle;
105-
106100
explicit ut_settings(double tol = 0.01, bool val = true, int points = 88)
107-
: tolerance(tol)
108-
, test_validity(val)
101+
: ut_base_settings(val)
102+
, tolerance(tol)
109103
, test_area(true)
110104
, use_ln_area(false)
111105
, points_per_circle(points)
@@ -114,19 +108,24 @@ struct ut_settings
114108
static inline ut_settings ignore_validity()
115109
{
116110
ut_settings result;
117-
result.test_validity = false;
111+
result.set_test_validity(false);
118112
return result;
119113
}
120114

121115
static inline ut_settings assertions_only()
122116
{
123117
ut_settings result;
124-
result.test_validity = false;
125118
result.test_area = false;
119+
result.set_test_validity(false);
126120
return result;
127121
}
128122

129123
static inline double ignore_area() { return 9999.9; }
124+
125+
double tolerance;
126+
bool test_area;
127+
bool use_ln_area;
128+
int points_per_circle;
130129
};
131130

132131
template
@@ -349,14 +348,9 @@ void test_buffer(std::string const& caseid,
349348
// }
350349
}
351350

352-
#if ! defined(BOOST_GEOMETRY_TEST_ALWAYS_CHECK_VALIDITY)
353-
if (settings.test_validity)
354-
#endif
351+
if (settings.test_validity() && ! bg::is_valid(buffered))
355352
{
356-
if (! bg::is_valid(buffered))
357-
{
358-
BOOST_CHECK_MESSAGE(bg::is_valid(buffered), complete.str() << " is not valid");
359-
}
353+
BOOST_CHECK_MESSAGE(bg::is_valid(buffered), complete.str() << " is not valid");
360354
}
361355

362356
#if defined(TEST_WITH_SVG_PER_TURN)
@@ -472,10 +466,12 @@ void test_one(std::string const& caseid, std::string const& wkt,
472466
expected_count, expected_holes_count, expected_area,
473467
settings);
474468

475-
#if !defined(BOOST_GEOMETRY_COMPILER_MODE_DEBUG) && defined(BOOST_GEOMETRY_COMPILER_MODE_RELEASE)
469+
#if !defined(BOOST_GEOMETRY_COMPILER_MODE_DEBUG) \
470+
&& !defined(BOOST_GEOMETRY_TEST_ONLY_ONE_ORDER) \
471+
&& defined(BOOST_GEOMETRY_COMPILER_MODE_RELEASE)
476472

477473
// Also test symmetric distance strategy if right-distance is not specified
478-
// (only in release mode)
474+
// (only in release mode, not if "one order" if speficied)
479475
if (bg::math::equals(distance_right, same_distance))
480476
{
481477
bg::strategy::buffer::distance_symmetric

0 commit comments

Comments
 (0)