KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_template_fieldnames.cpp File Reference
#include <qa_utils/wx_utils/unit_test_utils.h>
#include <boost/test/unit_test.hpp>
#include <template_fieldnames.h>

Go to the source code of this file.

Functions

 BOOST_AUTO_TEST_CASE (MandatoryFieldsAreCaseInsensitive)
 Mandatory field names collide with any case variant (the s-expression parser folds case variants of mandatory fields onto the canonical mandatory field).
 
 BOOST_AUTO_TEST_CASE (UserFieldsAreCaseSensitive)
 User-defined field names are case-sensitive in storage, so two user fields that differ only in case (e.g.
 
 BOOST_AUTO_TEST_CASE (IdenticalNamesMatch)
 Identical names always match (regardless of case).
 
 BOOST_AUTO_TEST_CASE (DifferentUserNamesDoNotMatch)
 Different user-defined names never match.
 
 BOOST_AUTO_TEST_CASE (MandatoryNameDoesNotPullInUnrelatedNames)
 A user field whose name only superficially resembles a mandatory canonical name is not treated as a duplicate of an unrelated user field.
 
 BOOST_AUTO_TEST_CASE (SheetMandatoryFieldsAreCaseInsensitive)
 Sheet mandatory fields (Sheetname, Sheetfile) are folded case-insensitively by the parser for SCH_SHEET_T parents, so the helper must collide their case variants when given the SHEET_MANDATORY_FIELDS set.
 
 BOOST_AUTO_TEST_CASE (GlobalLabelMandatoryFieldsAreCaseInsensitive)
 Global label mandatory fields (Intersheetrefs) are folded case-insensitively by the parser for SCH_GLOBAL_LABEL_T parents.
 
 BOOST_AUTO_TEST_CASE (EmptyMandatorySetIsAlwaysCaseSensitive)
 An empty mandatory-field set (used by hierarchical / regular / directive labels which have no mandatory user-visible fields) makes every comparison case-sensitive.
 
static bool hasTemplate (TEMPLATES &aTemplates, const wxString &aName)
 
 BOOST_AUTO_TEST_CASE (TemplateRejectsMandatoryCaseVariant)
 A field-name template that only differs in case from a mandatory canonical field (e.g.
 
 BOOST_AUTO_TEST_CASE (TemplateKeepsUserCaseVariantsDistinct)
 Two user field-name templates that differ only in case (e.g.
 

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/10]

BOOST_AUTO_TEST_CASE ( DifferentUserNamesDoNotMatch )

Different user-defined names never match.

Definition at line 72 of file test_template_fieldnames.cpp.

References FieldNamesAreDuplicates().

◆ BOOST_AUTO_TEST_CASE() [2/10]

BOOST_AUTO_TEST_CASE ( EmptyMandatorySetIsAlwaysCaseSensitive )

An empty mandatory-field set (used by hierarchical / regular / directive labels which have no mandatory user-visible fields) makes every comparison case-sensitive.

Definition at line 129 of file test_template_fieldnames.cpp.

References FieldNamesAreDuplicates().

◆ BOOST_AUTO_TEST_CASE() [3/10]

BOOST_AUTO_TEST_CASE ( GlobalLabelMandatoryFieldsAreCaseInsensitive )

Global label mandatory fields (Intersheetrefs) are folded case-insensitively by the parser for SCH_GLOBAL_LABEL_T parents.

Definition at line 114 of file test_template_fieldnames.cpp.

References FieldNamesAreDuplicates(), and GLOBALLABEL_MANDATORY_FIELDS.

◆ BOOST_AUTO_TEST_CASE() [4/10]

BOOST_AUTO_TEST_CASE ( IdenticalNamesMatch )

Identical names always match (regardless of case).

Definition at line 61 of file test_template_fieldnames.cpp.

References FieldNamesAreDuplicates().

◆ BOOST_AUTO_TEST_CASE() [5/10]

BOOST_AUTO_TEST_CASE ( MandatoryFieldsAreCaseInsensitive )

Mandatory field names collide with any case variant (the s-expression parser folds case variants of mandatory fields onto the canonical mandatory field).

Definition at line 34 of file test_template_fieldnames.cpp.

References BOOST_AUTO_TEST_CASE(), and FieldNamesAreDuplicates().

◆ BOOST_AUTO_TEST_CASE() [6/10]

BOOST_AUTO_TEST_CASE ( MandatoryNameDoesNotPullInUnrelatedNames )

A user field whose name only superficially resembles a mandatory canonical name is not treated as a duplicate of an unrelated user field.

Definition at line 83 of file test_template_fieldnames.cpp.

References FieldNamesAreDuplicates().

◆ BOOST_AUTO_TEST_CASE() [7/10]

BOOST_AUTO_TEST_CASE ( SheetMandatoryFieldsAreCaseInsensitive )

Sheet mandatory fields (Sheetname, Sheetfile) are folded case-insensitively by the parser for SCH_SHEET_T parents, so the helper must collide their case variants when given the SHEET_MANDATORY_FIELDS set.

Definition at line 96 of file test_template_fieldnames.cpp.

References FieldNamesAreDuplicates(), and SHEET_MANDATORY_FIELDS.

◆ BOOST_AUTO_TEST_CASE() [8/10]

BOOST_AUTO_TEST_CASE ( TemplateKeepsUserCaseVariantsDistinct )

Two user field-name templates that differ only in case (e.g.

"Manufacturer" vs "MANUFACTURER") are distinct and both retained. See issue #24021.

Definition at line 170 of file test_template_fieldnames.cpp.

References TEMPLATES::AddTemplateFieldName(), BOOST_CHECK_EQUAL(), TEMPLATES::GetTemplateFieldNames(), and hasTemplate().

◆ BOOST_AUTO_TEST_CASE() [9/10]

BOOST_AUTO_TEST_CASE ( TemplateRejectsMandatoryCaseVariant )

A field-name template that only differs in case from a mandatory canonical field (e.g.

"VALUE" vs "Value") must be rejected, because the s-expression parser folds it onto the mandatory field and it can never exist as a distinct user field. See issue #24021.

Definition at line 154 of file test_template_fieldnames.cpp.

References TEMPLATES::AddTemplateFieldName(), and hasTemplate().

◆ BOOST_AUTO_TEST_CASE() [10/10]

BOOST_AUTO_TEST_CASE ( UserFieldsAreCaseSensitive )

User-defined field names are case-sensitive in storage, so two user fields that differ only in case (e.g.

"Manufacturer" vs "MANUFACTURER") must be treated as distinct. See issue #24021.

Definition at line 50 of file test_template_fieldnames.cpp.

References FieldNamesAreDuplicates().

◆ hasTemplate()

static bool hasTemplate ( TEMPLATES & aTemplates,
const wxString & aName )
static