Skip to content

Commit 42b8c8d

Browse files
committed
TEST: Add explicit validation for UniversalHermannMauguin
1 parent d8ab15c commit 42b8c8d

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

src/Plugins/OrientationAnalysis/test/ReadGrainMapper3DTest.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include <catch2/catch.hpp>
22

3+
#include "simplnx/DataStructure/StringArray.hpp"
34
#include "simplnx/Parameters/ArrayCreationParameter.hpp"
45
#include "simplnx/Parameters/BoolParameter.hpp"
56
#include "simplnx/Parameters/FileSystemPathParameter.hpp"
@@ -81,6 +82,24 @@ TEST_CASE("OrientationAnalysis::ReadGrainMapper3D:Default_Parameters", "[Orienta
8182
UnitTest::CompareExemplarToGenerateAttributeMatrix(dataStructure, exemplarDCTGeometryPath.createChildPath(k_Cell_Ensemble_Data), dataStructure,
8283
computedDCTGeometryPath.createChildPath(k_Cell_Ensemble_Data));
8384

85+
// The exemplar .dream3d predates the UniversalHermannMauguin ensemble array and therefore cannot be used
86+
// to compare it. Verify the parsed values directly against the known phase metadata so a regression in the
87+
// dataset that is read (UniversalHermannMauguin vs. Name) is caught. Index 0 is the reserved invalid phase.
88+
{
89+
const std::vector<std::string> expectedHermannMauguin = {
90+
"Invalid Phase", "F d -3 m :2 (a-1/8,b-1/8,c-1/8)", "F d -3 m :2 (a-1/8,b-1/8,c-1/8)", "P 63/m m c", "P 42/m n m", "R -3 c :H (-y+z,x+z,-x+y+z)", "P 32 2 1", "P b c n", "C 1 2/m 1",
91+
"P -1 (a+b,a-b,-c)"};
92+
const DataPath hermannMauguinPath = computedDCTGeometryPath.createChildPath(k_Cell_Ensemble_Data).createChildPath("UniversalHermannMauguin");
93+
REQUIRE_NOTHROW(dataStructure.getDataRefAs<StringArray>(hermannMauguinPath));
94+
const auto& hermannMauguinArray = dataStructure.getDataRefAs<StringArray>(hermannMauguinPath);
95+
REQUIRE(hermannMauguinArray.getNumberOfTuples() == expectedHermannMauguin.size());
96+
for(usize i = 0; i < expectedHermannMauguin.size(); i++)
97+
{
98+
CAPTURE(i);
99+
REQUIRE(hermannMauguinArray[i] == expectedHermannMauguin[i]);
100+
}
101+
}
102+
84103
UnitTest::CheckArraysInheritTupleDims(dataStructure);
85104
}
86105

0 commit comments

Comments
 (0)