← Back to team overview

kicad-developers team mailing list archive

[PATCH] Remove obsolete fillet refactor tests

 

Hi,

The fillet refactor tests that were previous disabled are removed by
this patch. These tests are pretty useless, as the two compared fillet
methods have different meanings now.

This also fixes https://bugs.launchpad.net/kicad/+bug/1785377, as the
test exclusion syntax in Boost Unit Test only works from Boost 1.59,
and Ubuntu 16 evidently uses 1.58.

Cheers,

John
From 5378f576008abd7cbe5ddb46616488a5b8df66be Mon Sep 17 00:00:00 2001
From: John Beard <john.j.beard@xxxxxxxxx>
Date: Sun, 5 Aug 2018 19:16:55 +0100
Subject: [PATCH] QA: Remove obsolete fillet refactor tests

These tests are fundamentally broken as they test two fillet
implementations against each other, but the two implementations
no longer have the same interface or meaning (one has a fixed
segment count, one has a fixed error).

This also allows the tests to run on Boost <1.59, which do not
provide the !-syntax for excluding tests. Ubuntu 16 uses
Boost 1.58, so this causes build failures.

Fixes: 1785377
https://bugs.launchpad.net/kicad/+bug/1785377
---
 qa/shape_poly_set_refactor/CMakeLists.txt     |  4 +-
 ...st_chamfer_fillet.cpp => test_chamfer.cpp} | 38 +------------------
 2 files changed, 3 insertions(+), 39 deletions(-)
 rename qa/shape_poly_set_refactor/{test_chamfer_fillet.cpp => test_chamfer.cpp} (78%)

diff --git a/qa/shape_poly_set_refactor/CMakeLists.txt b/qa/shape_poly_set_refactor/CMakeLists.txt
index 3100328b5..d6b72aeb0 100644
--- a/qa/shape_poly_set_refactor/CMakeLists.txt
+++ b/qa/shape_poly_set_refactor/CMakeLists.txt
@@ -28,7 +28,7 @@ add_definitions(-DBOOST_TEST_DYN_LINK)
 
 add_executable( qa_shape_poly_set_refactor
     test_module.cpp
-    test_chamfer_fillet.cpp
+    test_chamfer.cpp
     test_collision.cpp
     test_iterator.cpp
     test_segment.cpp
@@ -56,5 +56,5 @@ target_link_libraries( qa_shape_poly_set_refactor
 add_dependencies( qa_shape_poly_set_refactor pcbnew )
 
 add_test( NAME shape_poly_set_refactor
-    COMMAND qa_shape_poly_set_refactor --run_test=!ChamferFillet/Fillet
+    COMMAND qa_shape_poly_set_refactor
 )
diff --git a/qa/shape_poly_set_refactor/test_chamfer_fillet.cpp b/qa/shape_poly_set_refactor/test_chamfer.cpp
similarity index 78%
rename from qa/shape_poly_set_refactor/test_chamfer_fillet.cpp
rename to qa/shape_poly_set_refactor/test_chamfer.cpp
index 8d5c9f475..22dc245c4 100644
--- a/qa/shape_poly_set_refactor/test_chamfer_fillet.cpp
+++ b/qa/shape_poly_set_refactor/test_chamfer.cpp
@@ -34,7 +34,7 @@
 /**
  * Declares the ChamferFilletFixture struct as the boost test fixture.
  */
-BOOST_FIXTURE_TEST_SUITE( ChamferFillet, ChamferFilletFixture )
+BOOST_FIXTURE_TEST_SUITE( Chamfer, ChamferFilletFixture )
 
 /**
  * Function lexicographicOrder
@@ -120,40 +120,4 @@ BOOST_AUTO_TEST_CASE( Chamfer )
     }
 }
 
-/**
- * Tests the SHAPE_POLY_SET::FilletPolygon, which has been refactored into
- * SHAPE_POLY_SET from CPolyLine::Fillet.
- * Assuming the code in CPolyLine is right, this test ensures the behaviour of the new
- * refactored code does not change anything.
- */
-BOOST_AUTO_TEST_CASE( Fillet )
-{
-    SHAPE_POLY_SET::POLYGON actual;
-    CPolyLine expected;
-
-    // Test different radius, up to the half of the minimum segment longitude
-    for (int radius = 1; radius < 5; radius++)
-    {
-        // Test different number of segments
-        for (size_t segments = 1; segments < 100; segments++)
-        {
-            // Chamfered polygon to be tested.
-            actual = common.holeyPolySet.FilletPolygon( radius, segments, 0 );
-
-            // Chamfered polygon assumed to be right.
-            expected = *legacyPolyLine.Fillet( radius, segments );
-
-            // Double check that there are no repeated corners in the legacy shape.
-            expected.RemoveNullSegments();
-
-            // Test equality
-            for (size_t contourIdx = 0; contourIdx < actual.size(); contourIdx++)
-            {
-                TestLineChainEqualCPolyLine(actual[contourIdx], expected, contourIdx);
-            }
-        }
-    }
-}
-
-
 BOOST_AUTO_TEST_SUITE_END()
-- 
2.17.1


Follow ups