Skip to content

Commit 9989780

Browse files
Merge pull request boostorg#758 from barendgehrels/test/add_limits
Conform the countset, replace many #ifdefs with expectation limits
2 parents 4c1a7f8 + 5f67777 commit 9989780

19 files changed

+532
-505
lines changed

test/algorithms/buffer/buffer_countries.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ int test_main(int, char* [])
241241
#endif
242242

243243
#if defined(BOOST_GEOMETRY_TEST_FAILURES)
244-
BoostGeometryWriteExpectedFailures(1, BG_NO_FAILURES);
244+
BoostGeometryWriteExpectedFailures(1, BG_NO_FAILURES, 2, BG_NO_FAILURES);
245245
#endif
246246

247247
return 0;

test/algorithms/buffer/buffer_linestring.cpp

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ void test_all()
113113
{
114114
typedef bg::model::linestring<P> linestring;
115115
typedef bg::model::polygon<P, Clockwise> polygon;
116+
typedef typename bg::coordinate_type<P>::type coor_type;
116117

117118
bg::strategy::buffer::join_miter join_miter;
118119
bg::strategy::buffer::join_round join_round(100);
@@ -138,23 +139,23 @@ void test_all()
138139
test_one<linestring, polygon>("simplex_vertical32", simplex_vertical, join_round32, end_round32, 5.12145, 1);
139140
test_one<linestring, polygon>("simplex_horizontal32", simplex_horizontal, join_round32, end_round32, 5.12145, 1);
140141

141-
test_one<linestring, polygon>("simplex_asym_neg", simplex, join_miter, end_flat, 3.202, +1.5, settings, -1.0);
142-
test_one<linestring, polygon>("simplex_asym_pos", simplex, join_miter, end_flat, 3.202, -1.0, settings, +1.5);
142+
test_one<linestring, polygon>("simplex_asym_neg", simplex, join_miter, end_flat, 3.2016, +1.5, settings, -1.0);
143+
test_one<linestring, polygon>("simplex_asym_pos", simplex, join_miter, end_flat, 3.2016, -1.0, settings, +1.5);
143144
// Do not work yet:
144145
// test_one<linestring, polygon>("simplex_asym_neg", simplex, join_miter, end_round, 3.202, +1.5, settings, -1.0);
145146
// test_one<linestring, polygon>("simplex_asym_pos", simplex, join_miter, end_round, 3.202, -1.0, settings, +1.5);
146147

147148
// Generates (initially) a reversed polygon, with a negative area, which is reversed afterwards in assign_parents
148-
test_one<linestring, polygon>("simplex_asym_neg_rev", simplex, join_miter, end_flat, 3.202, +1.0, settings, -1.5);
149-
test_one<linestring, polygon>("simplex_asym_pos_rev", simplex, join_miter, end_flat, 3.202, -1.5, settings, +1.0);
149+
test_one<linestring, polygon>("simplex_asym_neg_rev", simplex, join_miter, end_flat, 3.2016, +1.0, settings, -1.5);
150+
test_one<linestring, polygon>("simplex_asym_pos_rev", simplex, join_miter, end_flat, 3.2016, -1.5, settings, +1.0);
150151

151152
test_one<linestring, polygon>("straight", straight, join_round, end_flat, 38.4187, 1.5);
152153
test_one<linestring, polygon>("straight", straight, join_miter, end_flat, 38.4187, 1.5);
153154

154155
// One bend/two bends (tests join-type)
155-
test_one<linestring, polygon>("one_bend", one_bend, join_round, end_flat, 28.488, 1.5);
156+
test_one<linestring, polygon>("one_bend", one_bend, join_round, end_flat, 28.496, 1.5);
156157
test_one<linestring, polygon>("one_bend", one_bend, join_miter, end_flat, 28.696, 1.5);
157-
test_one<linestring, polygon>("one_bend", one_bend, join_round_by_divide, end_flat, 28.488, 1.5);
158+
test_one<linestring, polygon>("one_bend", one_bend, join_round_by_divide, end_flat, 28.497, 1.5);
158159

159160
test_one<linestring, polygon>("one_bend", one_bend, join_round, end_round, 35.5603, 1.5);
160161
test_one<linestring, polygon>("one_bend", one_bend, join_miter, end_round, 35.7601, 1.5);
@@ -163,7 +164,7 @@ void test_all()
163164
test_one<linestring, polygon>("two_bends", two_bends, join_round, end_flat, 39.235, 1.5);
164165
test_one<linestring, polygon>("two_bends", two_bends, join_round_by_divide, end_flat, 39.235, 1.5);
165166
test_one<linestring, polygon>("two_bends", two_bends, join_miter, end_flat, 39.513, 1.5);
166-
test_one<linestring, polygon>("two_bends_left", two_bends, join_round, end_flat, 20.028, 1.5, settings, 0.0);
167+
test_one<linestring, polygon>("two_bends_left", two_bends, join_round, end_flat, 20.025, 1.5, settings, 0.0);
167168
test_one<linestring, polygon>("two_bends_left", two_bends, join_miter, end_flat, 20.225, 1.5, settings, 0.0);
168169
test_one<linestring, polygon>("two_bends_right", two_bends, join_round, end_flat, 19.211, 0.0, settings, 1.5);
169170
test_one<linestring, polygon>("two_bends_right", two_bends, join_miter, end_flat, 19.288, 0.0, settings, 1.5);
@@ -207,8 +208,8 @@ void test_all()
207208
test_one<linestring, polygon>("chained4", chained4, join_round, end_flat, 22.6274, 2.5, settings, 1.5);
208209

209210
test_one<linestring, polygon>("field_sprayer1", field_sprayer1, join_round, end_flat, 324.3550, 16.5, settings, 6.5);
210-
test_one<linestring, polygon>("field_sprayer1", field_sprayer1, join_round, end_round, 718.761877, 16.5, settings, 6.5);
211-
test_one<linestring, polygon>("field_sprayer1", field_sprayer1, join_miter, end_round, 718.939628, 16.5, settings, 6.5);
211+
test_one<linestring, polygon>("field_sprayer1", field_sprayer1, join_round, end_round, {718.686, 718.762}, 16.5, settings, 6.5);
212+
test_one<linestring, polygon>("field_sprayer1", field_sprayer1, join_miter, end_round, {718.845, 718.940}, 16.5, settings, 6.5);
212213

213214
test_one<linestring, polygon>("degenerate0", degenerate0, join_round, end_round, 0.0, 3.0);
214215
test_one<linestring, polygon>("degenerate1", degenerate1, join_round, end_round, 28.25, 3.0);
@@ -254,8 +255,9 @@ void test_all()
254255
}
255256

