KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_erc_global_labels.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2022 KiCad Developers, see AUTHORS.TXT for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 3
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, you may find one at
18 * http://www.gnu.org/licenses/
19 */
20
23
24#include <connection_graph.h>
25#include <schematic.h>
26#include <erc_settings.h>
27#include <erc.h>
29#include <locale_io.h>
30
32{
34 m_settingsManager( true /* headless */ )
35 { }
36
38 std::unique_ptr<SCHEMATIC> m_schematic;
39};
40
41
43{
45
46 // Check for Errors when using global labels
47 std::vector<std::pair<wxString, int>> tests =
48 {
49 { "issue9367", 12 }
50 };
51
52 for( const std::pair<wxString, int>& test : tests )
53 {
54 KI_TEST::LoadSchematic( m_settingsManager, test.first, m_schematic );
55
56 ERC_SETTINGS& settings = m_schematic->ErcSettings();
57 SHEETLIST_ERC_ITEMS_PROVIDER errors( m_schematic.get() );
58
59 // Skip the "Modified symbol" warning
61
62 m_schematic->ConnectionGraph()->Recalculate( m_schematic->GetSheets(), true );
63 m_schematic->ConnectionGraph()->RunERC();
64
65 ERC_TESTER tester( m_schematic.get() );
69 tester.TestNoConnectPins();
70 tester.TestPinToPin();
71 tester.TestSimilarLabels();
72
74
75 BOOST_CHECK_MESSAGE( errors.GetCount() == test.second, "Expected " << test.second
76 << " errors in " << test.first.ToStdString() << " but got " << errors.GetCount() );
77
78 }
79}
Container for ERC settings.
Definition: erc_settings.h:115
std::map< int, SEVERITY > m_ERCSeverities
Definition: erc_settings.h:174
Definition: erc.h:46
int TestPinToPin()
Checks the full netlist against the pin-to-pin connectivity requirements.
Definition: erc.cpp:668
int TestSimilarLabels()
Checks for labels that differ only in capitalization.
Definition: erc.cpp:864
int TestMultUnitPinConflicts()
Checks if shared pins on multi-unit symbols have been connected to different nets.
Definition: erc.cpp:804
int TestConflictingBusAliases()
Check that there are no conflicting bus alias definitions in the schematic.
Definition: erc.cpp:294
int TestNoConnectPins()
In KiCad 5 and earlier, you could connect stuff up to pins with NC electrical type.
Definition: erc.cpp:600
int TestMultiunitFootprints()
Test if all units of each multiunit symbol have the same footprint assigned.
Definition: erc.cpp:341
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
Definition: locale_io.h:49
An implementation of the RC_ITEM_LIST interface which uses the global SHEETLIST to fulfill the contra...
Definition: erc_settings.h:192
int GetCount(int aSeverity=-1) const override
void SetSeverities(int aSeverities) override
@ ERCE_LIB_SYMBOL_ISSUES
Library symbol changed from current symbol in schematic or the library symbol link no longer valid.
Definition: erc_settings.h:74
void LoadSchematic(SETTINGS_MANAGER &aSettingsManager, const wxString &aRelPath, std::unique_ptr< SCHEMATIC > &aSchematic)
@ RPT_SEVERITY_WARNING
@ RPT_SEVERITY_ERROR
@ RPT_SEVERITY_IGNORE
std::vector< FAB_LAYER_COLOR > dummy
std::unique_ptr< SCHEMATIC > m_schematic
BOOST_FIXTURE_TEST_CASE(ERCGlobalLabels, ERC_REGRESSION_TEST_FIXTURE)