KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_erc_wire_bus_entry.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
20
#include <
qa_utils/wx_utils/unit_test_utils.h
>
21
#include <
schematic_utils/schematic_file_util.h
>
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
>
28
#include <
settings/settings_manager.h
>
29
#include <
locale_io.h
>
30
31
struct
ERC_REGRESSION_TEST_FIXTURE
32
{
33
ERC_REGRESSION_TEST_FIXTURE
() {}
34
35
SETTINGS_MANAGER
m_settingsManager
;
36
std::unique_ptr<SCHEMATIC>
m_schematic
;
37
};
38
39
40
BOOST_FIXTURE_TEST_CASE
( ERCWireBusEntry,
ERC_REGRESSION_TEST_FIXTURE
)
41
{
42
LOCALE_IO
dummy
;
43
44
std::vector<std::pair<wxString, int>> tests = { {
"unconnected_bus_entry_qa"
, 8 } };
45
46
for
(
const
std::pair<wxString, int>&
test
: tests )
47
{
48
KI_TEST::LoadSchematic
( m_settingsManager,
test
.first, m_schematic );
49
50
ERC_SETTINGS
& settings = m_schematic->ErcSettings();
51
SHEETLIST_ERC_ITEMS_PROVIDER
errors( m_schematic.get() );
52
53
// Skip the "Modified symbol" warning
54
settings.
m_ERCSeverities
[
ERCE_LIB_SYMBOL_ISSUES
] =
RPT_SEVERITY_IGNORE
;
55
settings.
m_ERCSeverities
[
ERCE_LIB_SYMBOL_MISMATCH
] =
RPT_SEVERITY_IGNORE
;
56
57
// Configure the rules under test
58
settings.
m_ERCSeverities
[
ERCE_UNCONNECTED_WIRE_ENDPOINT
] =
RPT_SEVERITY_ERROR
;
59
settings.
m_ERCSeverities
[
ERCE_WIRE_DANGLING
] =
RPT_SEVERITY_ERROR
;
60
settings.
m_ERCSeverities
[
ERCE_ENDPOINT_OFF_GRID
] =
RPT_SEVERITY_ERROR
;
61
62
m_schematic->ConnectionGraph()->RunERC();
63
64
ERC_TESTER
tester( m_schematic.get() );
65
tester.
TestOffGridEndpoints
();
66
67
errors.
SetSeverities
(
RPT_SEVERITY_ERROR
|
RPT_SEVERITY_WARNING
);
68
69
ERC_REPORT
reportWriter( m_schematic.get(),
EDA_UNITS::MM
);
70
71
BOOST_CHECK_MESSAGE( errors.
GetCount
() ==
test
.second,
72
"Expected "
<<
test
.second <<
" errors in "
<<
test
.first.ToStdString()
73
<<
" but got "
<< errors.
GetCount
() <<
"\n"
74
<< reportWriter.
GetTextReport
() );
75
}
76
}
ERC_REPORT
Definition
erc_report.h:31
ERC_REPORT::GetTextReport
wxString GetTextReport()
Returns the ERC report in "text" (human readable) format in the C-locale.
Definition
erc_report.cpp:58
ERC_SETTINGS
Container for ERC settings.
Definition
erc_settings.h:145
ERC_SETTINGS::m_ERCSeverities
std::map< int, SEVERITY > m_ERCSeverities
Definition
erc_settings.h:222
ERC_TESTER
Definition
erc.h:48
ERC_TESTER::TestOffGridEndpoints
int TestOffGridEndpoints()
Test pins and wire ends for being off grid.
Definition
erc.cpp:2413
LOCALE_IO
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
Definition
locale_io.h:37
SETTINGS_MANAGER
Definition
settings_manager.h:49
SHEETLIST_ERC_ITEMS_PROVIDER
An implementation of the RC_ITEM_LIST interface which uses the global SHEETLIST to fulfill the contra...
Definition
erc_settings.h:254
SHEETLIST_ERC_ITEMS_PROVIDER::GetCount
int GetCount(int aSeverity=-1) const override
Definition
erc_settings.cpp:452
SHEETLIST_ERC_ITEMS_PROVIDER::SetSeverities
void SetSeverities(int aSeverities) override
Definition
erc_settings.cpp:417
connection_graph.h
EDA_UNITS::MM
@ MM
Definition
eda_units.h:46
erc.h
erc_report.h
erc_settings.h
ERCE_UNCONNECTED_WIRE_ENDPOINT
@ ERCE_UNCONNECTED_WIRE_ENDPOINT
A label is connected to more than one wire.
Definition
erc_settings.h:93
ERCE_ENDPOINT_OFF_GRID
@ ERCE_ENDPOINT_OFF_GRID
Pin or wire-end off grid.
Definition
erc_settings.h:43
ERCE_LIB_SYMBOL_MISMATCH
@ ERCE_LIB_SYMBOL_MISMATCH
Symbol doesn't match copy in library.
Definition
erc_settings.h:82
ERCE_LIB_SYMBOL_ISSUES
@ ERCE_LIB_SYMBOL_ISSUES
Symbol not found in active libraries.
Definition
erc_settings.h:81
ERCE_WIRE_DANGLING
@ ERCE_WIRE_DANGLING
Some wires are not connected to anything else.
Definition
erc_settings.h:80
locale_io.h
KI_TEST::LoadSchematic
void LoadSchematic(SETTINGS_MANAGER &aSettingsManager, const wxString &aRelPath, std::unique_ptr< SCHEMATIC > &aSchematic)
Definition
schematic_file_util.cpp:184
test
Definition
drc_test_provider_diff_pair_coupling.cpp:44
RPT_SEVERITY_WARNING
@ RPT_SEVERITY_WARNING
Definition
report_severity.h:34
RPT_SEVERITY_ERROR
@ RPT_SEVERITY_ERROR
Definition
report_severity.h:35
RPT_SEVERITY_IGNORE
@ RPT_SEVERITY_IGNORE
Definition
report_severity.h:36
schematic.h
schematic_file_util.h
settings_manager.h
dummy
std::vector< FAB_LAYER_COLOR > dummy
Definition
stackup_predefined_prms.cpp:93
ERC_REGRESSION_TEST_FIXTURE
Definition
test_erc_four_way.cpp:32
ERC_REGRESSION_TEST_FIXTURE::m_schematic
std::unique_ptr< SCHEMATIC > m_schematic
Definition
test_erc_four_way.cpp:37
ERC_REGRESSION_TEST_FIXTURE::m_settingsManager
SETTINGS_MANAGER m_settingsManager
Definition
test_erc_four_way.cpp:36
ERC_REGRESSION_TEST_FIXTURE::ERC_REGRESSION_TEST_FIXTURE
ERC_REGRESSION_TEST_FIXTURE()
Definition
test_erc_wire_bus_entry.cpp:33
BOOST_FIXTURE_TEST_CASE
BOOST_FIXTURE_TEST_CASE(ERCWireBusEntry, ERC_REGRESSION_TEST_FIXTURE)
Definition
test_erc_wire_bus_entry.cpp:40
unit_test_utils.h
src
qa
tests
eeschema
erc
test_erc_wire_bus_entry.cpp
Generated on Fri Jul 31 2026 00:08:03 for KiCad PCB EDA Suite by
1.13.2