256257
{
257-
// Check on validity, with high precision because areas are all very small
258-
ut_settings settings(1.0e-10, true);
258+
ut_settings settings;
259+
settings.tolerance = 0.1;
260+
settings.use_ln_area = true;
259261

260262
test_one<linestring, polygon>("aimes120", aimes120, join_miter, end_flat, 1.62669948622351512e-08, 0.000018, settings);
261263
test_one<linestring, polygon>("aimes120", aimes120, join_round, end_round, 1.72842078427493107e-08, 0.000018, settings);
@@ -299,9 +301,12 @@ void test_all()
299301
27862.733459829971,
300302
5.9518403867035365);
301303

302-
test_one<linestring, polygon>("mysql_report_2015_09_08a", mysql_report_2015_09_08a, join_round32, end_round32, 0.0, 1.0);
303-
test_one<linestring, polygon>("mysql_report_2015_09_08b", mysql_report_2015_09_08b, join_round32, end_round32, 0.0, 1099511627778.0);
304-
test_one<linestring, polygon>("mysql_report_2015_09_08c", mysql_report_2015_09_08c, join_round32, end_round32, 0.0, 0xbe);
304+
if (BOOST_GEOMETRY_CONDITION((boost::is_same<coor_type, double>::value)))
305+
{
306+
test_one<linestring, polygon>("mysql_report_2015_09_08a", mysql_report_2015_09_08a, join_round32, end_round32, 0.0, 1.0);
307+
test_one<linestring, polygon>("mysql_report_2015_09_08b", mysql_report_2015_09_08b, join_round32, end_round32, 0.0, 1099511627778.0);
308+
test_one<linestring, polygon>("mysql_report_2015_09_08c", mysql_report_2015_09_08c, join_round32, end_round32, 0.0, 0xbe);
309+
}
305310

