KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_sim_regressions.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 2
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#include <boost/test/results_collector.hpp> // To check if the current test failed (to be moved?).
22#include <eeschema_test_utils.h>
24#include <wx/ffile.h>
25#include <mock_pgm_base.h>
26#include <locale_io.h>
27
28
30{
31public:
36
40
41 wxFileName SchematicQAPath( const wxString& aBaseName ) override
42 {
43 wxFileName fn( KI_TEST::GetEeschemaTestDataDir() );
44 fn.SetName( aBaseName );
46
47 return fn;
48 }
49
50 wxString GetNetlistPath( bool aTest = false ) override
51 {
52 wxFileName netFile = m_schematic->Project().GetProjectFullName();
53
54 if( aTest )
55 netFile.SetName( netFile.GetName() + "_test" );
56
57 netFile.SetExt( "spice" );
58 return netFile.GetFullPath();
59 }
60
78
79public:
80 bool m_SavesDissipations = false;
81 bool m_SaveVoltages = true;
82 bool m_SaveCurrents = true;
83};
84
85
87{
89
90 // const MOCK_PGM_BASE& program = static_cast<MOCK_PGM_BASE&>( Pgm() );
91 // MOCK_EXPECT( program.GetLocalEnvVariables ).returns( ENV_VAR_MAP() );
92
93 TestNetlist( "issue13591" );
94 TestTranPoint( 100e-6, { { "I(R1)", 0 }, { "I(R2)", 0 } }, 0.00001 );
95 TestTranPoint( 500e-6, { { "I(R1)", 0 }, { "I(R2)", 0 } }, 0.00001 );
96}
97
98
100{
102
103 m_SaveCurrents = false;
104
105 TestNetlist( "issue13431" );
106 TestTranPoint( 0.005, { { "V(/soft_start)", 2.489 } } );
107 TestTranPoint( 0.012, { { "V(/soft_start)", 5.100 } } );
108}
109
110
111// This test is flaky and fails on ngspice-42 / Linux.
112// Please replace it with something that is more stable
113#if 0
115{
117
118 const MOCK_PGM_BASE& program = static_cast<MOCK_PGM_BASE&>( Pgm() );
119 MOCK_EXPECT( program.GetLocalEnvVariables ).returns( ENV_VAR_MAP() );
120
121 TestNetlist( "issue13112" );
122 TestTranPoint( 0.01, { { "V(out)", -0.060 } } );
123 TestTranPoint( 0.02, { { "V(out)", 0.856 } } );
124}
125#endif
126
127
129{
131
132 // const MOCK_PGM_BASE& program = static_cast<MOCK_PGM_BASE&>( Pgm() );
133 // MOCK_EXPECT( program.GetLocalEnvVariables ).returns( ENV_VAR_MAP() );
134
135 TestNetlist( "issue13162" );
136 TestTranPoint( 0.030, { { "V(out)", 0.000829682 } } );
137 TestTranPoint( 0.035, { { "V(out)", -0.000829692 } } );
138}
139
140
142{
144
145 // const MOCK_PGM_BASE& program = static_cast<MOCK_PGM_BASE&>( Pgm() );
146 // MOCK_EXPECT( program.GetLocalEnvVariables ).returns( ENV_VAR_MAP() );
147
148 TestNetlist( "issue12505" );
149 TestTranPoint( 0.015, { { "V(Net-_R1-Pad2_)", -311 } } );
150 TestTranPoint( 0.025, { { "V(Net-_R1-Pad2_)", 311 } } );
151}
152
153
155{
157
158 // const MOCK_PGM_BASE& program = static_cast<MOCK_PGM_BASE&>( Pgm() );
159 // MOCK_EXPECT( program.GetLocalEnvVariables ).returns( ENV_VAR_MAP() );
160
161 TestNetlist( "issue16223" );
162 TestTranPoint( 0.0, { { "V(PRBS_OUTPUT)", 5.114 } } );
163 TestTranPoint( 1e-6, { { "V(PRBS_OUTPUT)", -0.1144 } } );
164}
165
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
Definition locale_io.h:37
wxFileName SchematicQAPath(const wxString &aBaseName) override
wxString GetNetlistPath(bool aTest=false) override
static const std::string KiCadSchematicFileExtension
std::map< wxString, ENV_VAR_ITEM > ENV_VAR_MAP
std::string GetEeschemaTestDataDir()
Get the configured location of Eeschema test data.
PGM_BASE & Pgm()
The global program "get" accessor.
PGM_SINGLE_TOP program
std::vector< FAB_LAYER_COLOR > dummy
BOOST_FIXTURE_TEST_CASE(WindowsPaths, TEST_SIM_REGRESSIONS_FIXTURE)