KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_erc_hierarchical_schematics.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 The 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, see <https://www.gnu.org/licenses/>.
18 */
19
22
23#include <connection_graph.h>
24#include <schematic.h>
25#include <erc/erc_settings.h>
26#include <erc/erc.h>
27#include <erc/erc_report.h>
29#include <locale_io.h>
30
31
33{
35
37 std::unique_ptr<SCHEMATIC> m_schematic;
38};
39
40
42{
44
45 // Check not-connected ERC errors
46
47 std::vector<std::pair<wxString, int>> tests =
48 {
49 { "issue10926_1", 3 },
50 { "issue12814", 0 },
51 { "ERC_dynamic_power_symbol_test", 2 }
52 };
53
54 for( const std::pair<wxString, int>& test : tests )
55 {
56 KI_TEST::LoadSchematic( m_settingsManager, test.first, m_schematic );
57
58 ERC_SETTINGS& settings = m_schematic->ErcSettings();
59 SHEETLIST_ERC_ITEMS_PROVIDER errors( m_schematic.get() );
60
61 // Skip the "Modified symbol" warning
64
65 m_schematic->ConnectionGraph()->RunERC();
66
67 ERC_TESTER tester( m_schematic.get() );
70 tester.TestNoConnectPins();
71 tester.TestPinToPin();
72 tester.TestSimilarLabels();
73 tester.TestTextVars( nullptr );
74
76
77 ERC_REPORT reportWriter( m_schematic.get(), EDA_UNITS::MM );
78
79 BOOST_CHECK_MESSAGE( errors.GetCount() == test.second,
80 "Expected " << test.second << " errors in " << test.first.ToStdString()
81 << " but got " << errors.GetCount() << "\n"
82 << reportWriter.GetTextReport() );
83 }
84}
wxString GetTextReport()
Returns the ERC report in "text" (human readable) format in the C-locale.
Container for ERC settings.
std::map< int, SEVERITY > m_ERCSeverities
void TestTextVars(DS_PROXY_VIEW_ITEM *aDrawingSheet)
Check for any unresolved text variable references.
Definition erc.cpp:183
int TestPinToPin()
Checks the full netlist against the pin-to-pin connectivity requirements.
Definition erc.cpp:980
int TestSimilarLabels()
Checks for labels that differ only in capitalization.
Definition erc.cpp:1747
int TestMultUnitPinConflicts()
Checks if shared pins on multi-unit symbols have been connected to different nets.
Definition erc.cpp:1426
int TestNoConnectPins()
In KiCad 5 and earlier, you could connect stuff up to pins with NC electrical type.
Definition erc.cpp:889
int TestMultiunitFootprints()
Test if all units of each multiunit symbol have the same footprint assigned.
Definition erc.cpp:507
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
Definition locale_io.h:37
An implementation of the RC_ITEM_LIST interface which uses the global SHEETLIST to fulfill the contra...
int GetCount(int aSeverity=-1) const override
void SetSeverities(int aSeverities) override
@ ERCE_LIB_SYMBOL_MISMATCH
Symbol doesn't match copy in library.
@ ERCE_LIB_SYMBOL_ISSUES
Symbol not found in active libraries.
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(ERCHierarchicalSchematics, ERC_REGRESSION_TEST_FIXTURE)
BOOST_CHECK_MESSAGE(totalMismatches==0, std::to_string(totalMismatches)+" board(s) with strategy disagreements")