33#include <boost/test/unit_test.hpp>
48 for(
const auto& [
name, properties] : aPart.fields )
61 const nlohmann::json
detail = R
"({
63 "name": "RC0603FR-0710KL",
64 "symbolIdStr": "Device:R",
65 "exclude_from_bom": "False",
66 "exclude_from_board": "False",
67 "exclude_from_sim": "True",
69 "footprint": { "value": "Resistor_SMD:R_0603_1608Metric", "visible": "False" },
70 "datasheet": { "value": "www.kicad.org", "visible": "False" },
71 "value": { "value": "10k" },
72 "reference": { "value": "R" }
104 const nlohmann::json listing = R
"({
106 "name": "RC0603FR-0710KL",
107 "description": "10 kOhms resistor"
121 const nlohmann::json
detail = R
"({
123 "symbolIdStr": "Device:R",
124 "exclude_from_bom": true,
126 "mpn": { "value": "RC0603FR-0710KL", "visible": false }
static DATABASE_FIELD_MAPPING * findField(DATABASE_LIB_TABLE &aLib, const char *aName)
bool setPartExtendedData(const nlohmann::json &aPartJson, HTTP_LIB_PART &aPart)
Parse the exclusion flags and field content from a part's JSON record into aPart.
std::tuple< std::string, bool > field_type
Field content keyed by name, holding the text value and its schematic visibility.
std::vector< std::pair< std::string, field_type > > fields
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_CHECK(res.column_datatype(0)==SQL_NUMERIC||res.column_datatype(0)==SQL_DECIMAL)
BOOST_REQUIRE_EQUAL(rows.size(), 1)
BOOST_CHECK_EQUAL(std::any_cast< std::string >(rows[0].at("val")), "12345678901234567.89")
BOOST_REQUIRE(res.columns()==1)
BOOST_AUTO_TEST_SUITE_END()
static const HTTP_LIB_PART::field_type * findField(const HTTP_LIB_PART &aPart, const std::string &aName)
Issue #23023.
BOOST_AUTO_TEST_CASE(DetailRecordPopulatesFields)
A detail record with a fields object populates every field and reports itself as detailed.