306311
test_one<linestring, polygon>("mysql_23023665_1", mysql_23023665, join_round32, end_flat, 459.1051, 10);
307312
test_one<linestring, polygon>("mysql_23023665_2", mysql_23023665, join_round32, end_flat, 6877.7097, 50);
@@ -372,6 +377,11 @@ void test_all()
372377
template <bool Clockwise, typename P>
373378
void test_invalid()
374379
{
380+
typedef typename bg::coordinate_type<P>::type coor_type;
381+
if (! BOOST_GEOMETRY_CONDITION((boost::is_same<coor_type, double>::value)))
382+
{
383+
return;
384+
}
375385
typedef bg::model::linestring<P> linestring;
376386
typedef bg::model::polygon<P, Clockwise> polygon;
377387

@@ -408,7 +418,7 @@ int test_main(int, char* [])
408418
#endif
409419

410420
#if defined(BOOST_GEOMETRY_TEST_FAILURES)
411-
BoostGeometryWriteExpectedFailures(2, 2);
421+
BoostGeometryWriteExpectedFailures(2, 2, 15, 2);
412422
#endif
413423

414424
return 0;

test/algorithms/buffer/buffer_linestring_aimes.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -455,10 +455,6 @@ void test_aimes()
455455
double aimes_width = static_cast<double>(width) / 1000000.0;
456456
for (int i = 0; i < n; i++)
457457
{
458-
#if ! defined(BOOST_GEOMETRY_USE_RESCALING)
459-
// Without rescaling, several cases are still reported as invalid
460-
settings.set_test_validity(i <= 10);
461-
#endif
462458
std::ostringstream name;
463459
try
464460
{
@@ -492,8 +488,8 @@ int test_main(int, char* [])
492488
test_aimes<bg::model::point<default_test_type, 2, bg::cs::cartesian> >();
493489

494490
#if defined(BOOST_GEOMETRY_TEST_FAILURES)
495-
// Non-rescaled reports failures, but in validity only
496-
BoostGeometryWriteExpectedFailures(BG_NO_FAILURES, 4);
491+
// Type float is not supported for these cases
492+
BoostGeometryWriteExpectedFailures(BG_NO_FAILURES, BG_NO_FAILURES);
497493
#endif
498494

499495
return 0;

test/algorithms/buffer/buffer_multi_linestring.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ int test_main(int, char* [])
226226
#endif
227227

228228
#if defined(BOOST_GEOMETRY_TEST_FAILURES)
229-
BoostGeometryWriteExpectedFailures(9, BG_NO_FAILURES);
229+
BoostGeometryWriteExpectedFailures(9, BG_NO_FAILURES, 12, BG_NO_FAILURES);
230230
#endif
231231
return 0;
232232
}

test/algorithms/buffer/buffer_multi_polygon.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
#include "test_buffer.hpp"
1515

16-
1716
static std::string const simplex
1817
= "MULTIPOLYGON(((0 1,2 5,5 3,0 1)),((1 1,5 2,5 0,1 1)))";
1918

@@ -338,7 +337,7 @@ void test_all()
338337

339338
test_one<multi_polygon_type, polygon_type>("multi_simplex_01", simplex, join_round, end_flat, 9.7514, -0.1);
340339
test_one<multi_polygon_type, polygon_type>("multi_simplex_05", simplex, join_round, end_flat, 3.2019, -0.5);
341-
test_one<multi_polygon_type, polygon_type>("multi_simplex_10", simplex, join_round, end_flat, 0.2012, -1.0);
340+
test_one<multi_polygon_type, polygon_type>("multi_simplex_10", simplex, join_round, end_flat, 0.20116, -1.0);
342341
test_one<multi_polygon_type, polygon_type>("multi_simplex_12", simplex, join_round, end_flat, 0.0, -1.2);
343342

344343
test_one<multi_polygon_type, polygon_type>("zonethru_05", zonethru, join_round, end_flat, 67.4627, 0.5);
@@ -382,7 +381,7 @@ void test_all()
382381
test_one<multi_polygon_type, polygon_type>("degenerate1", degenerate1, join_round, end_flat, 5.708, 1.0);
383382
test_one<multi_polygon_type, polygon_type>("degenerate2", degenerate2, join_round, end_flat, 133.0166, 0.75);
384383

385-
test_one<multi_polygon_type, polygon_type>("rt_a", rt_a, join_round, end_flat, 34.5381, 1.0);
384+
test_one<multi_polygon_type, polygon_type>("rt_a", rt_a, join_round, end_flat, 34.53437, 1.0);
386385
test_one<multi_polygon_type, polygon_type>("rt_a", rt_a, join_miter, end_flat, 36.0, 1.0);
387386
test_one<multi_polygon_type, polygon_type>("rt_b", rt_b, join_round, end_flat, 31.4186, 1.0);
388387
test_one<multi_polygon_type, polygon_type>("rt_b", rt_b, join_miter, end_flat, 34.0, 1.0);
@@ -476,20 +475,22 @@ void test_all()
476475
test_one<multi_polygon_type, polygon_type>("rt_u8", rt_u8, join_miter, end_flat, 70.9142, 1.0);
477476
test_one<multi_polygon_type, polygon_type>("rt_u9", rt_u9, join_miter, end_flat, 59.3063, 1.0);
478477
test_one<multi_polygon_type, polygon_type>("rt_u10", rt_u10, join_miter, end_flat, 144.0858, 1.0);
479-
test_one<multi_polygon_type, polygon_type>("rt_u10_51", rt_u10, join_miter, end_flat, 0.1674, -0.51);
478+
test_one<multi_polygon_type, polygon_type>("rt_u10_51", rt_u10, join_miter, end_flat, 0.16738, -0.51);
480479
test_one<multi_polygon_type, polygon_type>("rt_u10_c_51", rt_u10_c, join_miter, end_flat, 0.066952, -0.51);
481480

482-
test_one<multi_polygon_type, polygon_type>("rt_u10_51", rt_u10, join_miter, end_flat, 0.1674, -0.51);
483481
// TODO: invalid - making a bow-tie
484-
test_one<multi_polygon_type, polygon_type>("rt_u10_50", rt_u10, join_miter, end_flat, 0.2145, -0.50, ut_settings::ignore_validity());
482+
test_one<multi_polygon_type, polygon_type>("rt_u10_50", rt_u10, join_miter, end_flat, 0.214466, -0.50, ut_settings::ignore_validity());
485483
test_one<multi_polygon_type, polygon_type>("rt_u10_45", rt_u10, join_miter, end_flat, 1.3000, -0.45);
486484
test_one<multi_polygon_type, polygon_type>("rt_u10_25", rt_u10, join_miter, end_flat, 9.6682, -0.25);
487485

488486
test_one<multi_polygon_type, polygon_type>("rt_u11", rt_u11, join_miter, end_flat, 131.3995, 1.0);
489487
test_one<multi_polygon_type, polygon_type>("rt_u11_50", rt_u11, join_miter, end_flat, 0.04289, -0.50);
490488
test_one<multi_polygon_type, polygon_type>("rt_u11_25", rt_u11, join_miter, end_flat, 10.1449, -0.25);
491489

490+
#if defined(BOOST_GEOMETRY_USE_RESCALING) || defined(BOOST_GEOMETRY_TEST_FAILURES)
491+
// Failing because of a start turn
492492
test_one<multi_polygon_type, polygon_type>("rt_u12", rt_u12, join_miter, end_flat, 142.1348, 1.0);
493+
#endif
493494
test_one<multi_polygon_type, polygon_type>("rt_u13", rt_u13, join_miter, end_flat, 115.4853, 1.0);
494495

495496
test_one<multi_polygon_type, polygon_type>("rt_v1", rt_v1, join_round32, end_flat, 26.9994, 1.0);
@@ -540,7 +541,7 @@ int test_main(int, char* [])
540541
#endif
541542

542543
#if defined(BOOST_GEOMETRY_TEST_FAILURES)
543-
BoostGeometryWriteExpectedFailures(1, 1);
544+
BoostGeometryWriteExpectedFailures(1, 1, 2, 3);
544545
#endif
545546

546547
return 0;

0 commit comments

Comments
 (0)