KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_property_holder.cpp File Reference

Test suite for PROPERTY_HOLDER and PROPERTY_MIXIN classes. More...

#include <qa_utils/wx_utils/unit_test_utils.h>
#include <property_holder.h>
#include <string>
#include <vector>
#include <memory>

Go to the source code of this file.

Functions

 BOOST_AUTO_TEST_CASE (BasicSetGet)
 Declare the test suite.
 
 BOOST_AUTO_TEST_CASE (TypeSafety)
 Test type safety - getting with wrong type should return nullopt.
 
 BOOST_AUTO_TEST_CASE (DefaultValues)
 Test GetPropertyOr with default values.
 
 BOOST_AUTO_TEST_CASE (ExistenceChecking)
 Test property existence checking.
 
 BOOST_AUTO_TEST_CASE (TypeSpecificExistence)
 Test type-specific existence checking.
 
 BOOST_AUTO_TEST_CASE (PropertyRemoval)
 Test property removal.
 
 BOOST_AUTO_TEST_CASE (ClearProperties)
 Test clearing all properties.
 
 BOOST_AUTO_TEST_CASE (SizeAndEmpty)
 Test size and empty functionality.
 
 BOOST_AUTO_TEST_CASE (KeyRetrieval)
 Test key retrieval.
 
 BOOST_AUTO_TEST_CASE (TypeInformation)
 Test type information retrieval.
 
 BOOST_AUTO_TEST_CASE (ComplexObjects)
 Test complex object storage and retrieval.
 
 BOOST_AUTO_TEST_CASE (PropertyOverwriting)
 Test property overwriting.
 
 BOOST_AUTO_TEST_CASE (BasicMixin)
 Test suite for PROPERTY_MIXIN.
 
 BOOST_AUTO_TEST_CASE (MultipleInstances)
 Test PROPERTY_MIXIN with multiple instances.
 
 BOOST_AUTO_TEST_CASE (PropertyHolderAccess)
 Test access to underlying PROPERTY_HOLDER.
 
 BOOST_AUTO_TEST_CASE (EmptyKeys)
 Test suite for edge cases and error conditions.
 
 BOOST_AUTO_TEST_CASE (MoveSemantics)
 Test move semantics.
 
 BOOST_AUTO_TEST_CASE (NullScenarios)
 Test with null/invalid scenarios.
 
 BOOST_AUTO_TEST_CASE (MagicValueValidation)
 Test suite for magic value validation and memory safety.
 
 BOOST_AUTO_TEST_CASE (SafeCasting)
 Test safe casting functionality.
 
 BOOST_AUTO_TEST_CASE (SafeCastingInvalid)
 Test safe casting with invalid pointers.
 
 BOOST_AUTO_TEST_CASE (UseAfterFreeDetection)
 Test use-after-free detection.
 
 BOOST_AUTO_TEST_CASE (ClientDataHelpers)
 Test client data creation and deletion helpers.
 
 BOOST_AUTO_TEST_CASE (CopyMoveConstructors)
 Test copy and move constructors preserve magic value.
 
 BOOST_AUTO_TEST_CASE (AssignmentOperators)
 Test assignment operators preserve magic value.
 
 BOOST_AUTO_TEST_CASE (InvalidObjectBehavior)
 Test behavior of methods when object is invalid.
 

Detailed Description

Test suite for PROPERTY_HOLDER and PROPERTY_MIXIN classes.

Tests the core functionality of the property system including type safety, storage, retrieval, and all utility functions.

Definition in file test_property_holder.cpp.

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/26]

BOOST_AUTO_TEST_CASE ( AssignmentOperators  )

◆ BOOST_AUTO_TEST_CASE() [2/26]

BOOST_AUTO_TEST_CASE ( BasicMixin  )

Test suite for PROPERTY_MIXIN.

Test basic PROPERTY_MIXIN functionality

Definition at line 416 of file test_property_holder.cpp.

References BOOST_CHECK_EQUAL().

◆ BOOST_AUTO_TEST_CASE() [3/26]

BOOST_AUTO_TEST_CASE ( BasicSetGet  )

Declare the test suite.

Test basic property setting and getting

Definition at line 114 of file test_property_holder.cpp.

References BOOST_CHECK_EQUAL(), PROPERTY_HOLDER::GetProperty(), and PROPERTY_HOLDER::SetProperty().

◆ BOOST_AUTO_TEST_CASE() [4/26]

BOOST_AUTO_TEST_CASE ( ClearProperties  )

◆ BOOST_AUTO_TEST_CASE() [5/26]

BOOST_AUTO_TEST_CASE ( ClientDataHelpers  )

◆ BOOST_AUTO_TEST_CASE() [6/26]

BOOST_AUTO_TEST_CASE ( ComplexObjects  )

Test complex object storage and retrieval.

Definition at line 347 of file test_property_holder.cpp.

References BOOST_CHECK_EQUAL(), PROPERTY_HOLDER::GetProperty(), and PROPERTY_HOLDER::SetProperty().

◆ BOOST_AUTO_TEST_CASE() [7/26]

BOOST_AUTO_TEST_CASE ( CopyMoveConstructors  )

Test copy and move constructors preserve magic value.

Definition at line 670 of file test_property_holder.cpp.

References BOOST_CHECK_EQUAL(), copied, PROPERTY_HOLDER::IsValid(), moved, and PROPERTY_HOLDER::SetProperty().

