mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-22 12:28:07 +00:00
Don't bind to reference in order not to overwrite entity instance storage in case of IfcPropertySetDefinitionSet
This commit is contained in:
@@ -3,9 +3,15 @@
|
||||
add_executable(test_ifcopenshell_parse
|
||||
test_ifcopenshell_parse.cpp
|
||||
)
|
||||
target_link_libraries(test_ifcopenshell_parse PRIVATE Catch2::Catch2WithMain)
|
||||
target_compile_definitions(test_ifcopenshell_parse PRIVATE
|
||||
IFCOPENSHELL_TEST_FIXTURES="${CMAKE_CURRENT_SOURCE_DIR}/../../ifcopenshell-python/test/fixtures"
|
||||
)
|
||||
target_link_libraries(test_ifcopenshell_parse PRIVATE Catch2::Catch2WithMain IfcParse)
|
||||
add_dependencies(test_ifcopenshell_parse parse_schema_ifc4)
|
||||
catch_discover_tests(test_ifcopenshell_parse
|
||||
DL_PATHS
|
||||
$<TARGET_FILE_DIR:Catch2::Catch2>
|
||||
$<TARGET_FILE_DIR:Catch2::Catch2WithMain>
|
||||
$<TARGET_FILE_DIR:IfcParse>
|
||||
$<TARGET_FILE_DIR:plugin>
|
||||
)
|
||||
|
||||
@@ -1,7 +1,27 @@
|
||||
// This file was generated with the assistance of an AI coding tool.
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <ifcparse/file.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
TEST_CASE("IfcParse C++ test scaffold is registered", "[ifcparse]") {
|
||||
REQUIRE(true);
|
||||
TEST_CASE("IfcPropertySetDefinitionSet references are resolved without replacing their owner", "[ifcparse]") {
|
||||
const std::string fixture = std::string(IFCOPENSHELL_TEST_FIXTURES) + "/ColumnPSetsOfSets.ifc";
|
||||
ifcopenshell::file file(fixture);
|
||||
|
||||
REQUIRE(file.good());
|
||||
|
||||
const auto relationship = file.instance_by_id(139);
|
||||
REQUIRE(relationship);
|
||||
CHECK(relationship.id() == 139);
|
||||
CHECK(relationship.declaration().name() == "IfcRelDefinesByProperties");
|
||||
|
||||
const express::base definition_set = relationship.get_attribute_value(5);
|
||||
REQUIRE(definition_set);
|
||||
CHECK(definition_set.declaration().name() == "IfcPropertySetDefinitionSet");
|
||||
|
||||
const std::vector<express::base> definitions = definition_set.get_attribute_value(0);
|
||||
REQUIRE(definitions.size() == 2);
|
||||
CHECK(definitions[0].id() == 136);
|
||||
CHECK(definitions[1].id() == 138);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user