|
KiCad PCB EDA Suite
|
#include <qa_utils/wx_utils/unit_test_utils.h>#include "allegro_block_tests.h"#include "allegro_test_utils.h"#include <filesystem>#include <fstream>#include <boost/test/data/test_case.hpp>#include <json_common.h>#include <board.h>#include <reporter.h>#include <pcbnew/pcb_io/allegro/pcb_io_allegro.h>#include <pcbnew_utils/board_file_utils.h>#include <pcbnew_utils/board_expectations.h>#include <convert/allegro_parser.h>Go to the source code of this file.
Classes | |
| struct | BOARD_TEST_INFO |
| class | ALLEGRO_BLOCK_TEST_FIXTURE |
| struct | ALLEGRO_BLOCK_TEST |
| Just enough information about the board and block tests to be able to name and register the test cases and look up the definitions at runtime. More... | |
| struct | ALLEGRO_BOARD_TEST_REF |
| Just enough information about the board test to be able to name and register any tests for this board. More... | |
| struct | ALLEGRO_BLOCK_TEST_REGISTRY |
| The registry of known Allegro board and block tests, populated at static init time by reading the JSON registry file. More... | |
| struct | RegisterBlockSuites |
| At static initialization, register the test suite. More... | |
Functions | |
| static std::vector< uint8_t > | loadDataByUri (const std::string &aDataSource) |
| ALLEGRO::FMT_VER | getFormatVersionFromStr (const std::string &aFmtVerStr) |
| static std::unique_ptr< HEADER_TEST_INFO > | createHeaderTestEntry (const std::string &boardDir, const nlohmann::json &headerTestEntry) |
| static BLK_TEST_INFO | createBlockTestEntry (const std::string &boardDir, const nlohmann::json &blockTestEntry) |
| static BOARD_TEST_INFO | createBoardTestInfo (const std::string &aBrdName, const nlohmann::json &boardTestEntry) |
| void | RunBoardLoad (const std::string &aBrdName, const nlohmann::json &aBoardTestJson) |
| void | RunBoardExpectations (const std::string &aBrdName, const nlohmann::json &aBoardTestJson) |
| static std::vector< ALLEGRO_BOARD_TEST_REF > | getBoardTestDefinitions (const nlohmann::json &aJson) |
| Construct a list of test definitions for the boards we have test data for, by reading the registry JSON file. | |
| static const ALLEGRO_BLOCK_TEST_REGISTRY & | buildTestRegistry () |
| static std::vector< std::string > | getBoardTestLabels (const nlohmann::json &boardTestJson) |
| Get the labels associated with a board test, which can be used to e.g. | |
| static std::vector< boost::unit_test::test_suite * > | buildAllegroBoardSuites () |
| This function initializes the test suites for Allegro block and board parsing. | |
Variables | |
| static struct RegisterBlockSuites | s_registerHeaderBlockSuites |
|
static |
This function initializes the test suites for Allegro block and board parsing.
It reads about the minium information it needs to to construct the test cases (i.e. it needs to know the name and which tests are present).
Each test case will call the appropriate test function (e.g. RunHeaderTest or RunBlockTest) at runtime, which will construct more complete test implementions and then run them.
Definition at line 570 of file test_allegro_boards.cpp.
References BOOST_REQUIRE(), buildTestRegistry(), ALLEGRO_BLOCK_TEST_REGISTRY::GetBoardJson(), getBoardTestLabels(), ALLEGRO_BOARD_TEST_REF::m_BlockTests, ALLEGRO_BLOCK_TEST_REGISTRY::m_BoardTests, ALLEGRO_BOARD_TEST_REF::m_BrdName, ALLEGRO_BOARD_TEST_REF::m_HasBoardFile, ALLEGRO_BOARD_TEST_REF::m_HasExpectations, ALLEGRO_BOARD_TEST_REF::m_HasHeaderTest, ALLEGRO_BLOCK_TEST_FIXTURE::RunBlockTest(), RunBoardExpectations(), RunBoardLoad(), and ALLEGRO_BLOCK_TEST_FIXTURE::RunHeaderTest().
Referenced by RegisterBlockSuites::RegisterBlockSuites().
|
static |
Definition at line 519 of file test_allegro_boards.cpp.
References KI_TEST::AllegroBoardDataDir(), getBoardTestDefinitions(), ALLEGRO_BLOCK_TEST_REGISTRY::m_BoardTests, and ALLEGRO_BLOCK_TEST_REGISTRY::m_Json.
Referenced by buildAllegroBoardSuites().
|
static |
Definition at line 134 of file test_allegro_boards.cpp.
Referenced by ALLEGRO_BLOCK_TEST_FIXTURE::RunBlockTest().
|
static |
Definition at line 179 of file test_allegro_boards.cpp.
References KI_TEST::AllegroBoardDataDir(), and getFormatVersionFromStr().
Referenced by ALLEGRO_BLOCK_TEST_FIXTURE::RunBlockTest(), and ALLEGRO_BLOCK_TEST_FIXTURE::RunHeaderTest().
|
static |
Definition at line 117 of file test_allegro_boards.cpp.
Referenced by ALLEGRO_BLOCK_TEST_FIXTURE::RunHeaderTest().
|
static |
Construct a list of test definitions for the boards we have test data for, by reading the registry JSON file.
These definitions will then be bound to the test cases. This all happens at static init time, but the data loads and tests will run at runtime.
Definition at line 459 of file test_allegro_boards.cpp.
Referenced by buildTestRegistry().
|
static |
Get the labels associated with a board test, which can be used to e.g.
filter tests.
Definition at line 542 of file test_allegro_boards.cpp.
Referenced by buildAllegroBoardSuites().
| ALLEGRO::FMT_VER getFormatVersionFromStr | ( | const std::string & | aFmtVerStr | ) |
Definition at line 91 of file test_allegro_boards.cpp.
References ALLEGRO::V_160, ALLEGRO::V_162, ALLEGRO::V_164, ALLEGRO::V_165, ALLEGRO::V_166, ALLEGRO::V_172, ALLEGRO::V_174, ALLEGRO::V_175, ALLEGRO::V_180, and ALLEGRO::V_UNKNOWN.
Referenced by createBoardTestInfo().
|
static |
Definition at line 60 of file test_allegro_boards.cpp.
References KI_TEST::LoadBinaryData(), and path.
Referenced by ALLEGRO_BLOCK_TEST_FIXTURE::RunBlockTest(), and ALLEGRO_BLOCK_TEST_FIXTURE::RunHeaderTest().
| void RunBoardExpectations | ( | const std::string & | aBrdName, |
| const nlohmann::json & | aBoardTestJson ) |
Definition at line 359 of file test_allegro_boards.cpp.
References KI_TEST::AllegroBoardDataDir(), BOOST_TEST_CONTEXT(), KI_TEST::BOARD_EXPECTATION_TEST::CreateFromJson(), KI_TEST::CACHED_BOARD_LOADER::GetCachedBoard(), and KI_TEST::ALLEGRO_CACHED_LOADER::GetInstance().
Referenced by buildAllegroBoardSuites().
| void RunBoardLoad | ( | const std::string & | aBrdName, |
| const nlohmann::json & | aBoardTestJson ) |
Definition at line 299 of file test_allegro_boards.cpp.
References KI_TEST::AllegroBoardDataDir(), BOOST_TEST(), BOOST_TEST_CONTEXT(), BOOST_TEST_MESSAGE(), KI_TEST::CAPTURING_REPORTER::GetErrorCount(), KI_TEST::ALLEGRO_CACHED_LOADER::GetInstance(), KI_TEST::CAPTURING_REPORTER::GetMessages(), KI_TEST::CAPTURING_REPORTER::GetWarningCount(), KI_TEST::CACHED_BOARD_LOADER::LoadAndCache(), KI_TEST::PrintBoardStats(), and RPT_SEVERITY_WARNING.
Referenced by buildAllegroBoardSuites().
|
static |