Skip to content

Commit

Permalink
account for str:: changes in coda-oss
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Smith committed Jan 18, 2022
1 parent 920d0b7 commit 8797cd0
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions six/modules/c++/six.sicd/unittests/test_valid_six.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,10 @@ 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 std::string classificationText_utf_8("NON CLASSIFI\xc3\x89 / UNCLASSIFIED"); // UTF-8 "NON CLASSIFIÉ / UNCLASSIFIED"
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();

TEST_CASE(sicd_French_xml)
{
Expand All @@ -205,7 +207,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 @@ -260,12 +262,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 @@ -282,11 +284,11 @@ static void sicd_French_xml_raw_(bool storeEncoding)
std::u8string u8_expectedCharData8;
if (storeEncoding)
{
u8_expectedCharData8 = str::fromUtf8(classificationText_utf_8);
u8_expectedCharData8 = classificationText_utf_8;
}
else
{
u8_expectedCharData8 = sys::Platform == sys::PlatformType::Linux ? std::u8string() : str::fromUtf8(classificationText_utf_8);
u8_expectedCharData8 = sys::Platform == sys::PlatformType::Linux ? std::u8string() : classificationText_utf_8;
}
expectedLength = u8_expectedCharData8.length();

Expand Down

0 comments on commit 8797cd0

Please sign in to comment.