KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_bus_migration_gate.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
22
#include <
dialog_migrate_buses.h
>
23
#include <
sch_file_versions.h
>
24
25
// First s-expression schematic version (KiCad 6.0); older files predate migration enforcement.
26
static
constexpr
int
FIRST_SEXPR_VERSION
= 20200310;
27
28
BOOST_AUTO_TEST_SUITE
( BusMigrationGate )
29
30
// A legacy .sch file (version 0) with conflicting bus labels must still prompt.
31
BOOST_AUTO_TEST_CASE
( LegacyFileWithConflictsPrompts )
32
{
33
BOOST_CHECK(
DIALOG_MIGRATE_BUSES::ShouldPrompt
( 0, 3 ) );
34
}
35
36
// The pre-6.0 boundary is inclusive-exclusive on the first s-expression version.
37
BOOST_AUTO_TEST_CASE
( JustBelowThresholdPrompts )
38
{
39
BOOST_CHECK(
DIALOG_MIGRATE_BUSES::ShouldPrompt
(
FIRST_SEXPR_VERSION
- 1, 1 ) );
40
}
41
42
// A 6.0+ file cannot store the ambiguity, so a transient nonzero count must not re-prompt.
43
BOOST_AUTO_TEST_CASE
( FirstSexprVersionDoesNotPrompt )
44
{
45
BOOST_CHECK( !
DIALOG_MIGRATE_BUSES::ShouldPrompt
(
FIRST_SEXPR_VERSION
, 3 ) );
46
}
47
48
BOOST_AUTO_TEST_CASE
( CurrentVersionDoesNotPrompt )
49
{
50
BOOST_CHECK( !
DIALOG_MIGRATE_BUSES::ShouldPrompt
(
SEXPR_SCHEMATIC_FILE_VERSION
, 5 ) );
51
}
52
53
// No conflicts never prompts, regardless of file age.
54
BOOST_AUTO_TEST_CASE
( NoConflictsNeverPrompts )
55
{
56
BOOST_CHECK( !
DIALOG_MIGRATE_BUSES::ShouldPrompt
( 0, 0 ) );
57
BOOST_CHECK( !
DIALOG_MIGRATE_BUSES::ShouldPrompt
(
SEXPR_SCHEMATIC_FILE_VERSION
, 0 ) );
58
}
59
60
BOOST_AUTO_TEST_SUITE_END
()
DIALOG_MIGRATE_BUSES::ShouldPrompt
static bool ShouldPrompt(int aFileFormatVersionAtLoad, size_t aBusesNeedingMigration)
Multiple differently-named labels on a single bus subgraph were only permitted before KiCad 6....
Definition
dialog_migrate_buses.cpp:60
dialog_migrate_buses.h
sch_file_versions.h
SEXPR_SCHEMATIC_FILE_VERSION
#define SEXPR_SCHEMATIC_FILE_VERSION
Schematic file version.
Definition
sch_file_versions.h:147
BOOST_AUTO_TEST_CASE
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
Definition
test_api_enums.cpp:71
BOOST_AUTO_TEST_CASE
BOOST_AUTO_TEST_CASE(LegacyFileWithConflictsPrompts)
Definition
test_bus_migration_gate.cpp:31
FIRST_SEXPR_VERSION
static constexpr int FIRST_SEXPR_VERSION
Definition
test_bus_migration_gate.cpp:26
BOOST_AUTO_TEST_SUITE
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_AUTO_TEST_SUITE_END
BOOST_AUTO_TEST_SUITE_END()
unit_test_utils.h
src
qa
tests
eeschema
test_bus_migration_gate.cpp
Generated on Tue Jul 7 2026 00:07:27 for KiCad PCB EDA Suite by
1.13.2