feat(cpp-object-oriented-modular-refactoring): step 3 - foundation-google-style

This commit is contained in:
KOKO\Mimi
2026-08-16 04:26:14 +09:00
parent 2628ed3488
commit 042edadffb
93 changed files with 3144 additions and 3175 deletions
+27 -27
View File
@@ -59,7 +59,7 @@ fesa::ModelDefinition makeOwnedDefinition() {
1.0,
{"models/owned.inp", 55U}}};
definition.warnings = {{
fesa::Severity::warning,
fesa::Severity::kWarning,
"ignored-output-request",
{"models/owned.inp", 70U},
"*OUTPUT",
@@ -73,17 +73,17 @@ fesa::ModelDefinition makeOwnedDefinition() {
TEST(DomainModel, ImmutableOwnershipPreservesStableOrder) {
auto definition = makeOwnedDefinition();
auto result = fesa::Domain::create(definition);
ASSERT_TRUE(result.hasValue());
ASSERT_TRUE(result.HasValue());
definition.sourcePath = "mutated.inp";
definition.sourceContentIdentity = "mutated";
definition.nodes[0].sourceId.sourceLabelText = "mutated";
definition.nodes[0].sourceId.source_label_text = "mutated";
definition.nodes[0].coordinates[0] = -99.0;
definition.sections[0].sectionPoints[0][0] = -99.0;
definition.steps[0].loads[0].magnitude = 99.0;
definition.warnings[0].code = "mutated";
const fesa::Domain& domain = result.value();
const fesa::Domain& domain = result.Value();
const fesa::Node* const firstNodeAddress = domain.nodes().data();
static_assert(std::is_same_v<
decltype(std::declval<const fesa::Domain&>().nodes()),
@@ -95,10 +95,10 @@ TEST(DomainModel, ImmutableOwnershipPreservesStableOrder) {
EXPECT_EQ(domain.sourcePath(), std::filesystem::path{"models/owned.inp"});
EXPECT_EQ(domain.sourceContentIdentity(), "fnv1a64:fedcba9876543210");
ASSERT_EQ(domain.nodes().size(), 2U);
EXPECT_EQ(domain.nodes()[0].sourceId.sourceLabel, 20);
EXPECT_EQ(domain.nodes()[0].sourceId.sourceLabelText, "0020");
EXPECT_EQ(domain.nodes()[0].sourceId.source_label, 20);
EXPECT_EQ(domain.nodes()[0].sourceId.source_label_text, "0020");
EXPECT_DOUBLE_EQ(domain.nodes()[0].coordinates[0], 2.0);
EXPECT_EQ(domain.nodes()[1].sourceId.sourceLabel, 10);
EXPECT_EQ(domain.nodes()[1].sourceId.source_label, 10);
EXPECT_EQ(domain.nodes().data(), firstNodeAddress);
ASSERT_EQ(domain.elements().size(), 1U);
@@ -162,23 +162,23 @@ TEST(DomainModel, MultipleIdentityInstancesDoNotMerge) {
{"models/two-instances.inp", 60U}}};
auto result = fesa::Domain::create(std::move(definition));
ASSERT_TRUE(result.hasValue());
const fesa::Domain& domain = result.value();
ASSERT_TRUE(result.HasValue());
const fesa::Domain& domain = result.Value();
ASSERT_EQ(domain.nodes().size(), 4U);
EXPECT_EQ(domain.nodes()[0].sourceId.sourceLabel, 1);
EXPECT_EQ(domain.nodes()[2].sourceId.sourceLabel, 1);
EXPECT_EQ(domain.nodes()[0].sourceId.sourceLabelText, "1");
EXPECT_EQ(domain.nodes()[2].sourceId.sourceLabelText, "1");
EXPECT_EQ(domain.nodes()[0].sourceId.source_label, 1);
EXPECT_EQ(domain.nodes()[2].sourceId.source_label, 1);
EXPECT_EQ(domain.nodes()[0].sourceId.source_label_text, "1");
EXPECT_EQ(domain.nodes()[2].sourceId.source_label_text, "1");
EXPECT_NE(
domain.nodes()[0].sourceId.instanceName,
domain.nodes()[2].sourceId.instanceName);
domain.nodes()[0].sourceId.instance_name,
domain.nodes()[2].sourceId.instance_name);
ASSERT_EQ(domain.elements().size(), 2U);
EXPECT_EQ(domain.elements()[0].sourceId.sourceLabel, 1);
EXPECT_EQ(domain.elements()[1].sourceId.sourceLabel, 1);
EXPECT_EQ(domain.elements()[0].sourceId.instanceName, "Instance-A");
EXPECT_EQ(domain.elements()[1].sourceId.instanceName, "Instance-B");
EXPECT_EQ(domain.elements()[0].sourceId.source_label, 1);
EXPECT_EQ(domain.elements()[1].sourceId.source_label, 1);
EXPECT_EQ(domain.elements()[0].sourceId.instance_name, "Instance-A");
EXPECT_EQ(domain.elements()[1].sourceId.instance_name, "Instance-B");
EXPECT_EQ(domain.elements()[0].nodeIndices[0], 0U);
EXPECT_EQ(domain.elements()[1].nodeIndices[0], 2U);
}
@@ -212,13 +212,13 @@ TEST(DomainModel, ShellOwnershipPreservesResolvedAssignmentsAndOptionalFrames) {
{0U, {0.0, 1.0, 0.0}, {1.0, 0.0, 0.0}, {0.0, 0.0, -1.0}}};
auto result = fesa::Domain::create(definition);
ASSERT_TRUE(result.hasValue());
ASSERT_TRUE(result.HasValue());
definition.shellSections[0].thickness = -1.0;
definition.shellElements[0].sourceId.sourceLabelText = "mutated";
definition.shellElements[0].sourceId.source_label_text = "mutated";
definition.shellNodeInitialFrames[0].director[2] = -1.0;
const fesa::Domain& domain = result.value();
const fesa::Domain& domain = result.Value();
static_assert(std::is_same_v<
decltype(std::declval<const fesa::Domain&>().shellElements()),
const std::vector<fesa::Mitc4ShellDefinition>&>);
@@ -230,9 +230,9 @@ TEST(DomainModel, ShellOwnershipPreservesResolvedAssignmentsAndOptionalFrames) {
const std::vector<fesa::ShellNodeInitialFrame>&>);
ASSERT_EQ(domain.shellElements().size(), 2U);
EXPECT_EQ(domain.shellElements()[0].sourceId.sourceLabel, 20);
EXPECT_EQ(domain.shellElements()[0].sourceId.sourceLabelText, "0020");
EXPECT_EQ(domain.shellElements()[1].sourceId.sourceLabel, 10);
EXPECT_EQ(domain.shellElements()[0].sourceId.source_label, 20);
EXPECT_EQ(domain.shellElements()[0].sourceId.source_label_text, "0020");
EXPECT_EQ(domain.shellElements()[1].sourceId.source_label, 10);
EXPECT_EQ(domain.shellElements()[0].sourceType, fesa::ShellSourceElementType::s4r);
EXPECT_EQ(domain.shellElements()[1].sourceType, fesa::ShellSourceElementType::s4);
EXPECT_EQ(domain.shellElements()[0].nodeIndices[3], 7U);
@@ -258,6 +258,6 @@ TEST(DomainModel, ShellOwnershipPreservesResolvedAssignmentsAndOptionalFrames) {
(std::array<double, 3>{0.0, 1.0, 0.0}));
auto noFramesResult = fesa::Domain::create(fesa::ModelDefinition{});
ASSERT_TRUE(noFramesResult.hasValue());
EXPECT_TRUE(noFramesResult.value().shellNodeInitialFrames().empty());
ASSERT_TRUE(noFramesResult.HasValue());
EXPECT_TRUE(noFramesResult.Value().shellNodeInitialFrames().empty());
}