KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_connectivity_clusters.cpp File Reference
#include <qa_utils/wx_utils/unit_test_utils.h>
#include <boost/test/data/test_case.hpp>
#include <pcbnew_utils/board_test_utils.h>
#include <board.h>
#include <connectivity/connectivity_algo.h>
#include <connectivity/connectivity_data.h>
#include <ratsnest/ratsnest_data.h>
#include <settings/settings_manager.h>
#include <deque>
#include <map>
#include <set>

Go to the source code of this file.

Functions

 BOOST_DATA_TEST_CASE (ClustersAreTheConnectedComponents, boost::unit_test::data::make(c_boards), boardName)
 Every item must land in exactly one cluster, each cluster must be internally reachable over the adjacency, and no adjacency may cross between two clusters.
 
 BOOST_DATA_TEST_CASE (RatsnestSpansTheClustersOfEachNet, boost::unit_test::data::make(c_boards), boardName)
 A ratsnest is a spanning forest over the clusters of a net, so it must hold exactly one edge fewer than there are clusters.
 

Function Documentation

◆ BOOST_DATA_TEST_CASE() [1/2]

BOOST_DATA_TEST_CASE ( ClustersAreTheConnectedComponents ,
boost::unit_test::data::make(c_boards) ,
boardName  )

Every item must land in exactly one cluster, each cluster must be internally reachable over the adjacency, and no adjacency may cross between two clusters.

That is the definition of a connected component, so a union-find that links too much or too little cannot satisfy it.

Definition at line 72 of file test_connectivity_clusters.cpp.

References BOOST_CHECK_EQUAL(), BOOST_DATA_TEST_CASE(), BOOST_REQUIRE(), CN_ITEM::ConnectedItems(), CN_CONNECTIVITY_ALGO::CSM_RATSNEST, KI_TEST::FillZones(), and KI_TEST::LoadBoard().

◆ BOOST_DATA_TEST_CASE() [2/2]

BOOST_DATA_TEST_CASE ( RatsnestSpansTheClustersOfEachNet ,
boost::unit_test::data::make(c_boards) ,
boardName  )

A ratsnest is a spanning forest over the clusters of a net, so it must hold exactly one edge fewer than there are clusters.

Too many means a cycle survived, too few means the net was left split. That the forest is also of minimum weight is covered by the FilterKruskal suite, which checks the selection against plain sort-then-scan Kruskal.

Definition at line 158 of file test_connectivity_clusters.cpp.

References BOOST_REQUIRE(), BOOST_TEST_MESSAGE(), CN_CONNECTIVITY_ALGO::CSM_RATSNEST, KI_TEST::FillZones(), RN_NET::GetEdges(), RN_NET::GetNodeCount(), and KI_TEST::LoadBoard().