◆ BOOST_AUTO_TEST_CASE() [8/26]

BOOST_AUTO_TEST_CASE ( DefaultValues  )

Test GetPropertyOr with default values.

Definition at line 169 of file test_property_holder.cpp.

References BOOST_CHECK_EQUAL(), PROPERTY_HOLDER::GetPropertyOr(), and PROPERTY_HOLDER::SetProperty().

◆ BOOST_AUTO_TEST_CASE() [9/26]

BOOST_AUTO_TEST_CASE ( EmptyKeys  )

Test suite for edge cases and error conditions.

Test with empty string keys

Definition at line 489 of file test_property_holder.cpp.

References BOOST_CHECK_EQUAL(), PROPERTY_HOLDER::GetPropertyOr(), PROPERTY_HOLDER::HasProperty(), and PROPERTY_HOLDER::SetProperty().

◆ BOOST_AUTO_TEST_CASE() [10/26]

BOOST_AUTO_TEST_CASE ( ExistenceChecking  )

Test property existence checking.

Definition at line 197 of file test_property_holder.cpp.

References BOOST_CHECK_EQUAL().

◆ BOOST_AUTO_TEST_CASE() [11/26]

◆ BOOST_AUTO_TEST_CASE() [12/26]

BOOST_AUTO_TEST_CASE ( KeyRetrieval  )

Test key retrieval.

Definition at line 299 of file test_property_holder.cpp.

References BOOST_CHECK_EQUAL(), expected, PROPERTY_HOLDER::GetKeys(), and PROPERTY_HOLDER::SetProperty().

◆ BOOST_AUTO_TEST_CASE() [13/26]

BOOST_AUTO_TEST_CASE ( MagicValueValidation  )

Test suite for magic value validation and memory safety.

Test magic value validation

Definition at line 555 of file test_property_holder.cpp.

References BOOST_CHECK_EQUAL(), PROPERTY_HOLDER::GetPropertyOr(), PROPERTY_HOLDER::HasProperty(), PROPERTY_HOLDER::IsValid(), PROPERTY_HOLDER::MAGIC_VALUE, and PROPERTY_HOLDER::SetProperty().

◆ BOOST_AUTO_TEST_CASE() [14/26]

BOOST_AUTO_TEST_CASE ( MoveSemantics  )

Test move semantics.

Definition at line 507 of file test_property_holder.cpp.

References BOOST_CHECK_EQUAL(), PROPERTY_HOLDER::GetProperty(), and PROPERTY_HOLDER::SetProperty().

◆ BOOST_AUTO_TEST_CASE() [15/26]

BOOST_AUTO_TEST_CASE ( MultipleInstances  )

Test PROPERTY_MIXIN with multiple instances.

Definition at line 438 of file test_property_holder.cpp.

References BOOST_CHECK_EQUAL().

◆ BOOST_AUTO_TEST_CASE() [16/26]

BOOST_AUTO_TEST_CASE ( NullScenarios  )

◆ BOOST_AUTO_TEST_CASE() [17/26]

BOOST_AUTO_TEST_CASE ( PropertyHolderAccess  )

◆ BOOST_AUTO_TEST_CASE() [18/26]

BOOST_AUTO_TEST_CASE ( PropertyOverwriting  )

◆ BOOST_AUTO_TEST_CASE() [19/26]

BOOST_AUTO_TEST_CASE ( PropertyRemoval  )

◆ BOOST_AUTO_TEST_CASE() [20/26]

BOOST_AUTO_TEST_CASE ( SafeCasting  )

◆ BOOST_AUTO_TEST_CASE() [21/26]

BOOST_AUTO_TEST_CASE ( SafeCastingInvalid  )

Test safe casting with invalid pointers.

Definition at line 602 of file test_property_holder.cpp.

References BOOST_CHECK_EQUAL(), and PROPERTY_HOLDER::SafeCast().

◆ BOOST_AUTO_TEST_CASE() [22/26]

BOOST_AUTO_TEST_CASE ( SizeAndEmpty  )

Test size and empty functionality.

Definition at line 277 of file test_property_holder.cpp.

References BOOST_CHECK_EQUAL().

◆ BOOST_AUTO_TEST_CASE() [23/26]

BOOST_AUTO_TEST_CASE ( TypeInformation  )

Test type information retrieval.

Definition at line 324 of file test_property_holder.cpp.

References PROPERTY_HOLDER::GetPropertyType(), and PROPERTY_HOLDER::SetProperty().

◆ BOOST_AUTO_TEST_CASE() [24/26]

BOOST_AUTO_TEST_CASE ( TypeSafety  )

Test type safety - getting with wrong type should return nullopt.

Definition at line 145 of file test_property_holder.cpp.

References BOOST_CHECK_EQUAL(), PROPERTY_HOLDER::GetProperty(), and PROPERTY_HOLDER::SetProperty().

◆ BOOST_AUTO_TEST_CASE() [25/26]

BOOST_AUTO_TEST_CASE ( TypeSpecificExistence  )

Test type-specific existence checking.

Definition at line 212 of file test_property_holder.cpp.

References BOOST_CHECK_EQUAL().

◆ BOOST_AUTO_TEST_CASE() [26/26]

BOOST_AUTO_TEST_CASE ( UseAfterFreeDetection  )