diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 4af5a239..3e2c89d4 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -27,7 +27,7 @@ set(UNITS_TESTS test_google_units ) -if (NOT UNITS_DISABLE_EXTRA_UNIT_STANDARDS) +if(NOT UNITS_DISABLE_EXTRA_UNIT_STANDARDS) list(APPEND UNITS_TESTS test_r20) endif() @@ -72,10 +72,8 @@ else() target_compile_definitions( test_unit_strings PUBLIC -DENABLE_UNIT_TESTING=1 -DENABLE_UNIT_MAP_ACCESS=1 ) - if (NOT UNITS_DISABLE_EXTRA_UNIT_STANDARDS) - target_compile_definitions ( - test_r20 PUBLIC -DENABLE_UNIT_MAP_ACCESS=1 - ) + if(NOT UNITS_DISABLE_EXTRA_UNIT_STANDARDS) + target_compile_definitions(test_r20 PUBLIC -DENABLE_UNIT_MAP_ACCESS=1) endif() add_unit_test(test_leadingNumbers.cpp) @@ -91,7 +89,6 @@ else() endif() endif() - target_compile_definitions( test_conversions2 PUBLIC -DTEST_FILE_FOLDER="${TEST_FILE_FOLDER}" ) diff --git a/test/test_r20.cpp b/test/test_r20.cpp index 0e3e4163..9b86cbb4 100644 --- a/test/test_r20.cpp +++ b/test/test_r20.cpp @@ -125,4 +125,4 @@ TEST(r20, conversions) std::cout << correct << " r20 units correctly translated\n"; } -#endif \ No newline at end of file +#endif diff --git a/test/test_udunits.cpp b/test/test_udunits.cpp index bf5838b3..20cd535a 100644 --- a/test/test_udunits.cpp +++ b/test/test_udunits.cpp @@ -76,7 +76,7 @@ TEST(UDUNITS, acceptedAlias) auto err = doc.LoadFile(TEST_FILE_FOLDER "/UDUNITS2/udunits2-accepted.xml"); ASSERT_FALSE(err) << err << std::endl; auto cs = doc.FirstChildElement("unit-system")->FirstChildElement("unit"); - int failConvert{ 0 }; + int failConvert{0}; while (cs != nullptr) { std::string def = cs->FirstChildElement("def")->FirstChild()->Value(); @@ -265,7 +265,7 @@ TEST(UDUNITS, commonAlias) auto err = doc.LoadFile(TEST_FILE_FOLDER "/UDUNITS2/udunits2-common.xml"); ASSERT_FALSE(err) << err << std::endl; auto cs = doc.FirstChildElement("unit-system")->FirstChildElement("unit"); - int failConvert{ 0 }; + int failConvert{0}; int mismatchUnit{0}; int mismatchVal{0}; while (cs != nullptr) { @@ -290,16 +290,15 @@ TEST(UDUNITS, commonAlias) } else { if (convert(unit_cast(nameUnit), unit_cast(definitionUnit)) != 1.0) { - if (definitionUnit.has_same_base(nameUnit)) - { - std::cout << "singular name and unit multiplier do not match " << sname - << " and " << def << "\n"; + if (definitionUnit.has_same_base(nameUnit)) { + std::cout + << "singular name and unit multiplier do not match " + << sname << " and " << def << "\n"; ++mismatchVal; - } - else - { - std::cout << "singular name and unit do not have the same base units " << sname - << " and " << def << "\n"; + } else { + std::cout + << "singular name and unit do not have the same base units " + << sname << " and " << def << "\n"; ++mismatchUnit; } } @@ -316,16 +315,15 @@ TEST(UDUNITS, commonAlias) if (convert( unit_cast(nameUnit), unit_cast(definitionUnit)) != 1.0) { - if (definitionUnit.has_same_base(nameUnit)) - { - std::cout << "plural name and unit multiplier do not match " << sname - << " and " << def << "\n"; + if (definitionUnit.has_same_base(nameUnit)) { + std::cout + << "plural name and unit multiplier do not match " + << sname << " and " << def << "\n"; ++mismatchVal; - } - else - { - std::cout << "plural name and unit do not have the same base units " << sname - << " and " << def << "\n"; + } else { + std::cout + << "plural name and unit do not have the same base units " + << sname << " and " << def << "\n"; ++mismatchUnit; } } @@ -345,16 +343,15 @@ TEST(UDUNITS, commonAlias) } else { if (convert(unit_cast(symUnit), unit_cast(definitionUnit)) != 1.0) { - if (definitionUnit.has_same_base(symUnit)) - { - std::cout << "symbol and unit multiplier do not mismatch" << symString - << " and " << def << "\n"; + if (definitionUnit.has_same_base(symUnit)) { + std::cout + << "symbol and unit multiplier do not mismatch" + << symString << " and " << def << "\n"; ++mismatchVal; - } - else - { - std::cout << "symbol and unit do not have the same base units " << symString - << " and " << def << "\n"; + } else { + std::cout + << "symbol and unit do not have the same base units " + << symString << " and " << def << "\n"; ++mismatchUnit; } std::cout << "symbol and unit do not match " << symString @@ -368,13 +365,14 @@ TEST(UDUNITS, commonAlias) cs = cs->NextSiblingElement("unit"); } if (failConvert > 0) { - std::cout < 0) { - std::cout << mismatchUnit<< " units converted but had different base units\n"; + std::cout << mismatchUnit + << " units converted but had different base units\n"; } if (mismatchVal > 0) { - std::cout << mismatchVal<< " units had different multipliers\n"; + std::cout << mismatchVal << " units had different multipliers\n"; } // EXPECT_EQ(failConvert, 0); } diff --git a/test/test_unit_strings.cpp b/test/test_unit_strings.cpp index b1c9f80a..5f7fdc3f 100644 --- a/test/test_unit_strings.cpp +++ b/test/test_unit_strings.cpp @@ -482,16 +482,20 @@ TEST(stringToUnits, Simple) TEST(stringToUnits, pressure) { - - EXPECT_EQ(unit_from_string("M[HG]"),unit_from_string("meter of mercury column")); - EXPECT_EQ(unit_from_string("M[HG]",units::case_insensitive),unit_from_string("meter of mercury column")); - EXPECT_EQ(unit_from_string("millimeter_Hg_0C"),precise::pressure::mmHg); - EXPECT_EQ(unit_from_string("MM[HG]",units::case_insensitive),unit_from_string("millimeter of mercury column")); + EXPECT_EQ( + unit_from_string("M[HG]"), unit_from_string("meter of mercury column")); + EXPECT_EQ( + unit_from_string("M[HG]", units::case_insensitive), + unit_from_string("meter of mercury column")); + EXPECT_EQ(unit_from_string("millimeter_Hg_0C"), precise::pressure::mmHg); + EXPECT_EQ( + unit_from_string("MM[HG]", units::case_insensitive), + unit_from_string("millimeter of mercury column")); } TEST(stringToUnit, fluid) { - EXPECT_EQ(unit_from_string("US_fluid_ounce"),precise::us::floz); + EXPECT_EQ(unit_from_string("US_fluid_ounce"), precise::us::floz); } TEST(stringToUnits, withSpace) @@ -591,7 +595,9 @@ TEST(stringToUnits, specificCombinations) TEST(stringToUnits, barrels) { - EXPECT_EQ(precise::kilo*precise::us::barrel/precise::day, unit_from_string("kbbl (US)/d")); + EXPECT_EQ( + precise::kilo * precise::us::barrel / precise::day, + unit_from_string("kbbl (US)/d")); } TEST(stringToUnits, gasConstant) { diff --git a/units/CMakeLists.txt b/units/CMakeLists.txt index 225367cb..878fff65 100644 --- a/units/CMakeLists.txt +++ b/units/CMakeLists.txt @@ -5,12 +5,11 @@ # SPDX-License-Identifier: BSD-3-Clause # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -if (UNITS_DISABLE_EXTRA_UNIT_STANDARDS) - set(units_source_files units.cpp commodities.cpp) +if(UNITS_DISABLE_EXTRA_UNIT_STANDARDS) + set(units_source_files units.cpp commodities.cpp) else() set(units_source_files units.cpp commodities.cpp x12_conv.cpp r20_conv.cpp) -endif() +endif() set(units_header_files units.hpp @@ -66,7 +65,7 @@ if(UNITS_BUILD_SHARED_LIBRARY) if(UNITS_DISABLE_NON_ENGLISH_UNITS) target_compile_definitions(units PUBLIC -DUNITS_DISABLE_NON_ENGLISH_UNITS=1) endif() - if (UNITS_DISABLE_EXTRA_UNIT_STANDARDS) + if(UNITS_DISABLE_EXTRA_UNIT_STANDARDS) target_compile_definitions(units PUBLIC -DUNITS_DISABLE_EXTRA_UNIT_STANDARDS=1) endif() if(UNITS_DEFAULT_DOMAIN) @@ -115,7 +114,7 @@ elseif(UNITS_BUILD_OBJECT_LIBRARY) if(UNITS_DISABLE_NON_ENGLISH_UNITS) target_compile_definitions(units PUBLIC -DUNITS_DISABLE_NON_ENGLISH_UNITS=1) endif() - if (UNITS_DISABLE_EXTRA_UNIT_STANDARDS) + if(UNITS_DISABLE_EXTRA_UNIT_STANDARDS) target_compile_definitions(units PUBLIC -DUNITS_DISABLE_EXTRA_UNIT_STANDARDS=1) endif() if(${CMAKE_CXX_STANDARD} GREATER 16) @@ -142,7 +141,7 @@ elseif(UNITS_BUILD_STATIC_LIBRARY) if(UNITS_BASE_TYPE) target_compile_definitions(units PUBLIC -DUNITS_BASE_TYPE=${UNITS_BASE_TYPE}) endif() - if (UNITS_DISABLE_EXTRA_UNIT_STANDARDS) + if(UNITS_DISABLE_EXTRA_UNIT_STANDARDS) target_compile_definitions(units PUBLIC -DUNITS_DISABLE_EXTRA_UNIT_STANDARDS=1) endif() if(UNITS_DEFAULT_DOMAIN) diff --git a/units/r20_conv.cpp b/units/r20_conv.cpp index dcfe2a2b..60069199 100644 --- a/units/r20_conv.cpp +++ b/units/r20_conv.cpp @@ -3141,11 +3141,11 @@ precise_unit r20_unit(const std::string& r20_string) #ifdef ENABLE_UNIT_MAP_ACCESS namespace detail { - const void* r20rawData(size_t& array_size) - { - array_size = precise::r20_units.size(); - return precise::r20_units.data(); - } + const void* r20rawData(size_t& array_size) + { + array_size = precise::r20_units.size(); + return precise::r20_units.data(); + } } // namespace detail #endif diff --git a/units/units.cpp b/units/units.cpp index a3537958..684e8b04 100644 --- a/units/units.cpp +++ b/units/units.cpp @@ -2713,20 +2713,20 @@ bool bracketModifiers(std::string& unit_string) ploc = unit_string.find_first_of(seg[0], ploc + 1); } } - // if (!modified) { - auto ploc = unit_string.find_first_of('-', 1); - if (ploc != std::string::npos) { - auto cloc = unit_string.find_first_of("-[({_", ploc + 1); - auto tstring = (cloc != std::string::npos) ? - unit_string.substr(ploc + 1, cloc - ploc - 1) : - unit_string.substr(ploc + 1); - auto modloc = modifiers.find(tstring); - if (modloc != modifiers.end()) { - unit_string.replace(ploc + 1, cloc - ploc - 1, modloc->second); - unit_string[ploc] = '_'; - modified = true; - } + // if (!modified) { + auto ploc = unit_string.find_first_of('-', 1); + if (ploc != std::string::npos) { + auto cloc = unit_string.find_first_of("-[({_", ploc + 1); + auto tstring = (cloc != std::string::npos) ? + unit_string.substr(ploc + 1, cloc - ploc - 1) : + unit_string.substr(ploc + 1); + auto modloc = modifiers.find(tstring); + if (modloc != modifiers.end()) { + unit_string.replace(ploc + 1, cloc - ploc - 1, modloc->second); + unit_string[ploc] = '_'; + modified = true; } + } //} return modified; } @@ -2798,31 +2798,27 @@ static precise_unit ckpair{"39degF", "[39]"}, ckpair{"0degC", "[00]"}, // this should be last - + ckpair{"us", "US"}, }}; - if (unit.size() < 3) - { + if (unit.size() < 3) { return precise::invalid; } - if (unit.front() == 'u' && (unit[1] == 'S' || unit[1] == 'K')) - { - unit.front()='U'; + if (unit.front() == 'u' && (unit[1] == 'S' || unit[1] == 'K')) { + unit.front() = 'U'; } bool changed = false; for (const auto& irep : internationlReplacements) { - if (strlen(irep.first) == 2) - { - if (strncmp(irep.first, irep.second, 2)==0) - { - if (ends_with(unit, std::string(1,'_')+irep.second)) - { + if (strlen(irep.first) == 2) { + if (strncmp(irep.first, irep.second, 2) == 0) { + if (ends_with(unit, std::string(1, '_') + irep.second)) { continue; } } - if (unit[1]>0 && std::isupper(unit[1]) && (std::toupper(unit[0]) == irep.first[0]) && (unit[1] == irep.first[1])) - { - unit[0]=std::toupper(unit[0]); + if (unit[1] > 0 && std::isupper(unit[1]) && + (std::toupper(unit[0]) == irep.first[0]) && + (unit[1] == irep.first[1])) { + unit[0] = std::toupper(unit[0]); } } auto fnd = unit.find(irep.first); @@ -2848,11 +2844,10 @@ static precise_unit } changed |= clearEmptySegments(unit); if (changed) { - auto retunit=unit_from_string_internal( + auto retunit = unit_from_string_internal( unit, match_flags | no_locality_modifiers | no_of_operator); - if (is_error(retunit) && ((match_flags&no_locality_modifiers)==0)) - { - return localityModifiers(unit,match_flags|no_locality_modifiers); + if (is_error(retunit) && ((match_flags & no_locality_modifiers) == 0)) { + return localityModifiers(unit, match_flags | no_locality_modifiers); } return retunit; } @@ -2876,7 +2871,7 @@ static precise_unit return get_unit(unit, match_flags); } } - + return precise::invalid; } @@ -3149,23 +3144,16 @@ static precise_unit {"mercuryguage", precise::pressure::bases::Hg}, {"mercury_i", precise::pressure::bases::Hg}, {"Hg", precise::pressure::bases::Hg}, - {"water", - precise::pressure::bases::water}, - {"watercolumn", - precise::pressure::bases::water}, - {"water_i", - precise::pressure::bases::water}, - {"waterguage", - precise::pressure::bases::water}, - {"H2O", - precise::pressure::bases::water}, + {"water", precise::pressure::bases::water}, + {"watercolumn", precise::pressure::bases::water}, + {"water_i", precise::pressure::bases::water}, + {"waterguage", precise::pressure::bases::water}, + {"H2O", precise::pressure::bases::water}, {"mercury_[00]", precise::pressure::bases::Hg_0}, {"water_[04]", precise::pressure::bases::water_4}, {"water_[39]", precise::pressure::bases::water_39}, - {"mercury_[32]", - precise::pressure::bases::Hg_32}, - {"mercury_[60]", - precise::pressure::bases::Hg_60}, + {"mercury_[32]", precise::pressure::bases::Hg_32}, + {"mercury_[60]", precise::pressure::bases::Hg_60}, {"water_[60]", precise::pressure::bases::water_60}, }; auto tunit = commUnits.find(cstring); @@ -3205,11 +3193,10 @@ static precise_unit checkMultiplierCharacter( ustring.insert(fd, 1, '^'); fd += 1; } - } - else if (ustring[fd + 1] == mchar) { + } else if (ustring[fd + 1] == mchar) { // repeated characters, cannot mean separator return precise::invalid; - }else if (ustring[fd+1]!='[' && ustring[fd+1]!='(') { + } else if (ustring[fd + 1] != '[' && ustring[fd + 1] != '(') { ustring[fd] = '*'; } // ignore adjacent ones @@ -4784,31 +4771,29 @@ static bool cleanUnitString(std::string& unit_string, std::uint64_t match_flags) static void modifyTailCodes(std::string& unit_string) { - if (!unit_string.empty() && (unit_string.back() == 'F' || unit_string.back() == 'C')) - { + if (!unit_string.empty() && + (unit_string.back() == 'F' || unit_string.back() == 'C')) { static UNITS_CPP14_CONSTEXPR_OBJECT std::array trailTempCodeReplacements{{ - ckpair{"at39F", "[39]"}, - ckpair{"39F", "[39]"}, - ckpair{"at60F", "[60]"}, - ckpair{"60F", "[60]"}, - ckpair{"at0C", "[00]"}, - ckpair{"0C", "[00]"}, - ckpair{"at23C", "[23]"}, - ckpair{"23C", "[23]"}, - ckpair{"at4C", "[04]"}, - ckpair{"4C", "[04]"}, - }}; - - for (const auto& endTemp : trailTempCodeReplacements) - { - if (ends_with(unit_string, endTemp.first)) - { - auto sz=strlen(endTemp.first); - unit_string.replace(unit_string.end()-sz,unit_string.end(),endTemp.second); - if (unit_string[unit_string.size() - 5] != '_') - { - unit_string.insert(unit_string.size() - 4,1,'_'); + ckpair{"at39F", "[39]"}, + ckpair{"39F", "[39]"}, + ckpair{"at60F", "[60]"}, + ckpair{"60F", "[60]"}, + ckpair{"at0C", "[00]"}, + ckpair{"0C", "[00]"}, + ckpair{"at23C", "[23]"}, + ckpair{"23C", "[23]"}, + ckpair{"at4C", "[04]"}, + ckpair{"4C", "[04]"}, + }}; + + for (const auto& endTemp : trailTempCodeReplacements) { + if (ends_with(unit_string, endTemp.first)) { + auto sz = strlen(endTemp.first); + unit_string.replace( + unit_string.end() - sz, unit_string.end(), endTemp.second); + if (unit_string[unit_string.size() - 5] != '_') { + unit_string.insert(unit_string.size() - 4, 1, '_'); } } } @@ -4843,7 +4828,7 @@ static bool cleanUnitStringPhase2(std::string& unit_string) unit_string.end()); clearEmptySegments(unit_string); - + return changed || (len != unit_string.length()); } @@ -5545,7 +5530,7 @@ static precise_unit unit_from_string_internal( ++sep; } char c1 = unit_string[sep + 1]; - int power{ +1 }; + int power{+1}; if (c1 == '-' || c1 == '+') { ++sep; if (unit_string.length() < sep + 2) { @@ -5564,33 +5549,29 @@ static precise_unit unit_from_string_internal( #endif size_t end = sep + 2; for (; end < unit_string.size() && - isDigitCharacter(unit_string[end]); - ++end) { + isDigitCharacter(unit_string[end]); + ++end) { } auto powerStringLength = end - sep - 1; if (powerStringLength > 1) { auto pstring = unit_string.substr(sep + 1, powerStringLength); - char* eptr{ nullptr }; + char* eptr{nullptr}; auto mpower = strtoul(pstring.c_str(), &eptr, 10); if (eptr - pstring.c_str() == static_cast(powerStringLength)) { power *= mpower; - } - else { + } else { return precise::invalid; // LCOV_EXCL_LINE } - } - else { + } else { power *= (unit_string[sep + 1] - '0'); } - } - else { + } else { power *= (unit_string[sep + 1] - '0'); } - } - else { + } else { // the check functions should catch this but it would be // problematic if not caught return precise::invalid; // LCOV_EXCL_LINE @@ -5602,7 +5583,7 @@ static precise_unit unit_from_string_internal( if (retunit != precise::defunit) { return retunit; } - } + } if ((match_flags & no_commodities) == 0 && unit_string.back() == '}' && unit_string.find('{') != std::string::npos) { return commoditizedUnit(unit_string, match_flags); @@ -5633,7 +5614,7 @@ static precise_unit unit_from_string_internal( retunit = unit_from_string_internal( ustring, (match_flags & (~case_insensitive)) | - skip_partition_check); + skip_partition_check); if (!is_error(retunit)) { return retunit; } @@ -5648,7 +5629,7 @@ static precise_unit unit_from_string_internal( retunit = unit_quick_match(ustring, match_flags); if (!is_error(retunit)) { - return { mret.first, retunit }; + return {mret.first, retunit}; } if (ustring[0] >= 'A' && ustring[0] <= 'Z') { if (ustring.size() > 4 || ustring[0] != 'N') { @@ -5656,7 +5637,7 @@ static precise_unit unit_from_string_internal( ustring[0] += 32; retunit = unit_quick_match(ustring, match_flags); if (!is_error(retunit)) { - return { mret.first, retunit }; + return {mret.first, retunit}; } } } @@ -5697,7 +5678,7 @@ static precise_unit unit_from_string_internal( } modifyTailCodes(unit_string); - + if (!containsPer) { retunit = checkMultiplierCharacter(unit_string, match_flags, '-'); if (!is_error(retunit)) { @@ -5712,37 +5693,36 @@ static precise_unit unit_from_string_internal( // try some other cleaning steps ustring = unit_string; - if (cleanUnitStringPhase2(unit_string)) { - if (!unit_string.empty()) { - retunit = get_unit(unit_string, match_flags); - if (!is_error(retunit)) { - return retunit; - } - if (looksLikeNumber(unit_string)) { - size_t loc{ 0 }; - auto number = getDoubleFromString(unit_string, &loc); - if (loc >= unit_string.length()) { - return { number, one }; - } - unit_string = unit_string.substr(loc); - retunit = unit_from_string_internal(unit_string, match_flags); - if (!is_error(retunit)) { - return { number, retunit }; - } - unit_string.insert(unit_string.begin(), '{'); - unit_string.push_back('}'); - return { number, commoditizedUnit(unit_string, match_flags) }; + if (cleanUnitStringPhase2(unit_string)) { + if (!unit_string.empty()) { + retunit = get_unit(unit_string, match_flags); + if (!is_error(retunit)) { + return retunit; + } + if (looksLikeNumber(unit_string)) { + size_t loc{0}; + auto number = getDoubleFromString(unit_string, &loc); + if (loc >= unit_string.length()) { + return {number, one}; } - retunit=checkSIprefix(unit_string, match_flags); + unit_string = unit_string.substr(loc); + retunit = unit_from_string_internal(unit_string, match_flags); if (!is_error(retunit)) { - return retunit; + return {number, retunit}; } + unit_string.insert(unit_string.begin(), '{'); + unit_string.push_back('}'); + return {number, commoditizedUnit(unit_string, match_flags)}; } - else { // if we erased everything this could lead to strange units so - // just go back to the original - unit_string = ustring; + retunit = checkSIprefix(unit_string, match_flags); + if (!is_error(retunit)) { + return retunit; } + } else { // if we erased everything this could lead to strange units so + // just go back to the original + unit_string = ustring; } + } if (unit_string.front() == '[' && unit_string.back() == ']') { ustring = unit_string.substr(1); ustring.pop_back(); diff --git a/units/units_conversion_maps.hpp b/units/units_conversion_maps.hpp index 88d06233..4e1c2033 100644 --- a/units/units_conversion_maps.hpp +++ b/units/units_conversion_maps.hpp @@ -489,9 +489,9 @@ UNITS_CPP14_CONSTEXPR_OBJECT std::array< {"coulomb", precise::C}, {"faraday", precise::other::faraday}, {"farady", precise::other::faraday}, - { "chemicalfaraday", {9.64957e4,precise::C} }, - { "physicalfaraday", {9.65219e4,precise::C} }, - { "C12faraday", {9.648531,precise::C} }, + {"chemicalfaraday", {9.64957e4, precise::C}}, + {"physicalfaraday", {9.65219e4, precise::C}}, + {"C12faraday", {9.648531, precise::C}}, {"F", precise::F}, {"farad", precise::F}, {"abF", precise::cgs::abFarad}, @@ -710,7 +710,7 @@ UNITS_CPP14_CONSTEXPR_OBJECT std::array< {"degsN", precise::direction::north}, {"north", precise::direction::north}, {"degT", precise::deg* precise::direction::north}, - {"degsT", precise::deg* precise::direction::north}, + {"degsT", precise::deg* precise::direction::north}, {"true", precise::direction::north}, {"o", precise::deg}, {u8"\u00B0", precise::deg}, // unicode degree symbol @@ -1150,56 +1150,56 @@ UNITS_CPP14_CONSTEXPR_OBJECT std::array< {"standardatmosphere", precise::pressure::atm}, {"stdatmosphere", precise::pressure::atm}, {"stdatm", precise::pressure::atm}, - + {"mmHg", precise::pressure::mmHg}, {"mm_Hg", precise::pressure::mmHg}, {"mM_Hg", precise::pressure::mmHg}, {"cm_Hg", precise::ten* precise::pressure::mmHg}, {"cM_Hg", precise::ten* precise::pressure::mmHg}, {"m_Hg", precise::kilo* precise::pressure::mmHg}, - {"m[Hg]",precise::kilo* precise::pressure::mmHg}, - {"m_H2O", precise::kilo* precise::pressure::mmH2O}, + {"m[Hg]", precise::kilo* precise::pressure::mmHg}, + {"m_H2O", precise::kilo* precise::pressure::mmH2O}, {"m[H2O]", precise::kilo* precise::pressure::mmH2O}, -{"cm_H2O", precise::ten* precise::pressure::mmH2O}, + {"cm_H2O", precise::ten* precise::pressure::mmH2O}, {"cM_H2O", precise::ten* precise::pressure::mmH2O}, {"cmH2O", precise::ten* precise::pressure::mmH2O}, - -{"mm_H2O", precise::pressure::mmH2O}, + + {"mm_H2O", precise::pressure::mmH2O}, {"mmH2O", precise::pressure::mmH2O}, - {"water_90",precise::pressure::bases::water}, - {"water",precise::pressure::bases::water}, - {"water_[04]",precise::pressure::bases::water_4}, - {"water_[39]",precise::pressure::bases::water_39}, - {"water_[60]",precise::pressure::bases::water_60}, - {"waters_[04]",precise::pressure::bases::water_4}, - {"waters_[39]",precise::pressure::bases::water_39}, - {"waters_[60]",precise::pressure::bases::water_60}, - {"H2O",precise::pressure::bases::water}, - {"H2O_[04]",precise::pressure::bases::water_4}, - {"H2O_[39]",precise::pressure::bases::water_39}, - {"H2O_[60]",precise::pressure::bases::water_60}, - {"h2o",precise::pressure::bases::water}, - {"h2o_[04]",precise::pressure::bases::water_4}, - {"h2o_[39]",precise::pressure::bases::water_39}, - {"h2o_[60]",precise::pressure::bases::water_60}, - {"mercury",precise::pressure::bases::Hg}, - {"mercury_90",precise::pressure::bases::Hg}, - {"mercuries_90",precise::pressure::bases::Hg}, - {"mercury_[32]",precise::pressure::bases::Hg_32}, - {"mercury_[00]",precise::pressure::bases::Hg_0}, - {"mercury_[60]",precise::pressure::bases::Hg_60}, - {"mercuries",precise::pressure::bases::Hg}, - {"mercuries_[32]",precise::pressure::bases::Hg_32}, - {"mercuries_[00]",precise::pressure::bases::Hg_0}, - {"mercuries_[60]",precise::pressure::bases::Hg_60}, - {"Hg",precise::pressure::bases::Hg}, - {"Hg_[32]",precise::pressure::bases::Hg_32}, - {"Hg_[00]",precise::pressure::bases::Hg_0}, - {"Hg_[60]",precise::pressure::bases::Hg_60}, - // {"hg",precise::pressure::bases::Hg}, //conflicts with hectogram - {"hg_[32]",precise::pressure::bases::Hg_32}, - {"hg_[00]",precise::pressure::bases::Hg_0}, - {"hg_[60]",precise::pressure::bases::Hg_60}, + {"water_90", precise::pressure::bases::water}, + {"water", precise::pressure::bases::water}, + {"water_[04]", precise::pressure::bases::water_4}, + {"water_[39]", precise::pressure::bases::water_39}, + {"water_[60]", precise::pressure::bases::water_60}, + {"waters_[04]", precise::pressure::bases::water_4}, + {"waters_[39]", precise::pressure::bases::water_39}, + {"waters_[60]", precise::pressure::bases::water_60}, + {"H2O", precise::pressure::bases::water}, + {"H2O_[04]", precise::pressure::bases::water_4}, + {"H2O_[39]", precise::pressure::bases::water_39}, + {"H2O_[60]", precise::pressure::bases::water_60}, + {"h2o", precise::pressure::bases::water}, + {"h2o_[04]", precise::pressure::bases::water_4}, + {"h2o_[39]", precise::pressure::bases::water_39}, + {"h2o_[60]", precise::pressure::bases::water_60}, + {"mercury", precise::pressure::bases::Hg}, + {"mercury_90", precise::pressure::bases::Hg}, + {"mercuries_90", precise::pressure::bases::Hg}, + {"mercury_[32]", precise::pressure::bases::Hg_32}, + {"mercury_[00]", precise::pressure::bases::Hg_0}, + {"mercury_[60]", precise::pressure::bases::Hg_60}, + {"mercuries", precise::pressure::bases::Hg}, + {"mercuries_[32]", precise::pressure::bases::Hg_32}, + {"mercuries_[00]", precise::pressure::bases::Hg_0}, + {"mercuries_[60]", precise::pressure::bases::Hg_60}, + {"Hg", precise::pressure::bases::Hg}, + {"Hg_[32]", precise::pressure::bases::Hg_32}, + {"Hg_[00]", precise::pressure::bases::Hg_0}, + {"Hg_[60]", precise::pressure::bases::Hg_60}, + // {"hg",precise::pressure::bases::Hg}, //conflicts with hectogram + {"hg_[32]", precise::pressure::bases::Hg_32}, + {"hg_[00]", precise::pressure::bases::Hg_0}, + {"hg_[60]", precise::pressure::bases::Hg_60}, {"torr", precise::pressure::torr}, {"Torr", precise::pressure::torr}, {"TORR", precise::pressure::torr}, @@ -1874,15 +1874,42 @@ UNITS_CPP14_CONSTEXPR_OBJECT std::array< precise::degF}, {u8"\u00b0F", precise::degF}, {"fahrenheit", precise::degF}, - {"perm",{57.2135,precise::nano*precise::g/(precise::s*precise::m.pow(2)*precise::Pa)}}, - {"perm_US",{57.2135,precise::nano*precise::g/(precise::s*precise::m.pow(2)*precise::Pa)}}, - {"perm_m",{86.8127,precise::nano*precise::g/(precise::s*precise::m.pow(2)*precise::Pa)}}, - {"perm_[00]",{57.2135,precise::nano*precise::g/(precise::s*precise::m.pow(2)*precise::Pa)}}, - {"perm_[23]",{57.4525,precise::nano*precise::g/(precise::s*precise::m.pow(2)*precise::Pa)}}, - {"perms_US",{57.2135,precise::nano*precise::g/(precise::s*precise::m.pow(2)*precise::Pa)}}, - {"perms_m",{86.8127,precise::nano*precise::g/(precise::s*precise::m.pow(2)*precise::Pa)}}, - {"perms_[00]",{57.2135,precise::nano*precise::g/(precise::s*precise::m.pow(2)*precise::Pa)}}, - {"perms_[23]",{57.4525,precise::nano*precise::g/(precise::s*precise::m.pow(2)*precise::Pa)}}, + {"perm", + {57.2135, + precise::nano* precise::g / + (precise::s * precise::m.pow(2) * precise::Pa)}}, + {"perm_US", + {57.2135, + precise::nano* precise::g / + (precise::s * precise::m.pow(2) * precise::Pa)}}, + {"perm_m", + {86.8127, + precise::nano* precise::g / + (precise::s * precise::m.pow(2) * precise::Pa)}}, + {"perm_[00]", + {57.2135, + precise::nano* precise::g / + (precise::s * precise::m.pow(2) * precise::Pa)}}, + {"perm_[23]", + {57.4525, + precise::nano* precise::g / + (precise::s * precise::m.pow(2) * precise::Pa)}}, + {"perms_US", + {57.2135, + precise::nano* precise::g / + (precise::s * precise::m.pow(2) * precise::Pa)}}, + {"perms_m", + {86.8127, + precise::nano* precise::g / + (precise::s * precise::m.pow(2) * precise::Pa)}}, + {"perms_[00]", + {57.2135, + precise::nano* precise::g / + (precise::s * precise::m.pow(2) * precise::Pa)}}, + {"perms_[23]", + {57.4525, + precise::nano* precise::g / + (precise::s * precise::m.pow(2) * precise::Pa)}}, {"mi", precise::mile}, {"mi_i", precise::mile}, {"league", precise::i::league}, @@ -2233,11 +2260,15 @@ UNITS_CPP14_CONSTEXPR_OBJECT std::array< {"gallon_US", precise::us::gallon}, {"gallon_FL_US", precise::us::gallon}, {"gallon_US_FL", precise::us::gallon}, - {"gal_wi", precise::us::dry::winchester_gallon}, //winchester gallon - {"winchestergallon", precise::us::dry::winchester_gallon}, //winchester gallon - {"winchestercorngallon", precise::us::dry::winchester_gallon}, //winchester gallon - {"corngallon", precise::us::dry::winchester_gallon}, //winchester gallon - {"corngallon_br", precise::us::dry::winchester_gallon}, //winchester gallon + {"gal_wi", precise::us::dry::winchester_gallon}, // winchester gallon + {"winchestergallon", + precise::us::dry::winchester_gallon}, // winchester gallon + {"winchestercorngallon", + precise::us::dry::winchester_gallon}, // winchester gallon + {"corngallon", + precise::us::dry::winchester_gallon}, // winchester gallon + {"corngallon_br", + precise::us::dry::winchester_gallon}, // winchester gallon {"alegallon", precise::us::ale_gallon}, {"wigal", precise::us::dry::winchester_gallon}, {"GAL_WI", precise::us::dry::winchester_gallon},