Skip to content
This repository has been archived by the owner on Feb 26, 2025. It is now read-only.

Commit

Permalink
Skip locale check if std::locale fails.
Browse files Browse the repository at this point in the history
  • Loading branch information
1uc committed Nov 11, 2024
1 parent c88dfb0 commit 1d90834
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions tests/test_morphology_readers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <morphio/morphology.h>
#include <morphio/mut/morphology.h>
#include <morphio/soma.h>
#include <stdexcept>

TEST_CASE("LoadH5Morphology", "[morphology]") {
{
Expand Down Expand Up @@ -210,15 +211,27 @@ class LocaleGuard {
std::locale previousLocale;
};

TEST_CASE("LoadSWCMorphologyLocale", "[morphology]") {
{
static std::unique_ptr<LocaleGuard> make_locale() {
#ifdef __APPLE__
const auto locale = LocaleGuard(std::locale("de_CH.UTF-8"));
const std::string locale_name = "de_CH.UTF-8";
#else
const auto locale = LocaleGuard(std::locale("de_CH.UTF8"));
const std::string locale_name = "de_CH.UTF8";
#endif
const morphio::Morphology m("data/simple.swc");
REQUIRE(m.diameters().size() == 12);
try {
return std::make_unique<LocaleGuard>(std::locale(locale_name));
} catch (const std::runtime_error&) {
return nullptr;
}
}


TEST_CASE("LoadSWCMorphologyLocale", "[morphology]") {
{
const auto locale = make_locale();
if(locale) {
const morphio::Morphology m("data/simple.swc");
REQUIRE(m.diameters().size() == 12);
}
}
}

Expand Down

0 comments on commit 1d90834

Please sign in to comment.