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
21
23#include <sch_file_versions.h>
24
25// First s-expression schematic version (KiCad 6.0); older files predate migration enforcement.
26static constexpr int FIRST_SEXPR_VERSION = 20200310;
27
28BOOST_AUTO_TEST_SUITE( BusMigrationGate )
29
30// A legacy .sch file (version 0) with conflicting bus labels must still prompt.
31BOOST_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.
37BOOST_AUTO_TEST_CASE( JustBelowThresholdPrompts )
38{
40}
41
42// A 6.0+ file cannot store the ambiguity, so a transient nonzero count must not re-prompt.
43BOOST_AUTO_TEST_CASE( FirstSexprVersionDoesNotPrompt )
44{
46}
47
48BOOST_AUTO_TEST_CASE( CurrentVersionDoesNotPrompt )
49{
51}
52
53// No conflicts never prompts, regardless of file age.
54BOOST_AUTO_TEST_CASE( NoConflictsNeverPrompts )
55{
56 BOOST_CHECK( !DIALOG_MIGRATE_BUSES::ShouldPrompt( 0, 0 ) );
58}
59
static bool ShouldPrompt(int aFileFormatVersionAtLoad, size_t aBusesNeedingMigration)
Multiple differently-named labels on a single bus subgraph were only permitted before KiCad 6....
#define SEXPR_SCHEMATIC_FILE_VERSION
Schematic file version.
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_AUTO_TEST_CASE(LegacyFileWithConflictsPrompts)
static constexpr int FIRST_SEXPR_VERSION
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_AUTO_TEST_SUITE_END()