Skip to content

Commit

Permalink
minimize changes from "master"
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Smith committed Jan 18, 2022
1 parent 0b4deaa commit 25b34ab
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions six/modules/c++/six.sicd/unittests/test_valid_six.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,8 @@ TEST_CASE(valid_six_50x50)
valid_six_50x50_(&schemaPaths); // validate against schema
}

const std::string classificationText_iso8859_1_("NON CLASSIFI\xc9 / UNCLASSIFIED"); // ISO8859-1 "NON CLASSIFIÉ / UNCLASSIFIED"
const auto classificationText_iso8859_1 = str::EncodedStringView::fromWindows1252(classificationText_iso8859_1_).details_w1252string();
const std::string classificationText_utf_8_("NON CLASSIFI\xc3\x89 / UNCLASSIFIED"); // UTF-8 "NON CLASSIFIÉ / UNCLASSIFIED"
const auto classificationText_utf_8 = str::EncodedStringView::fromUtf8(classificationText_utf_8_).u8string();
const std::string classificationText_iso8859_1("NON CLASSIFI\xc9 / UNCLASSIFIED"); // ISO8859-1 "NON CLASSIFIÉ / UNCLASSIFIED"
const std::string classificationText_utf_8("NON CLASSIFI\xc3\x89 / UNCLASSIFIED"); // UTF-8 "NON CLASSIFIÉ / UNCLASSIFIED"

TEST_CASE(sicd_French_xml)
{
Expand All @@ -207,7 +205,7 @@ TEST_CASE(sicd_French_xml)
const auto image = six::sicd::readFromNITF(inputPathname, pComplexData); // no validation
const six::Data* pData = pComplexData.get();

const auto expectedCassificationText = sys::Platform == sys::PlatformType::Linux ? classificationText_utf_8_ : classificationText_iso8859_1_;
const auto expectedCassificationText = sys::Platform == sys::PlatformType::Linux ? classificationText_utf_8 : classificationText_iso8859_1;
const auto& classification = pData->getClassification();
const auto actual = classification.getLevel();
TEST_ASSERT_EQ(actual, expectedCassificationText);
Expand Down Expand Up @@ -262,12 +260,12 @@ static void sicd_French_xml_raw_(bool storeEncoding)
size_t expectedLength;
if (storeEncoding)
{
expectedCharData = sys::Platform == sys::PlatformType::Linux ? classificationText_utf_8_ : classificationText_iso8859_1_;
expectedCharData = sys::Platform == sys::PlatformType::Linux ? classificationText_utf_8 : classificationText_iso8859_1;
expectedLength = expectedCharData.length();
}
else
{
expectedCharData = sys::Platform == sys::PlatformType::Linux ? std::string() : classificationText_iso8859_1_;
expectedCharData = sys::Platform == sys::PlatformType::Linux ? std::string() : classificationText_iso8859_1;
expectedLength = sys::Platform == sys::PlatformType::Linux ? 28 : classificationText_iso8859_1.length();
}
const auto characterData = classificationXML.getCharacterData();
Expand All @@ -284,11 +282,11 @@ static void sicd_French_xml_raw_(bool storeEncoding)
std::u8string u8_expectedCharData8;
if (storeEncoding)
{
u8_expectedCharData8 = classificationText_utf_8;
u8_expectedCharData8 = str::fromUtf8(classificationText_utf_8.c_str(), classificationText_utf_8.length());
}
else
{
u8_expectedCharData8 = sys::Platform == sys::PlatformType::Linux ? std::u8string() : classificationText_utf_8;
u8_expectedCharData8 = sys::Platform == sys::PlatformType::Linux ? std::u8string() : str::fromUtf8(classificationText_utf_8.c_str(), classificationText_utf_8.length());
}
expectedLength = u8_expectedCharData8.length();

Expand Down

0 comments on commit 25b34ab

Please sign in to comment.