KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_bus_parsing.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 modify it
7
* under the terms of the GNU General Public License as published by the
8
* Free Software Foundation, either version 3 of the License, or (at your
9
* option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful, but
12
* WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
* General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License along
17
* with this program. If not, see <http://www.gnu.org/licenses/>.
18
*/
19
20
#include <
qa_utils/wx_utils/unit_test_utils.h
>
21
22
#include <
project/net_settings.h
>
23
24
25
BOOST_AUTO_TEST_SUITE
( BusParsing )
26
27
28
BOOST_AUTO_TEST_CASE
( ParsesFormattedVectorBus )
29
{
30
wxString
name
;
31
std::vector<wxString> members;
32
33
BOOST_CHECK(
NET_SETTINGS::ParseBusVector
( wxS(
"D_{[1..2]}"
), &
name
, &members ) );
34
BOOST_CHECK_EQUAL
(
name
, wxS(
"D"
) );
35
36
std::vector<wxString>
expected
= { wxS(
"D1"
), wxS(
"D2"
) };
37
38
BOOST_CHECK_EQUAL_COLLECTIONS( members.begin(), members.end(),
expected
.begin(),
expected
.end() );
39
}
40
41
42
BOOST_AUTO_TEST_CASE
( ParsesFormattedGroupWithVectorMember )
43
{
44
wxString
name
;
45
std::vector<wxString> members;
46
47
BOOST_CHECK(
NET_SETTINGS::ParseBusGroup
( wxS(
"MEM{D_{[1..2]} ~{LATCH}}"
), &
name
, &members ) );
48
BOOST_CHECK_EQUAL
(
name
, wxS(
"MEM"
) );
49
50
std::vector<wxString>
expected
= { wxS(
"D[1..2]"
), wxS(
"LATCH"
) };
51
52
BOOST_CHECK_EQUAL_COLLECTIONS( members.begin(), members.end(),
expected
.begin(),
expected
.end() );
53
}
54
55
56
BOOST_AUTO_TEST_SUITE_END
()
name
const char * name
Definition
DXF_plotter.cpp:65
NET_SETTINGS::ParseBusGroup
static bool ParseBusGroup(const wxString &aGroup, wxString *name, std::vector< wxString > *aMemberList)
Parse a bus group label into the name and a list of components.
Definition
net_settings.cpp:1250
NET_SETTINGS::ParseBusVector
static bool ParseBusVector(const wxString &aBus, wxString *aName, std::vector< wxString > *aMemberList)
Parse a bus vector (e.g.
Definition
net_settings.cpp:1108
net_settings.h
BOOST_AUTO_TEST_CASE
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
Definition
test_api_enums.cpp:136
BOOST_AUTO_TEST_CASE
BOOST_AUTO_TEST_CASE(ParsesFormattedVectorBus)
Definition
test_bus_parsing.cpp:28
BOOST_AUTO_TEST_SUITE
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_AUTO_TEST_SUITE_END
BOOST_AUTO_TEST_SUITE_END()
expected
VECTOR3I expected(15, 30, 45)
BOOST_CHECK_EQUAL
BOOST_CHECK_EQUAL(result, "25.4")
unit_test_utils.h
src
qa
tests
eeschema
test_bus_parsing.cpp
Generated on Fri Jan 9 2026 00:06:50 for KiCad PCB EDA Suite by
1.13.2