KiCad PCB EDA Suite
test_lib_part.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) 2019-2021 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, you may find one here:
18 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19 * or you may search the http://www.gnu.org website for the version 2 license,
20 * or you may write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22 */
23
30
31// Code under test
32#include <lib_shape.h>
33#include <lib_pin.h>
34
36
38{
39public:
41 m_part_no_data( "part_name", nullptr )
42 {
43 }
44
47};
48
49
53BOOST_FIXTURE_TEST_SUITE( LibPart, TEST_LIB_SYMBOL_FIXTURE )
54
55
56
59BOOST_AUTO_TEST_CASE( DefaultProperties )
60{
61 BOOST_CHECK_EQUAL( m_part_no_data.GetName(), "part_name" );
62
63 // Didn't set a library, so this is empty
64 BOOST_CHECK_EQUAL( m_part_no_data.GetLibraryName(), "" );
65 BOOST_CHECK_EQUAL( m_part_no_data.GetLib(), nullptr );
66
67 // only get the root
68 BOOST_CHECK_EQUAL( m_part_no_data.IsRoot(), true );
69 BOOST_CHECK_EQUAL( m_part_no_data.IsAlias(), false );
70 BOOST_CHECK_EQUAL( m_part_no_data.SharedPtr().use_count(), 2 );
71
72 // no sub units
73 BOOST_CHECK_EQUAL( m_part_no_data.GetUnitCount(), 1 );
74 BOOST_CHECK_EQUAL( m_part_no_data.IsMulti(), false );
75
76 // no conversion
77 BOOST_CHECK_EQUAL( m_part_no_data.HasConversion(), false );
78}
79
80
84BOOST_AUTO_TEST_CASE( DefaultDrawings )
85{
86 // default drawings exist
87 BOOST_CHECK_EQUAL( m_part_no_data.GetDrawItems().size(), 4 );
88 BOOST_CHECK_EQUAL( m_part_no_data.GetAllLibPins().size(), 0 );
89}
90
91
95BOOST_AUTO_TEST_CASE( DefaultFields )
96{
97 std::vector<LIB_FIELD> fields;
98 m_part_no_data.GetFields( fields );
99
100 // Should get the 4 default fields
101 BOOST_CHECK_PREDICATE( KI_TEST::AreDefaultFieldsCorrect, ( fields ) );
102
103 // but no more (we didn't set them)
104 BOOST_CHECK_EQUAL( fields.size(), MANDATORY_FIELD_T::MANDATORY_FIELDS );
105
106 // also check the default field accessors
107 BOOST_CHECK_PREDICATE( KI_TEST::FieldNameIdMatches,
108 ( m_part_no_data.GetReferenceField() )( "Reference" )( MANDATORY_FIELD_T::REFERENCE_FIELD ) );
109 BOOST_CHECK_PREDICATE( KI_TEST::FieldNameIdMatches,
110 ( m_part_no_data.GetValueField() )( "Value" )( MANDATORY_FIELD_T::VALUE_FIELD ) );
111 BOOST_CHECK_PREDICATE( KI_TEST::FieldNameIdMatches,
112 ( m_part_no_data.GetFootprintField() )( "Footprint" )( MANDATORY_FIELD_T::FOOTPRINT_FIELD ) );
113}
114
115
120{
121 std::vector<LIB_FIELD> fields;
122 m_part_no_data.GetFields( fields );
123
124 // Ctor takes non-const ref (?!)
125 const std::string newFieldName = "new_field";
126 wxString nonConstNewFieldName = newFieldName;
127 fields.push_back( LIB_FIELD( 42, nonConstNewFieldName ) );
128
129 // fairly roundabout way to add a field, but it is what it is
130 m_part_no_data.SetFields( fields );
131
132 // Should get the 4 default fields
133 BOOST_CHECK_PREDICATE( KI_TEST::AreDefaultFieldsCorrect, ( fields ) );
134
135 // and our new one
136 BOOST_REQUIRE_EQUAL( fields.size(), MANDATORY_FIELD_T::MANDATORY_FIELDS + 1 );
137
138 BOOST_CHECK_PREDICATE( KI_TEST::FieldNameIdMatches,
139 ( fields[MANDATORY_FIELD_T::MANDATORY_FIELDS] )( newFieldName )( 42 ) );
140
141 // Check by-id lookup
142
143 LIB_FIELD* gotNewField = m_part_no_data.GetFieldById( 42 );
144
145 BOOST_REQUIRE_NE( gotNewField, nullptr );
146
147 BOOST_CHECK_PREDICATE( KI_TEST::FieldNameIdMatches, ( *gotNewField )( newFieldName )( 42 ) );
148
149 // Check by-name lookup
150
151 gotNewField = m_part_no_data.FindField( newFieldName );
152
153 BOOST_REQUIRE_NE( gotNewField, nullptr );
154 BOOST_CHECK_PREDICATE( KI_TEST::FieldNameIdMatches, ( *gotNewField )( newFieldName )( 42 ) );
155}
156
157
161BOOST_AUTO_TEST_CASE( AddedDrawItems )
162{
163}
164
165
167{
170 std::string m_expSubRef;
171};
172
173
177BOOST_AUTO_TEST_CASE( SubReference )
178{
179 const std::vector<TEST_LIB_SYMBOL_SUBREF_CASE> cases = {
180 {
181 1,
182 false,
183 "A",
184 },
185 {
186 2,
187 false,
188 "B",
189 },
190 {
191 26,
192 false,
193 "Z",
194 },
195 {
196 27,
197 false,
198 "AA",
199 },
200 {
201 28,
202 false,
203 "AB",
204 },
205 {
206 53,
207 false,
208 "BA",
209 },
210 {
211 79,
212 false,
213 "CA",
214 },
215 {
216 105,
217 false,
218 "DA",
219 },
220 {
221 131,
222 false,
223 "EA",
224 },
225 {
226 157,
227 false,
228 "FA",
229 },
230 {
231 183,
232 false,
233 "GA",
234 },
235 {
236 209,
237 false,
238 "HA",
239 },
240 {
241 235,
242 false,
243 "IA",
244 },
245 {
246 261,
247 false,
248 "JA",
249 },
250 {
251 287,
252 false,
253 "KA",
254 },
255 {
256 313,
257 false,
258 "LA",
259 },
260 {
261 339,
262 false,
263 "MA",
264 },
265 {
266 365,
267 false,
268 "NA",
269 },
270 {
271 391,
272 false,
273 "OA",
274 },
275 {
276 417,
277 false,
278 "PA",
279 },
280 {
281 443,
282 false,
283 "QA",
284 },
285 {
286 469,
287 false,
288 "RA",
289 },
290 {
291 495,
292 false,
293 "SA",
294 },
295 {
296 521,
297 false,
298 "TA",
299 },
300 {
301 547,
302 false,
303 "UA",
304 },
305 {
306 573,
307 false,
308 "VA",
309 },
310 {
311 599,
312 false,
313 "WA",
314 },
315 {
316 625,
317 false,
318 "XA",
319 },
320 {
321 651,
322 false,
323 "YA",
324 },
325 {
326 677,
327 false,
328 "ZA",
329 },
330 {
331 702,
332 false,
333 "ZZ",
334 },
335 {
336 703,
337 false,
338 "AAA",
339 },
340 {
341 728,
342 false,
343 "AAZ",
344 },
345 { // haven't configured a separator, so should be nothing
346 1,
347 true,
348 "A",
349 },
350 };
351
352 for( const auto& c : cases )
353 {
355 "Subref: " << c.m_index << ", " << c.m_addSep << " -> '" << c.m_expSubRef << "'" )
356 {
357 const auto subref = m_part_no_data.SubReference( c.m_index, c.m_addSep );
358 BOOST_CHECK_EQUAL( subref, c.m_expSubRef );
359 }
360 }
361}
362
363
368{
369 // Identical root part to m_part_no_data sans time stamp.
370 LIB_SYMBOL testPart( "part_name" );
371
372 // Self comparison test.
373 BOOST_CHECK_EQUAL( m_part_no_data.Compare( m_part_no_data ), 0 );
374
375 // Test for identical LIB_SYMBOL.
376 BOOST_CHECK_EQUAL( m_part_no_data.Compare( testPart ), 0 );
377
378 // Test name.
379 testPart.SetName( "tart_name" );
380 BOOST_CHECK( m_part_no_data.Compare( testPart ) < 0 );
381 testPart.SetName( "cart_name" );
382 BOOST_CHECK( m_part_no_data.Compare( testPart ) > 0 );
383 testPart.SetName( "part_name" );
384
385 // LIB_ID comparison tests.
386 LIB_ID id = testPart.GetLibId();
387 id.SetLibItemName( "tart_name" );
388 testPart.SetLibId( id );
389 BOOST_CHECK( m_part_no_data.Compare( testPart ) < 0 );
390 id.SetLibItemName( "cart_name" );
391 testPart.SetLibId( id );
392 BOOST_CHECK( m_part_no_data.Compare( testPart ) > 0 );
393 id.SetLibItemName( "part_name" );
394 testPart.SetLibId( id );
395
396 // Unit count comparison tests.
397 testPart.SetUnitCount( 2 );
398 BOOST_CHECK( m_part_no_data.Compare( testPart ) < 0 );
399 testPart.SetUnitCount( 1 );
400 m_part_no_data.SetUnitCount( 2 );
401 BOOST_CHECK( m_part_no_data.Compare( testPart ) > 0 );
402 m_part_no_data.SetUnitCount( 1 );
403
404 // Options flag comparison tests.
405 testPart.SetPower();
406 BOOST_CHECK( m_part_no_data.Compare( testPart ) < 0 );
407 testPart.SetNormal();
408 m_part_no_data.SetPower();
409 BOOST_CHECK( m_part_no_data.Compare( testPart ) > 0 );
410 m_part_no_data.SetNormal();
411
412 // Draw item list size comparison tests.
413 testPart.AddDrawItem( new LIB_SHAPE( &testPart, SHAPE_T::RECT ) );
414 m_part_no_data.AddDrawItem( new LIB_SHAPE( &m_part_no_data, SHAPE_T::RECT ) );
415 BOOST_CHECK_EQUAL( m_part_no_data.Compare( testPart ), 0 );
416 m_part_no_data.RemoveDrawItem( &m_part_no_data.GetDrawItems()[LIB_SHAPE_T].front() );
417 BOOST_CHECK( m_part_no_data.Compare( testPart ) < 0 );
418 testPart.RemoveDrawItem( &testPart.GetDrawItems()[LIB_SHAPE_T].front() );
419 m_part_no_data.AddDrawItem( new LIB_SHAPE( &m_part_no_data, SHAPE_T::RECT ) );
420 BOOST_CHECK( m_part_no_data.Compare( testPart ) > 0 );
421 m_part_no_data.RemoveDrawItem( &m_part_no_data.GetDrawItems()[LIB_SHAPE_T].front() );
422
423 // Draw item list contents comparison tests.
424 testPart.AddDrawItem( new LIB_SHAPE( &testPart, SHAPE_T::RECT ) );
425 m_part_no_data.AddDrawItem( new LIB_SHAPE( &m_part_no_data, SHAPE_T::ARC ) );
426 BOOST_CHECK( m_part_no_data.Compare( testPart ) > 0 );
427 m_part_no_data.RemoveDrawItem( &m_part_no_data.GetDrawItems()[LIB_SHAPE_T].front() );
428 m_part_no_data.AddDrawItem( new LIB_PIN( &m_part_no_data ) );
429 BOOST_CHECK( m_part_no_data.Compare( testPart ) > 0 );
430 m_part_no_data.RemoveDrawItem( &m_part_no_data.GetDrawItems()[LIB_PIN_T].front() );
431 testPart.RemoveDrawItem( &testPart.GetDrawItems()[LIB_SHAPE_T].front() );
432
433 // Footprint filter array comparison tests.
434 wxArrayString footPrintFilters;
435 BOOST_CHECK( m_part_no_data.GetFPFilters() == footPrintFilters );
436 footPrintFilters.Add( "b" );
437 testPart.SetFPFilters( footPrintFilters );
438 BOOST_CHECK( m_part_no_data.Compare( testPart ) < 0 );
439 m_part_no_data.SetFPFilters( footPrintFilters );
440 footPrintFilters.Clear();
441 testPart.SetFPFilters( footPrintFilters );
442 BOOST_CHECK( m_part_no_data.Compare( testPart ) > 0 );
443 footPrintFilters.Clear();
444 m_part_no_data.SetFPFilters( footPrintFilters );
445 testPart.SetFPFilters( footPrintFilters );
446
447 // Description string tests.
448 m_part_no_data.SetDescription( "b" );
449 testPart.SetDescription( "b" );
450 BOOST_CHECK_EQUAL( m_part_no_data.Compare( testPart ), 0 );
451 m_part_no_data.SetDescription( "a" );
452 BOOST_CHECK( m_part_no_data.Compare( testPart ) < 0 );
453 m_part_no_data.SetDescription( "c" );
454 BOOST_CHECK( m_part_no_data.Compare( testPart ) > 0 );
455 m_part_no_data.SetDescription( wxEmptyString );
456 testPart.SetDescription( wxEmptyString );
457
458 // Key word string tests.
459 m_part_no_data.SetKeyWords( "b" );
460 testPart.SetKeyWords( "b" );
461 BOOST_CHECK_EQUAL( m_part_no_data.Compare( testPart ), 0 );
462 m_part_no_data.SetKeyWords( "a" );
463 BOOST_CHECK( m_part_no_data.Compare( testPart ) < 0 );
464 m_part_no_data.SetKeyWords( "c" );
465 BOOST_CHECK( m_part_no_data.Compare( testPart ) > 0 );
466 m_part_no_data.SetKeyWords( wxEmptyString );
467 testPart.SetKeyWords( wxEmptyString );
468
469 // Pin name offset comparison tests.
470 testPart.SetPinNameOffset( testPart.GetPinNameOffset() + 1 );
471 BOOST_CHECK( m_part_no_data.Compare( testPart ) < 0 );
472 testPart.SetPinNameOffset( testPart.GetPinNameOffset() - 2 );
473 BOOST_CHECK( m_part_no_data.Compare( testPart ) > 0 );
474 testPart.SetPinNameOffset( testPart.GetPinNameOffset() + 1 );
475
476 // Units locked flag comparison tests.
477 testPart.LockUnits( true );
478 BOOST_CHECK( m_part_no_data.Compare( testPart ) < 0 );
479 testPart.LockUnits( false );
480 m_part_no_data.LockUnits( true );
481 BOOST_CHECK( m_part_no_data.Compare( testPart ) > 0 );
482 m_part_no_data.LockUnits( false );
483
484 // Include in BOM support tests.
485 testPart.SetIncludeInBom( false );
486 BOOST_CHECK( m_part_no_data.Compare( testPart ) > 0 );
487 testPart.SetIncludeInBom( true );
488 m_part_no_data.SetIncludeInBom( false );
489 BOOST_CHECK( m_part_no_data.Compare( testPart ) < 0 );
490 m_part_no_data.SetIncludeInBom( true );
491
492 // Include on board support tests.
493 testPart.SetIncludeOnBoard( false );
494 BOOST_CHECK( m_part_no_data.Compare( testPart ) > 0 );
495 testPart.SetIncludeOnBoard( true );
496 m_part_no_data.SetIncludeOnBoard( false );
497 BOOST_CHECK( m_part_no_data.Compare( testPart ) < 0 );
498 m_part_no_data.SetIncludeOnBoard( true );
499
500 // Show pin names flag comparison tests.
501 m_part_no_data.SetShowPinNames( false );
502 BOOST_CHECK( m_part_no_data.Compare( testPart ) < 0 );
503 m_part_no_data.SetShowPinNames( true );
504 testPart.SetShowPinNames( false );
505 BOOST_CHECK( m_part_no_data.Compare( testPart ) > 0 );
506 testPart.SetShowPinNames( true );
507
508 // Show pin numbers flag comparison tests.
509 m_part_no_data.SetShowPinNumbers( false );
510 BOOST_CHECK( m_part_no_data.Compare( testPart ) < 0 );
511 m_part_no_data.SetShowPinNumbers( true );
512 testPart.SetShowPinNumbers( false );
513 BOOST_CHECK( m_part_no_data.Compare( testPart ) > 0 );
514 testPart.SetShowPinNumbers( true );
515
516 // Time stamp comparison tests.
517
518 // Check to see if we broke the copy ctor.
519 LIB_SYMBOL* copy = new LIB_SYMBOL( testPart );
520 BOOST_CHECK( testPart.Compare( *copy ) == 0 );
521}
522
523
527BOOST_AUTO_TEST_CASE( GetUnitItems )
528{
529 // There are no unit draw items in the empty LIB_SYMBOL object.
530 BOOST_CHECK( m_part_no_data.GetUnitDrawItems( 1, 1 ).size() == 0 );
531
532 // A single unique unit with 1 pin common to all units and all body styles.
533 LIB_PIN* pin1 = new LIB_PIN( &m_part_no_data );
534 m_part_no_data.AddDrawItem( pin1 );
535 BOOST_CHECK( m_part_no_data.GetUnitDrawItems( 0, 0 ).size() == 1 );
536
537 // A single unique unit with 1 pin in unit 1 and common to all body styles.
538 pin1->SetUnit( 1 );
539 BOOST_CHECK( m_part_no_data.GetUnitDrawItems( 1, 0 ).size() == 1 );
540
541 // A single unique unit with 1 pin in unit 1 and body style 1.
542 pin1->SetConvert( 1 );
543 BOOST_CHECK( m_part_no_data.GetUnitDrawItems( 1, 1 ).size() == 1 );
544
545 // Two unique units with pin 1 assigned to unit 1 and body style 1 and pin 2 assigned to
546 // unit 2 and body style 1.
547 LIB_PIN* pin2 = new LIB_PIN( &m_part_no_data );
548 m_part_no_data.SetUnitCount( 2 );
549 pin2->SetUnit( 2 );
550 pin2->SetConvert( 2 );
551 pin2->SetNumber( "4" );
552 m_part_no_data.AddDrawItem( pin2 );
553 BOOST_CHECK( m_part_no_data.GetUnitDrawItems( 2, 2 ).size() == 1 );
554
555 // Make pin 1 body style common to all units.
556 pin1->SetConvert( 0 );
557 BOOST_CHECK( m_part_no_data.GetUnitDrawItems( 1, 1 ).size() == 0 );
558 BOOST_CHECK( m_part_no_data.GetUnitDrawItems( 2, 1 ).size() == 1 );
559
560 m_part_no_data.RemoveDrawItem( pin2 );
561 m_part_no_data.RemoveDrawItem( pin1 );
562 m_part_no_data.RemoveDrawItem( &*m_part_no_data.GetDrawItems().begin() );
563}
564
565
569BOOST_AUTO_TEST_CASE( GetUnitDrawItems )
570{
571 // There are no unit draw items in the empty LIB_SYMBOL object.
572 BOOST_CHECK( m_part_no_data.GetUnitDrawItems().size() == 0 );
573
574 // A single unique unit with 1 pin common to all units and all body styles.
575 LIB_PIN* pin1 = new LIB_PIN( &m_part_no_data );
576 pin1->SetNumber( "1" );
577 m_part_no_data.AddDrawItem( pin1 );
578 std::vector<struct LIB_SYMBOL_UNIT> units = m_part_no_data.GetUnitDrawItems();
579 BOOST_CHECK( units.size() == 1 );
580 BOOST_CHECK( units[0].m_unit == 0 );
581 BOOST_CHECK( units[0].m_convert == 0 );
582 BOOST_CHECK( units[0].m_items[0] == pin1 );
583}
584
585
590{
591 std::unique_ptr<LIB_SYMBOL> parent = std::make_unique<LIB_SYMBOL>( "parent" );
592 BOOST_CHECK( parent->IsRoot() );
593 std::unique_ptr<LIB_SYMBOL> child1 = std::make_unique<LIB_SYMBOL>( "child1", parent.get() );
594 BOOST_CHECK( child1->IsAlias() );
595 LIB_SYMBOL_SPTR parentRef = child1->GetParent().lock();
596 BOOST_CHECK( parentRef );
597 BOOST_CHECK( parentRef == parent->SharedPtr() );
598 BOOST_CHECK_EQUAL( parent->SharedPtr().use_count(), 3 );
599 BOOST_CHECK_EQUAL( child1->GetUnitCount(), 1 );
600 parent->SetUnitCount( 4 );
601 BOOST_CHECK_EQUAL( child1->GetUnitCount(), 4 );
602 child1->SetParent();
603 BOOST_CHECK_EQUAL( child1->GetUnitCount(), 1 );
604 parentRef.reset();
605 BOOST_CHECK_EQUAL( parent->SharedPtr().use_count(), 2 );
606}
607
608
612BOOST_AUTO_TEST_CASE( CopyConstructor )
613{
614 std::shared_ptr<LIB_SYMBOL> copy = std::make_shared<LIB_SYMBOL>( m_part_no_data );
615 BOOST_CHECK( m_part_no_data == *copy.get() );
616}
617
618
619BOOST_AUTO_TEST_SUITE_END()
Field object used in symbol libraries.
Definition: lib_field.h:61
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:49
int SetLibItemName(const UTF8 &aLibItemName)
Override the library item name portion of the LIB_ID to aLibItemName.
Definition: lib_id.cpp:109
void SetConvert(int aConvert)
Definition: lib_item.h:275
void SetUnit(int aUnit)
Definition: lib_item.h:272
void SetNumber(const wxString &aNumber)
Definition: lib_pin.h:124
Define a library symbol object.
Definition: lib_symbol.h:99
void SetIncludeOnBoard(bool aIncludeOnBoard)
Set or clear include in board netlist flag.
Definition: lib_symbol.h:648
void RemoveDrawItem(LIB_ITEM *aItem)
Remove draw aItem from list.
Definition: lib_symbol.cpp:797
void SetShowPinNames(bool aShow)
Set or clear the pin name visibility flag.
Definition: lib_symbol.h:624
int GetPinNameOffset() const
Definition: lib_symbol.h:617
void SetUnitCount(int aCount, bool aDuplicateDrawItems=true)
Set the units per symbol count.
void SetPinNameOffset(int aOffset)
Set the offset in mils of the pin name text from the pin symbol.
Definition: lib_symbol.h:616
void SetPower()
Definition: lib_symbol.cpp:557
void LockUnits(bool aLockUnits)
Set interchangeable the property for symbol units.
Definition: lib_symbol.h:252
void SetShowPinNumbers(bool aShow)
Set or clear the pin number visibility flag.
Definition: lib_symbol.h:632
LIB_ITEMS_CONTAINER & GetDrawItems()
Return a reference to the draw item list.
Definition: lib_symbol.h:508
LIB_ID GetLibId() const override
Definition: lib_symbol.h:141
void SetDescription(const wxString &aDescription)
Definition: lib_symbol.h:149
void SetKeyWords(const wxString &aKeyWords)
Definition: lib_symbol.h:162
void AddDrawItem(LIB_ITEM *aItem, bool aSort=true)
Add a new draw aItem to the draw object list and sort according to aSort.
Definition: lib_symbol.cpp:823
void SetFPFilters(const wxArrayString &aFilters)
Definition: lib_symbol.h:197
int Compare(const LIB_SYMBOL &aRhs, int aCompareFlags=0) const
Comparison test that can be used for operators.
Definition: lib_symbol.cpp:233
void SetIncludeInBom(bool aIncludeInBom)
Set or clear the include in schematic bill of materials flag.
Definition: lib_symbol.h:640
void SetLibId(const LIB_ID &aLibId)
Definition: lib_symbol.h:142
virtual void SetName(const wxString &aName)
Definition: lib_symbol.cpp:437
void SetNormal()
Definition: lib_symbol.cpp:575
LIB_SYMBOL m_part_no_data
‍Part with no extra data set
Test utils (e.g.
std::shared_ptr< LIB_SYMBOL > LIB_SYMBOL_SPTR
shared pointer to LIB_SYMBOL
Definition: lib_symbol.h:45
bool AreDefaultFieldsCorrect(const std::vector< LIB_FIELD > &aFields)
Predicate to check that the mandatory fields in a LIB_FIELDS object look sensible.
bool FieldNameIdMatches(const LIB_FIELD &aField, const std::string &aExpectedName, int aExpectedId)
Predicate to check a field name is as expected.
@ FOOTPRINT_FIELD
Field Name Module PCB, i.e. "16DIP300".
@ VALUE_FIELD
Field Value of part, i.e. "3.3K".
@ MANDATORY_FIELDS
The first 4 are mandatory, and must be instantiated in SCH_COMPONENT and LIB_PART constructors.
@ REFERENCE_FIELD
Field Reference of part, i.e. "IC21".
BOOST_CHECK(box.ClosestPointTo(VECTOR2D(0, 0))==VECTOR2D(1, 2))
Test suite for KiCad math code.
BOOST_AUTO_TEST_CASE(DefaultProperties)
Declare the test suite.
@ LIB_SHAPE_T
Definition: typeinfo.h:199
@ LIB_PIN_T
Definition: typeinfo.h:202
#define BOOST_TEST_CONTEXT(A)