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

static void checkClustersAreConnectedComponents (BOARD *aBoard)
 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.
 
static void checkRatsnestSpansClusters (BOARD *aBoard)
 A ratsnest is a spanning forest over the clusters of a net, so it must hold exactly one edge fewer than there are clusters.
 
m_board BuildConnectivity ()
 
 checkClustersAreConnectedComponents (m_board.get())
 
 checkRatsnestSpansClusters (m_board.get())
 

Function Documentation

◆ BuildConnectivity()

m_board BuildConnectivity ( )

◆ checkClustersAreConnectedComponents() [1/2]

static void checkClustersAreConnectedComponents ( BOARD * aBoard)
static

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_REQUIRE(), BOOST_REQUIRE_EQUAL(), BOOST_REQUIRE_MESSAGE(), checkClustersAreConnectedComponents(), CN_ITEM::ConnectedItems(), and CN_CONNECTIVITY_ALGO::CSM_RATSNEST.

Referenced by checkClustersAreConnectedComponents().

◆ checkClustersAreConnectedComponents() [2/2]

checkClustersAreConnectedComponents ( m_board. get())

◆ checkRatsnestSpansClusters() [1/2]

static void checkRatsnestSpansClusters ( BOARD * aBoard)
static

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 152 of file test_connectivity_clusters.cpp.

References BOOST_REQUIRE(), BOOST_REQUIRE_MESSAGE(), BOOST_TEST_MESSAGE(), CN_CONNECTIVITY_ALGO::CSM_RATSNEST, BOARD::GetConnectivity(), RN_NET::GetEdges(), and RN_NET::GetNodeCount().

◆ checkRatsnestSpansClusters() [2/2]

checkRatsnestSpansClusters ( m_board. get())