fix: normalize MITC4 reference identities

This commit is contained in:
KOKO\Mimi
2026-08-12 22:29:12 +09:00
parent b805683832
commit 56833abe68
3 changed files with 25 additions and 4 deletions
@@ -87,7 +87,13 @@ CaseEvidence runCase(
auto comparisonResult = fesa::test::Mitc4ReferenceComparison::compare( auto comparisonResult = fesa::test::Mitc4ReferenceComparison::compare(
{caseId, sourceElementType, input, csv, results}); {caseId, sourceElementType, input, csv, results});
if (!comparisonResult.hasValue()) { if (!comparisonResult.hasValue()) {
ADD_FAILURE() << "MITC4 comparison precheck failed for " << caseId; std::string diagnostics;
for (const auto& diagnostic :
comparisonResult.status().diagnostics()) {
diagnostics += "\n" + diagnostic.code + ": " + diagnostic.message;
}
ADD_FAILURE() << "MITC4 comparison precheck failed for " << caseId
<< diagnostics;
return {{}, comparison}; return {{}, comparison};
} }
EXPECT_TRUE( EXPECT_TRUE(
+15 -3
View File
@@ -120,13 +120,25 @@ double parseFiniteDouble(const std::string& field) {
return value; return value;
} }
std::string uppercaseAscii(std::string value) {
std::transform(
value.begin(), value.end(), value.begin(), [](const char character) {
return character >= 'a' && character <= 'z'
? static_cast<char>(character - 'a' + 'A')
: character;
});
return value;
}
struct IdentityKey { struct IdentityKey {
std::string instanceName; std::string instanceName;
std::int64_t sourceNodeLabel; std::int64_t sourceNodeLabel;
bool operator<(const IdentityKey& other) const noexcept { bool operator<(const IdentityKey& other) const {
if (instanceName != other.instanceName) { const std::string normalizedInstance = uppercaseAscii(instanceName);
return instanceName < other.instanceName; const std::string normalizedOther = uppercaseAscii(other.instanceName);
if (normalizedInstance != normalizedOther) {
return normalizedInstance < normalizedOther;
} }
return sourceNodeLabel < other.sourceNodeLabel; return sourceNodeLabel < other.sourceNodeLabel;
} }
@@ -540,6 +540,9 @@ TEST(Mitc4ReferenceComparison, MapsTrimmedHeaderAndSixComponentsBySourceIdentity
ContractFixture fixture{"mapping"}; ContractFixture fixture{"mapping"};
auto csvRows = defaultRows(); auto csvRows = defaultRows();
std::reverse(csvRows.begin(), csvRows.end()); std::reverse(csvRows.begin(), csvRows.end());
for (auto& row : csvRows) {
row.instanceName = "part-1-1";
}
writeCsv( writeCsv(
fixture.csv(), csvRows, fixture.csv(), csvRows,
" Part Instance Name , Node Label , U-U1 , U-U2 , U-U3 , " " Part Instance Name , Node Label , U-U1 , U-U2 , U-U3 , "