KiCad PCB EDA Suite
Loading...
Searching...
No Matches
spice/test_module.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 (C) 2017 CERN
5 * @author Alejandro GarcĂ­a Montoro <[email protected]>
6 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 */
21
25#include <boost/test/unit_test.hpp>
26#include <kiplatform/app.h>
27
28#include <pgm_base.h>
30#include <eeschema_settings.h>
32#include <wx/app.h>
33#include <wx/init.h>
34#include <mock_pgm_base.h>
35
37
38
40{
41 SetPgm( new MOCK_PGM_BASE() );
43 boost::unit_test::framework::master_test_suite().p_name.value = "Common SPICE integration tests";
44
45 wxApp::SetInstance( new wxAppConsole );
46
47 bool ok = wxInitialize( boost::unit_test::framework::master_test_suite().argc,
48 boost::unit_test::framework::master_test_suite().argv );
49
50 wxSetAssertHandler( &KI_TEST::wxAssertThrower );
51
52 Pgm().InitPgm( true, true );
57
58 return ok;
59}
60
61
62int main( int argc, char* argv[] )
63{
64 int ret = boost::unit_test::unit_test_main( &init_unit_test, argc, argv );
65
66 Pgm().Destroy();
67
68 // This causes some glib warnings on GTK3 (http://trac.wxwidgets.org/ticket/18274)
69 // but without it, Valgrind notices a lot of leaks from WX
70 wxUninitialize();
71
72 return ret;
73}
void Destroy()
Definition pgm_base.cpp:183
bool InitPgm(bool aHeadless=false, bool aIsUnitTest=false)
Initialize this program.
Definition pgm_base.cpp:320
virtual SETTINGS_MANAGER & GetSettingsManager() const
Definition pgm_base.h:124
T * RegisterSettings(T *aSettings, bool aLoadNow=true)
Take ownership of the pointer passed in.
bool LoadProject(const wxString &aFullPath, bool aSetActive=true)
Load a project or sets up a new project with a specified path.
bool Init()
Perform application-specific initialization tasks.
Definition unix/app.cpp:40
void wxAssertThrower(const wxString &aFile, int aLine, const wxString &aFunc, const wxString &aCond, const wxString &aMsg)
Definition wx_assert.h:67
void SetPgm(PGM_BASE *pgm)
PGM_BASE & Pgm()
The global program "get" accessor.
see class PGM_BASE
bool init_unit_test()
Main file for the spice tests to be compiled.
bool init_unit_test()