From 14df57f77a27dcee842803d9b2cde5976fa87c66 Mon Sep 17 00:00:00 2001 From: Philip Top Date: Thu, 17 Oct 2024 06:39:56 -0700 Subject: [PATCH 1/6] test with windows.h header and remedy conflicts --- test/CMakeLists.txt | 8 ++ test/examples_test_windows.cpp | 58 ++++++++++ test/test_conversions1.cpp | 8 +- test/test_unit_strings.cpp | 8 +- units/r20_conv.cpp | 190 ++++++++++++++++---------------- units/unit_definitions.hpp | 35 +++--- units/units.cpp | 2 +- units/units_conversion_maps.hpp | 38 +++---- units/units_util.hpp | 10 +- units/x12_conv.cpp | 4 +- 10 files changed, 210 insertions(+), 151 deletions(-) create mode 100644 test/examples_test_windows.cpp diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index f686a4cc..71ac56f1 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -145,6 +145,14 @@ else() set_target_properties(examples_test PROPERTIES FOLDER "Tests") add_test(examples_test ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/examples_test) + if (WIN32) + add_executable(examples_test_windows examples_test_windows.cpp) + target_link_libraries(examples_test_windows PRIVATE ${UNITS_LC_PROJECT_NAME}::units) + target_compile_definitions(examples_test_windows PRIVATE ${TARGET_SPECIAL_COMPILER_FLAGS}) + set_target_properties(examples_test_windows PROPERTIES FOLDER "Tests") + add_test(examples_test_windows ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/examples_test) +endif() + add_executable(test_all_unit_base test_all_unit_base.cpp) if(MSVC) target_compile_options(test_all_unit_base PRIVATE /wd4459) diff --git a/test/examples_test_windows.cpp b/test/examples_test_windows.cpp new file mode 100644 index 00000000..c4547de5 --- /dev/null +++ b/test/examples_test_windows.cpp @@ -0,0 +1,58 @@ +/* +Copyright (c) 2019-2023, +Lawrence Livermore National Security, LLC; +See the top-level NOTICE for additional details. All rights reserved. +SPDX-License-Identifier: BSD-3-Clause +*/ +#include +#include "units/units_decl.hpp" + +#include "units/units.hpp" +#include "units/units_conversion_maps.hpp" + +/** @file Test just to load up some unit definitions and do some operations with +them it tests linking and some usefulness in code coverage */ + +int main(int argc, char* argv[]) +{ + units::fixed_precise_measurement fpm1(1250.0, units::precise::cm.pow(3)); + units::fixed_precise_measurement fpm2(1.25, units::precise::L); + if (fpm1 != fpm2) { + return -1; + } + + units::uncertain_measurement um1(1250.0, 25.0, units::cm.pow(3)); + units::uncertain_measurement um2(1.25, 0.1, units::L); + if (um1 != um2) { + return -1; + } + + units::measurement m1(1250.0, units::cm.pow(3)); + if (m1 != 1.25 * units::L) { + return -1; + } + + units::fixed_measurement fm1(1250.0, units::cm.pow(3)); + if (fm1 != 1.25 * units::L) { + return -1; + } + + units::precise_measurement pm1 = + units::measurement_from_string("1250 cm^3"); + if (pm1 != 1.25 * units::precise::L) { + return -1; + } + + units::precise_unit prec1(1.25, units::precise::L); + + if (prec1 != units::precise_unit(0.00125, units::precise::m.pow(3))) { + return -1; + } + + units::unit u1(1.25, units::L); + + if (u1 != units::unit(0.00125, units::m.pow(3))) { + return -1; + } + return 0; +} diff --git a/test/test_conversions1.cpp b/test/test_conversions1.cpp index ca287f30..5ea211fb 100644 --- a/test/test_conversions1.cpp +++ b/test/test_conversions1.cpp @@ -391,8 +391,8 @@ TEST(TimeConversions, Correctness) double one_week_in_day = 7.0; double one_day_in_sec = 86400.0; - EXPECT_NEAR(convert(min, s), one_min_in_sec, test::tolerance); - EXPECT_NEAR(convert(hr, min), one_hour_in_min, test::tolerance); + EXPECT_NEAR(convert(minute, s), one_min_in_sec, test::tolerance); + EXPECT_NEAR(convert(hr, minute), one_hour_in_min, test::tolerance); EXPECT_NEAR( convert(unit_cast(precise::time::day), hr), one_day_in_hour, @@ -421,10 +421,10 @@ TEST(TimeConversionsPrecise, Correctness) double one_day_in_sec = 86400.0; EXPECT_NEAR( - convert(min, units::precise::s), + convert(minute, units::precise::s), one_min_in_sec, test::precise_tolerance); - EXPECT_NEAR(convert(hr, min), one_hour_in_min, test::precise_tolerance); + EXPECT_NEAR(convert(hr, minute), one_hour_in_min, test::precise_tolerance); EXPECT_NEAR(convert(day, hr), one_day_in_hour, test::precise_tolerance); EXPECT_NEAR(convert(week, day), one_week_in_day, test::precise_tolerance); EXPECT_NEAR( diff --git a/test/test_unit_strings.cpp b/test/test_unit_strings.cpp index 92cafdcf..5d348231 100644 --- a/test/test_unit_strings.cpp +++ b/test/test_unit_strings.cpp @@ -1513,7 +1513,7 @@ TEST(userDefinedUnits, definitionStrings) addUserDefinedUnit("idgit", idgit); auto ipm = unit_from_string("idgit/min"); - EXPECT_EQ(ipm, idgit / min); + EXPECT_EQ(ipm, idgit / minute); auto str = to_string(ipm); EXPECT_EQ(str, "idgit/min"); @@ -1529,7 +1529,7 @@ TEST(userDefinedUnits, definitionStringsInputOnly) addUserDefinedInputUnit("idgit", idgit); auto ipm = unit_from_string("idgit/min"); - EXPECT_EQ(ipm, idgit / min); + EXPECT_EQ(ipm, idgit / minute); auto str = to_string(ipm); /** input only should not result in any string result with the user defined @@ -1544,9 +1544,9 @@ TEST(userDefinedUnits, definitionStringsOutputOnly) addUserDefinedOutputUnit("idgit", idgit); auto ipm = unit_from_string("idgit/min"); - EXPECT_NE(ipm, idgit / min); + EXPECT_NE(ipm, idgit / minute); - auto str = to_string(idgit / min); + auto str = to_string(idgit / minute); /** output only should make this work*/ EXPECT_EQ(str, "idgit/min"); clearUserDefinedUnits(); diff --git a/units/r20_conv.cpp b/units/r20_conv.cpp index e0eb1da9..e019c6bc 100644 --- a/units/r20_conv.cpp +++ b/units/r20_conv.cpp @@ -108,7 +108,7 @@ namespace precise { energy::btu_it / hr}, unitD{"2J", "cubic centimetre per second", cm.pow(3) / s}, unitD{"2K", "cubic foot per hour", ft.pow(3) / hr}, - unitD{"2L", "cubic foot per minute", ft.pow(3) / min}, + unitD{"2L", "cubic foot per minute", ft.pow(3) / minute}, unitD{"2M", "centimetre per second", cm / s}, unitD{"2N", "decibel", log::dB}, unitD{"2P", "kilobyte", data::kB}, @@ -117,7 +117,7 @@ namespace precise { unitD{"2U", "megagram", mega* g}, unitD{"2V", "megagram per hour", mega* g / hr}, unitD{"2W", "bin", {1.0, count, commodities::packaging::bin}}, - unitD{"2X", "metre per minute", m / min}, + unitD{"2X", "metre per minute", m / minute}, unitD{"2Y", "milliroentgen", milli* cgs::roentgen}, unitD{"2Z", "millivolt", milli* V}, unitD{ @@ -138,7 +138,7 @@ namespace precise { unitD{ "36", "cubic foot per minute per square foot", - ft.pow(3) / min / ft.pow(2)}, + ft.pow(3) / minute / ft.pow(2)}, unitD{"37", "ounce per square foot", oz / ft.pow(2)}, unitD{ "38", @@ -151,7 +151,7 @@ namespace precise { unitD{"3H", "kilogram per kilogram of product", pu* kg}, unitD{"3I", "kilogram per piece of product", kg / count}, unitD{"40", "millilitre per second", mL / s}, - unitD{"41", "millilitre per minute", mL / min}, + unitD{"41", "millilitre per minute", mL / minute}, unitD{ "43", "super bulk bag", @@ -206,7 +206,7 @@ namespace precise { "net kilogram", {1.0, kg, commodities::packaging::net_quantity}}, unitD{"59", "part per million", other::ppm}, - unitD{"5A", "barrel (US) per minute", us::barrel / min}, + unitD{"5A", "barrel (US) per minute", us::barrel / minute}, unitD{"5B", "batch", {1.0, count, commodities::packaging::batch}}, unitD{"5C", "gallon(US) per thousand", us::gallon / (kilo * count)}, unitD{"5E", "MMSCF/day", precise::mega* precise::energy::scf / day}, @@ -215,7 +215,7 @@ namespace precise { unitD{"5H", "stage", {1.0, count, commodities::packaging::stage}}, unitD{"5I", "standard cubic foot", ft.pow(3)}, unitD{"5J", "hydraulic horse power", power::hpS}, - unitD{"5K", "count per minute", count / min}, + unitD{"5K", "count per minute", count / minute}, unitD{"5P", "seismic level", special::moment_magnitude}, unitD{"5Q", "seismic line", special::moment_energy}, unitD{"60", "percent weight", percent* pu* kg}, @@ -433,11 +433,11 @@ namespace precise { unitD{"ACT", "activity", count / s}, unitD{"AD", "byte", data::byte}, unitD{"AE", "ampere per metre", A / m}, - unitD{"AH", "additional minute", min}, + unitD{"AH", "additional minute", minute}, unitD{ "AI", "average minute per call", - min / precise_unit(one, commodities::call)}, + minute / precise_unit(one, commodities::call)}, unitD{"AJ", "cop", {1.0, count, commodities::packaging::cop}}, unitD{"AK", "fathom", nautical::fathom}, unitD{"AL", "access line", {1.0, count, commodities::linesofservice}}, @@ -726,7 +726,7 @@ namespace precise { unitD{"C91", "reciprocal kelvin", K.inv()}, unitD{"C92", "reciprocal metre", m.inv()}, unitD{"C93", "reciprocal square metre", m.pow(-2)}, - unitD{"C94", "reciprocal minute", min.inv()}, + unitD{"C94", "reciprocal minute", minute.inv()}, unitD{"C95", "reciprocal mole", mol.inv()}, unitD{"C96", "reciprocal pascal", Pa.inv()}, unitD{"C97", "reciprocal second", s.inv()}, @@ -1118,7 +1118,7 @@ namespace precise { unitD{"F08", "milliampere per inch", milli* A / in}, unitD{"F1", "thousand cubic foot per day", {1000.0, ft.pow(3) / day}}, unitD{"F10", "kelvin per hour", K / hr}, - unitD{"F11", "kelvin per minute", K / min}, + unitD{"F11", "kelvin per minute", K / minute}, unitD{"F12", "kelvin per second", K / s}, unitD{"F13", "slug", imp::slug}, unitD{"F14", "gram per kelvin", g / K}, @@ -1135,24 +1135,24 @@ namespace precise { unitD{"F25", "gram per hertz", g / Hz}, unitD{"F26", "gram per day", g / day}, unitD{"F27", "gram per hour", g / hr}, - unitD{"F28", "gram per minute", g / min}, + unitD{"F28", "gram per minute", g / minute}, unitD{"F29", "gram per second", g / s}, unitD{"F30", "kilogram per day", kg / day}, - unitD{"F31", "kilogram per minute", kg / min}, + unitD{"F31", "kilogram per minute", kg / minute}, unitD{"F32", "milligram per day", mg / day}, - unitD{"F33", "milligram per minute", mg / min}, + unitD{"F33", "milligram per minute", mg / minute}, unitD{"F34", "milligram per second", mg / s}, unitD{"F35", "gram per day kelvin", g / (day * K)}, unitD{"F36", "gram per hour kelvin", g / (hr * K)}, - unitD{"F37", "gram per minute kelvin", g / (min * K)}, + unitD{"F37", "gram per minute kelvin", g / (minute * K)}, unitD{"F38", "gram per second kelvin", g / (s * K)}, unitD{"F39", "kilogram per day kelvin", kg / (day * K)}, unitD{"F40", "kilogram per hour kelvin", kg / (hr * K)}, - unitD{"F41", "kilogram per minute kelvin", kg / (min * K)}, + unitD{"F41", "kilogram per minute kelvin", kg / (minute * K)}, unitD{"F42", "kilogram per second kelvin", kg / (s * K)}, unitD{"F43", "milligram per day kelvin", mg / (day * K)}, unitD{"F44", "milligram per hour kelvin", mg / (hr * K)}, - unitD{"F45", "milligram per minute kelvin", mg / (min * K)}, + unitD{"F45", "milligram per minute kelvin", mg / (minute * K)}, unitD{"F46", "milligram per second kelvin", mg / (s * K)}, unitD{"F47", "newton per millimetre", N / mm}, unitD{"F48", "pound-force per inch", lbf / in}, @@ -1174,15 +1174,15 @@ namespace precise { unitD{"F61", "kelvin per bar", K / bar}, unitD{"F62", "gram per day bar", g / (day * bar)}, unitD{"F63", "gram per hour bar", g / (hr * bar)}, - unitD{"F64", "gram per minute bar", g / (min * bar)}, + unitD{"F64", "gram per minute bar", g / (minute * bar)}, unitD{"F65", "gram per second bar", g / (s * bar)}, unitD{"F66", "kilogram per day bar", kg / (day * bar)}, unitD{"F67", "kilogram per hour bar", kg / (hr * bar)}, - unitD{"F68", "kilogram per minute bar", kg / (min * bar)}, + unitD{"F68", "kilogram per minute bar", kg / (minute * bar)}, unitD{"F69", "kilogram per second bar", kg / (s * bar)}, unitD{"F70", "milligram per day bar", mg / (day * bar)}, unitD{"F71", "milligram per hour bar", mg / (hr * bar)}, - unitD{"F72", "milligram per minute bar", mg / (min * bar)}, + unitD{"F72", "milligram per minute bar", mg / (minute * bar)}, unitD{"F73", "milligram per second bar", mg / (s * bar)}, unitD{"F74", "gram per bar", g / bar}, unitD{"F75", "milligram per bar", mg / bar}, @@ -1197,7 +1197,7 @@ namespace precise { unitD{"F84", "millibar per kelvin", milli* bar / K}, unitD{"F85", "megapascal per kelvin", mega* Pa / K}, unitD{"F86", "poise per kelvin", cgs::poise / K}, - unitD{"F87", "volt per litre minute", V / (L * min)}, + unitD{"F87", "volt per litre minute", V / (L * minute)}, unitD{"F88", "newton centimetre", N* cm}, unitD{"F89", "newton metre per degree", N* m / deg}, unitD{ @@ -1250,7 +1250,7 @@ namespace precise { unitD{"FM", "million cubic foot", mega* ft.pow(3)}, unitD{"FOT", "foot", ft}, unitD{"FP", "pound per square foot", lb / ft.pow(2)}, - unitD{"FR", "foot per minute", ft / min}, + unitD{"FR", "foot per minute", ft / minute}, unitD{"FS", "foot per second", ft / s}, unitD{"FTK", "square foot", ft.pow(2)}, unitD{"FTQ", "cubic foot", ft.pow(3)}, @@ -1276,7 +1276,7 @@ namespace precise { unitD{"G17", "kilogram per litre bar", kg / (L * bar)}, unitD{"G18", "kilogram per cubic metre bar", kg / (m.pow(3) * bar)}, unitD{"G19", "newton metre per kilogram", N* m / kg}, - unitD{"G2", "US gallon per minute", us::gallon / min}, + unitD{"G2", "US gallon per minute", us::gallon / minute}, unitD{"G20", "pound-force foot per pound", lbf* ft / lb}, unitD{"G21", "cup", us::cup}, unitD{"G23", "peck", us::dry::peck}, @@ -1286,7 +1286,7 @@ namespace precise { unitD{"G27", "cubic centimetre per kelvin", cm.pow(3) / K}, unitD{"G28", "litre per kelvin", L / K}, unitD{"G29", "cubic metre per kelvin", m.pow(3) / K}, - unitD{"G3", "Imperial gallon per minute", imp::gallon / min}, + unitD{"G3", "Imperial gallon per minute", imp::gallon / minute}, unitD{"G30", "millilitre per kelvin", mL / K}, unitD{"G31", "kilogram per cubic centimetre", kg / cm.pow(3)}, unitD{ @@ -1315,28 +1315,28 @@ namespace precise { unitD{"G46", "stokes per bar", cgs::stokes / bar}, unitD{"G47", "cubic centimetre per day", cm.pow(3) / day}, unitD{"G48", "cubic centimetre per hour", cm.pow(3) / hr}, - unitD{"G49", "cubic centimetre per minute", cm.pow(3) / min}, + unitD{"G49", "cubic centimetre per minute", cm.pow(3) / minute}, unitD{"G50", "gallon (US) per hour", us::gallon / hr}, unitD{"G51", "litre per second", L / s}, unitD{"G52", "cubic metre per day", m.pow(3) / day}, - unitD{"G53", "cubic metre per minute", m.pow(3) / min}, + unitD{"G53", "cubic metre per minute", m.pow(3) / minute}, unitD{"G54", "millilitre per day", mL / day}, unitD{"G55", "millilitre per hour", mL / hr}, unitD{"G56", "cubic inch per hour", in.pow(3) / hr}, - unitD{"G57", "cubic inch per minute", in.pow(3) / min}, + unitD{"G57", "cubic inch per minute", in.pow(3) / minute}, unitD{"G58", "cubic inch per second", in.pow(3) / s}, - unitD{"G59", "milliampere per litre minute", milli* A / (L * min)}, + unitD{"G59", "milliampere per litre minute", milli* A / (L * minute)}, unitD{"G60", "volt per bar", V / bar}, unitD{"G61", "cubic centimetre per day kelvin", cm.pow(3) / (day * K)}, unitD{"G62", "cubic centimetre per hour kelvin", cm.pow(3) / (hr * K)}, unitD{ "G63", "cubic centimetre per minute kelvin", - cm.pow(3) / (min * K)}, + cm.pow(3) / (minute * K)}, unitD{"G64", "cubic centimetre per second kelvin", cm.pow(3) / (s * K)}, unitD{"G65", "litre per day kelvin", L / (day * K)}, unitD{"G66", "litre per hour kelvin", L / (hr * K)}, - unitD{"G67", "litre per minute kelvin", L / (min * K)}, + unitD{"G67", "litre per minute kelvin", L / (minute * K)}, unitD{"G68", "litre per second kelvin", L / (s * K)}, unitD{"G69", "cubic metre per day kelvin", m.pow(3) / (day * K)}, unitD{ @@ -1344,11 +1344,11 @@ namespace precise { "microfiche sheet", {1.0, count, commodities::packaging::sheet}}, unitD{"G70", "cubic metre per hour kelvin", m.pow(3) / (hr * K)}, - unitD{"G71", "cubic metre per minute kelvin", m.pow(3) / (min * K)}, + unitD{"G71", "cubic metre per minute kelvin", m.pow(3) / (minute * K)}, unitD{"G72", "cubic metre per second kelvin", m.pow(3) / (s * K)}, unitD{"G73", "millilitre per day kelvin", mL / (day * K)}, unitD{"G74", "millilitre per hour kelvin", mL / (hr * K)}, - unitD{"G75", "millilitre per minute kelvin", mL / (min * K)}, + unitD{"G75", "millilitre per minute kelvin", mL / (minute * K)}, unitD{"G76", "millilitre per second kelvin", mL / (s * K)}, unitD{"G77", "millimetre to the fourth power", mm.pow(4)}, unitD{"G78", "cubic centimetre per day bar", cm.pow(3) / (day * bar)}, @@ -1356,19 +1356,19 @@ namespace precise { unitD{ "G80", "cubic centimetre per minute bar", - cm.pow(3) / (min * bar)}, + cm.pow(3) / (minute * bar)}, unitD{"G81", "cubic centimetre per second bar", cm.pow(3) / (s * bar)}, unitD{"G82", "litre per day bar", L / (day * bar)}, unitD{"G83", "litre per hour bar", L / (hr * bar)}, - unitD{"G84", "litre per minute bar", L / (min * bar)}, + unitD{"G84", "litre per minute bar", L / (minute * bar)}, unitD{"G85", "litre per second bar", L / (s * bar)}, unitD{"G86", "cubic metre per day bar", m.pow(3) / (day * bar)}, unitD{"G87", "cubic metre per hour bar", m.pow(3) / (hr * bar)}, - unitD{"G88", "cubic metre per minute bar", m.pow(3) / (min * bar)}, + unitD{"G88", "cubic metre per minute bar", m.pow(3) / (minute * bar)}, unitD{"G89", "cubic metre per second bar", m.pow(3) / (s * bar)}, unitD{"G90", "millilitre per day bar", mL / (day * bar)}, unitD{"G91", "millilitre per hour bar", mL / (hr * bar)}, - unitD{"G92", "millilitre per minute bar", mL / (min * bar)}, + unitD{"G92", "millilitre per minute bar", mL / (minute * bar)}, unitD{"G93", "millilitre per second bar", mL / (s * bar)}, unitD{"G94", "cubic centimetre per bar", cm.pow(3) / bar}, unitD{"G95", "litre per bar", L / bar}, @@ -1434,7 +1434,7 @@ namespace precise { unitD{"H10", "reciprocal hour", hr.inv()}, unitD{"H11", "reciprocal month", time::moj.inv()}, unitD{"H12", "degree Celsius per hour", degC / hr}, - unitD{"H13", "degree Celsius per minute", degC / min}, + unitD{"H13", "degree Celsius per minute", degC / minute}, unitD{"H14", "degree Celsius per second", degC / s}, unitD{"H15", "square centimetre per gram", cm.pow(2) / g}, unitD{"H16", "square decametre", (ten * m).pow(2)}, @@ -1495,7 +1495,7 @@ namespace precise { unitD{"H59", "square metre per newton", m.pow(2) / N}, unitD{"H60", "cubic metre per cubic metre", pu* m.pow(3)}, unitD{"H61", "millisiemens per centimetre", milli* S / cm}, - unitD{"H62", "millivolt per minute", electrical::mV / min}, + unitD{"H62", "millivolt per minute", electrical::mV / minute}, unitD{"H63", "milligram per square centimetre", mg / cm.pow(2)}, unitD{"H64", "milligram per gram", mg / g}, unitD{"H65", "millilitre per cubic metre", mL / m.pow(3)}, @@ -1517,7 +1517,7 @@ namespace precise { {10.0, precise::pressure::mmH2O}}, unitD{"H79", "French gauge", precise::clinical::charriere}, unitD{"H80", "rack unit", precise_unit(1.75, precise::i::inch)}, - unitD{"H81", "millimetre per minute", mm / min}, + unitD{"H81", "millimetre per minute", mm / minute}, unitD{"H82", "big point", typographic::dtp::point}, unitD{"H83", "litre per kilogram", L / kg}, unitD{"H84", "gram millimetre", g* mm}, @@ -1591,7 +1591,7 @@ namespace precise { unitD{"IE", "person", {1.0, count, commodities::person}}, unitD{"IF", "inches of water", pressure::inH2O}, unitD{"II", "column inch", pressure::inH2O* eflag}, - unitD{"IL", "inch per minute", in / min}, + unitD{"IL", "inch per minute", in / minute}, unitD{"IM", "impression", {1.0, count, commodities::impression}}, unitD{"INH", "inch", in}, unitD{"INK", "square inch", in.pow(2)}, @@ -1630,7 +1630,7 @@ namespace precise { "degree Fahrenheit hour square foot per British thermal unit (international table)", degF* hr* ft.pow(2) / energy::btu_it}, unitD{"J23", "degree Fahrenheit per hour", degF / hr}, - unitD{"J24", "degree Fahrenheit per minute", degF / min}, + unitD{"J24", "degree Fahrenheit per minute", degF / minute}, unitD{"J25", "degree Fahrenheit per second", degF / s}, unitD{"J26", "reciprocal degree Fahrenheit", degF.inv()}, unitD{ @@ -1638,7 +1638,7 @@ namespace precise { "degree Oechsle", {1.0, generate_custom_unit(110), commodities::sugar}}, unitD{"J28", "degree Rankine per hour", temperature::rankine / hr}, - unitD{"J29", "degree Rankine per minute", temperature::rankine / min}, + unitD{"J29", "degree Rankine per minute", temperature::rankine / minute}, unitD{"J30", "degree Rankine per second", temperature::rankine / s}, unitD{"J31", "degree Twaddell", generate_custom_unit(111)}, unitD{"J32", "micropoise", micro* cgs::poise}, @@ -1677,7 +1677,7 @@ namespace precise { unitD{ "J44", "British thermal unit (international table) per minute", - energy::btu_it / min}, + energy::btu_it / minute}, unitD{ "J45", "British thermal unit (international table) per second", @@ -1705,7 +1705,7 @@ namespace precise { unitD{ "J51", "British thermal unit (thermochemical) per minute", - energy::btu_th / min}, + energy::btu_th / minute}, unitD{ "J52", "British thermal unit (thermochemical) per second", @@ -1715,19 +1715,19 @@ namespace precise { unitD{"J55", "watt second", W* s}, unitD{"J56", "bar per bar", pu* bar}, unitD{"J57", "barrel (UK petroleum)", imp::bbl}, - unitD{"J58", "barrel (UK petroleum) per minute", imp::bbl / min}, + unitD{"J58", "barrel (UK petroleum) per minute", imp::bbl / minute}, unitD{"J59", "barrel (UK petroleum) per day", imp::bbl / day}, unitD{"J60", "barrel (UK petroleum) per hour", imp::bbl / hr}, unitD{"J61", "barrel (UK petroleum) per second", imp::bbl / s}, - unitD{"J62", "barrel (US petroleum) per hour", us::barrel / min}, + unitD{"J62", "barrel (US petroleum) per hour", us::barrel / minute}, unitD{"J63", "barrel (US petroleum) per second", us::barrel / s}, unitD{"J64", "bushel (UK) per day", imp::bushel / day}, unitD{"J65", "bushel (UK) per hour", imp::bushel / hr}, - unitD{"J66", "bushel (UK) per minute", imp::bushel / min}, + unitD{"J66", "bushel (UK) per minute", imp::bushel / minute}, unitD{"J67", "bushel (UK) per second", imp::bushel / s}, unitD{"J68", "bushel (US dry) per day", us::dry::bushel / day}, unitD{"J69", "bushel (US dry) per hour", us::dry::bushel / hr}, - unitD{"J70", "bushel (US dry) per minute", us::dry::bushel / min}, + unitD{"J70", "bushel (US dry) per minute", us::dry::bushel / minute}, unitD{"J71", "bushel (US dry) per second", us::dry::bushel / s}, unitD{"J72", "centinewton metre", centi* N* m}, unitD{"J73", "centipoise per kelvin", centi* cgs::poise / K}, @@ -1748,7 +1748,7 @@ namespace precise { unitD{ "J81", "calorie (thermochemical) per minute", - energy::cal_th / min}, + energy::cal_th / minute}, unitD{"J82", "calorie (thermochemical) per second", energy::cal_th / s}, unitD{"J83", "clo", {0.155, m.pow(2) * K / W}}, unitD{"J84", "centimetre per second kelvin", cm / (s * K)}, @@ -1760,12 +1760,12 @@ namespace precise { "J91", "cubic decimetre per cubic metre", (deci * m).pow(3) / m.pow(3)}, - unitD{"J92", "cubic decimetre per minute", (deci * m).pow(3) / min}, + unitD{"J92", "cubic decimetre per minute", (deci * m).pow(3) / minute}, unitD{"J93", "cubic decimetre per second", (deci * m).pow(3) / s}, unitD{"J94", "dyne centimetre", cgs::dyn* cm}, unitD{"J95", "ounce (UK fluid) per day", imp::floz / day}, unitD{"J96", "ounce (UK fluid) per hour", imp::floz / hr}, - unitD{"J97", "ounce (UK fluid) per minute", imp::floz / min}, + unitD{"J97", "ounce (UK fluid) per minute", imp::floz / minute}, unitD{"J98", "ounce (UK fluid) per second", imp::floz / s}, unitD{"J99", "ounce (US fluid) per day", us::floz / day}, unitD{"JB", "jumbo", {1.0, count, commodities::packaging::jumbo}}, @@ -1784,12 +1784,12 @@ namespace precise { unitD{"JWL", "number of jewels", {1.0, count, commodities::jewel}}, unitD{"K1", "kilowatt demand", electrical::kW}, unitD{"K10", "ounce (US fluid) per hour", us::floz / hr}, - unitD{"K11", "ounce (US fluid) per minute", us::floz / min}, + unitD{"K11", "ounce (US fluid) per minute", us::floz / minute}, unitD{"K12", "ounce (US fluid) per second", us::floz / s}, unitD{"K13", "foot per degree Fahrenheit", ft / degF}, unitD{"K14", "foot per hour", ft / hr}, unitD{"K15", "foot pound-force per hour", ft* lbf / hr}, - unitD{"K16", "foot pound-force per minute", ft* lbf / min}, + unitD{"K16", "foot pound-force per minute", ft* lbf / minute}, unitD{"K17", "foot per psi", ft / pressure::psi}, unitD{"K18", "foot per second degree Fahrenheit", ft / (s * degF)}, unitD{"K19", "foot per second psi", ft / (s * pressure::psi)}, @@ -1811,11 +1811,11 @@ namespace precise { g* constants::g0.as_unit() / cm.pow(2)}, unitD{"K32", "gill (UK) per day", imp::gill / day}, unitD{"K33", "gill (UK) per hour", imp::gill / hr}, - unitD{"K34", "gill (UK) per minute", imp::gill / min}, + unitD{"K34", "gill (UK) per minute", imp::gill / minute}, unitD{"K35", "gill (UK) per second", imp::gill / s}, unitD{"K36", "gill (US) per day", us::gill / day}, unitD{"K37", "gill (US) per hour", us::gill / hr}, - unitD{"K38", "gill (US) per minute", us::gill / min}, + unitD{"K38", "gill (US) per minute", us::gill / minute}, unitD{"K39", "gill (US) per second", us::gill / s}, unitD{ "K40", @@ -1840,7 +1840,7 @@ namespace precise { unitD{ "K54", "kilocalorie (thermochemical) per minute", - kilo* energy::cal_th / min}, + kilo* energy::cal_th / minute}, unitD{ "K55", "kilocalorie (thermochemical) per second", @@ -1855,7 +1855,7 @@ namespace precise { "K60", "kilomole per cubic metre bar", kilo* mol / (m.pow(3) * bar)}, - unitD{"K61", "kilomole per minute", kilo* mol / min}, + unitD{"K61", "kilomole per minute", kilo* mol / minute}, unitD{"K62", "litre per litre", pu* L}, unitD{"K63", "reciprocal litre", L.inv()}, unitD{ @@ -1895,15 +1895,15 @@ namespace precise { "pound (avoirdupois) per cubic inch psi", av::pound / (in.pow(3) * pressure::psi)}, unitD{"K77", "pound (avoirdupois) per psi", av::pound / pressure::psi}, - unitD{"K78", "pound (avoirdupois) per minute", av::pound / min}, + unitD{"K78", "pound (avoirdupois) per minute", av::pound / minute}, unitD{ "K79", "pound (avoirdupois) per minute degree Fahrenheit", - av::pound / (min * degF)}, + av::pound / (minute * degF)}, unitD{ "K80", "pound (avoirdupois) per minute psi", - av::pound / (min * pressure::psi)}, + av::pound / (minute * pressure::psi)}, unitD{"K81", "pound (avoirdupois) per second", av::pound / s}, unitD{ "K82", @@ -1928,7 +1928,7 @@ namespace precise { unitD{"K93", "reciprocal psi", pressure::psi.inv()}, unitD{"K94", "quart (UK liquid) per day", imp::quart / day}, unitD{"K95", "quart (UK liquid) per hour", imp::quart / hr}, - unitD{"K96", "quart (UK liquid) per minute", imp::quart / min}, + unitD{"K96", "quart (UK liquid) per minute", imp::quart / minute}, unitD{"K97", "quart (UK liquid) per second", imp::quart / s}, unitD{"K98", "quart (US liquid) per day", us::quart / day}, unitD{"K99", "quart (US liquid) per hour", us::quart / hr}, @@ -2036,7 +2036,7 @@ namespace precise { {1.0, kg, commodities::chemicals::W03}}, unitD{"KWT", "kilowatt", kilo* W}, unitD{"KX", "millilitre per kilogram", mL / kg}, - unitD{"L10", "quart (US liquid) per minute", us::quart / min}, + unitD{"L10", "quart (US liquid) per minute", us::quart / minute}, unitD{"L11", "quart (US liquid) per second", us::quart / s}, unitD{"L12", "metre per second kelvin", m / (s * K)}, unitD{"L13", "metre per second bar", m / (s * bar)}, @@ -2049,7 +2049,7 @@ namespace precise { unitD{"L17", "milligram per cubic metre kelvin", mg / (m.pow(3) * K)}, unitD{"L18", "milligram per cubic metre bar", mg / (m.pow(3) * bar)}, unitD{"L19", "millilitre per litre", mL / L}, - unitD{"L2", "litre per minute", L / min}, + unitD{"L2", "litre per minute", L / minute}, unitD{"L20", "reciprocal cubic millimetre", mm.pow(-3)}, unitD{"L21", "cubic millimetre per cubic metre", mm.pow(3) / m.pow(3)}, unitD{"L23", "mole per hour", mol / hr}, @@ -2059,12 +2059,12 @@ namespace precise { unitD{"L27", "mole per litre bar", mol / (L * bar)}, unitD{"L28", "mole per cubic metre kelvin", mol / (m.pow(3) * K)}, unitD{"L29", "mole per cubic metre bar", mol / (m.pow(3) * bar)}, - unitD{"L30", "mole per minute", mol / min}, + unitD{"L30", "mole per minute", mol / minute}, unitD{"L31", "milliroentgen aequivalent men", milli* cgs::REM}, unitD{"L32", "nanogram per kilogram", nano* g / kg}, unitD{"L33", "ounce (avoirdupois) per day", av::ounce / day}, unitD{"L34", "ounce (avoirdupois) per hour", av::ounce / hr}, - unitD{"L35", "ounce (avoirdupois) per minute", av::ounce / min}, + unitD{"L35", "ounce (avoirdupois) per minute", av::ounce / minute}, unitD{"L36", "ounce (avoirdupois) per second", av::ounce / s}, unitD{ "L37", @@ -2090,20 +2090,20 @@ namespace precise { unitD{"L43", "peck (UK)", imp::peck}, unitD{"L44", "peck (UK) per day", imp::peck / day}, unitD{"L45", "peck (UK) per hour", imp::peck / hr}, - unitD{"L46", "peck (UK) per minute", imp::peck / min}, + unitD{"L46", "peck (UK) per minute", imp::peck / minute}, unitD{"L47", "peck (UK) per second", imp::peck / s}, unitD{"L48", "peck (US dry) per day", us::dry::peck / day}, unitD{"L49", "peck (US dry) per hour", us::dry::peck / hr}, - unitD{"L50", "peck (US dry) per minute", us::dry::peck / min}, + unitD{"L50", "peck (US dry) per minute", us::dry::peck / minute}, unitD{"L51", "peck (US dry) per second", us::dry::peck / s}, unitD{"L52", "psi per psi", pu* pressure::psi}, unitD{"L53", "pint (UK) per day", imp::pint / day}, unitD{"L54", "pint (UK) per hour", imp::pint / hr}, - unitD{"L55", "pint (UK) per minute", imp::pint / min}, + unitD{"L55", "pint (UK) per minute", imp::pint / minute}, unitD{"L56", "pint (UK) per second", imp::pint / s}, unitD{"L57", "pint (US liquid) per day", us::pint / day}, unitD{"L58", "pint (US liquid) per hour", us::pint / hr}, - unitD{"L59", "pint (US liquid) per minute", us::pint / min}, + unitD{"L59", "pint (US liquid) per minute", us::pint / minute}, unitD{"L60", "pint (US liquid) per second", us::pint / s}, unitD{"L61", "pint (US dry)", us::dry::pint}, unitD{"L62", "quart (US dry)", us::dry::quart}, @@ -2111,7 +2111,7 @@ namespace precise { unitD{"L64", "slug per foot second", imp::slug / (ft * s)}, unitD{"L65", "slug per cubic foot", imp::slug / ft.pow(3)}, unitD{"L66", "slug per hour", imp::slug / hr}, - unitD{"L67", "slug per minute", imp::slug / min}, + unitD{"L67", "slug per minute", imp::slug / minute}, unitD{"L68", "slug per second", imp::slug / s}, unitD{"L69", "tonne per kelvin", t / K}, unitD{"L70", "tonne per bar", t / bar}, @@ -2122,9 +2122,9 @@ namespace precise { unitD{"L75", "tonne per hour bar", t / (hr * bar)}, unitD{"L76", "tonne per cubic metre kelvin", t / (m.pow(3) * K)}, unitD{"L77", "tonne per cubic metre bar", t / (m.pow(3) * bar)}, - unitD{"L78", "tonne per minute", t / min}, - unitD{"L79", "tonne per minute kelvin", t / (min * K)}, - unitD{"L80", "tonne per minute bar", t / (min * bar)}, + unitD{"L78", "tonne per minute", t / minute}, + unitD{"L79", "tonne per minute kelvin", t / (minute * K)}, + unitD{"L80", "tonne per minute bar", t / (minute * bar)}, unitD{"L81", "tonne per second", t / s}, unitD{"L82", "tonne per second kelvin", t / (s * K)}, unitD{"L83", "tonne per second bar", t / (s * bar)}, @@ -2210,7 +2210,7 @@ namespace precise { unitD{"M12", "cubic yard per day", yd.pow(3) / day}, unitD{"M13", "cubic yard per hour", yd.pow(3) / hr}, unitD{"M14", "cubic yard per psi", yd.pow(3) / pressure::psi}, - unitD{"M15", "cubic yard per minute", yd.pow(3) / min}, + unitD{"M15", "cubic yard per minute", yd.pow(3) / minute}, unitD{"M16", "cubic yard per second", yd.pow(3) / s}, unitD{"M17", "kilohertz metre", kilo* Hz* m}, unitD{"M18", "gigahertz metre", giga* Hz* m}, @@ -2223,7 +2223,7 @@ namespace precise { unitD{ "M22", "millilitre per square centimetre minute", - mL / (cm.pow(2) * min)}, + mL / (cm.pow(2) * minute)}, unitD{"M23", "newton per centimetre", N / cm}, unitD{"M24", "ohm kilometre", ohm* km}, unitD{"M25", "percent per degree Celsius", percent / degC}, @@ -2264,15 +2264,15 @@ namespace precise { unitD{"M53", "metre per pascal", m / Pa}, unitD{"M55", "metre per radiant", m / rad}, unitD{"M56", "shake", {1e-8, s}}, - unitD{"M57", "mile per minute", mile / min}, + unitD{"M57", "mile per minute", mile / minute}, unitD{"M58", "mile per second", mile / s}, unitD{"M59", "metre per second pascal", m / (s * Pa)}, unitD{"M60", "metre per hour", m / hr}, unitD{"M61", "inch per year", in / yr}, unitD{"M62", "kilometre per second", km / s}, - unitD{"M63", "inch per minute", in / min}, + unitD{"M63", "inch per minute", in / minute}, unitD{"M64", "yard per second", yd / s}, - unitD{"M65", "yard per minute", yd / min}, + unitD{"M65", "yard per minute", yd / minute}, unitD{"M66", "yard per hour", yd / hr}, unitD{"M67", "acre-foot (U.S. survey)", acre* us::foot}, unitD{"M68", "cord", us::cord}, @@ -2339,7 +2339,7 @@ namespace precise { unitD{"MHZ", "megahertz", mega* Hz}, unitD{"MIK", "square mile ", mile.pow(2)}, unitD{"MIL", "thousand", thousand* count}, - unitD{"MIN", "minute [unit of time]", min}, + unitD{"MIN", "minute [unit of time]", minute}, unitD{"MIO", "million", mega* count}, unitD{"MIU", "million international unit", mega* laboratory::IU}, unitD{"MK", "milligram per square inch", mg / in.pow(2)}, @@ -2406,7 +2406,7 @@ namespace precise { unitD{"N35", "poise per pascal", cgs::poise / Pa}, unitD{"N36", "newton second per square metre", N* s / m.pow(2)}, unitD{"N37", "kilogram per metre second", kg / (m * s)}, - unitD{"N38", "kilogram per metre minute", kg / (m * min)}, + unitD{"N38", "kilogram per metre minute", kg / (m * minute)}, unitD{"N39", "kilogram per metre day", kg / (m * day)}, unitD{"N40", "kilogram per metre hour", kg / (m * hr)}, unitD{"N41", "gram per centimetre second", g / (cm * s)}, @@ -2414,7 +2414,7 @@ namespace precise { "N42", "poundal second per square inch", av::poundal* s / in.pow(2)}, - unitD{"N43", "pound per foot minute", lb / (ft * min)}, + unitD{"N43", "pound per foot minute", lb / (ft * minute)}, unitD{"N44", "pound per foot day", lb / (ft * day)}, unitD{"N45", "cubic metre per second pascal", m.pow(3) / (s * Pa)}, unitD{"N46", "foot poundal", ft* av::poundal}, @@ -2432,7 +2432,7 @@ namespace precise { unitD{ "N52", "British thermal unit (thermochemical) per square foot minute", - energy::btu_th / (ft.pow(2) * min)}, + energy::btu_th / (ft.pow(2) * minute)}, unitD{ "N53", "British thermal unit (international table) per square foot second", @@ -2448,7 +2448,7 @@ namespace precise { unitD{ "N56", "calorie (thermochemical) per square centimetre minute", - energy::cal_th / (cm.pow(2) * min)}, + energy::cal_th / (cm.pow(2) * minute)}, unitD{ "N57", "calorie (thermochemical) per square centimetre second", @@ -2554,7 +2554,7 @@ namespace precise { unitD{"N92", "picosiemens", pico* S}, unitD{"N93", "ampere per pascal", A / Pa}, unitD{"N94", "franklin", precise::cgs::statC_charge}, - unitD{"N95", "ampere minute", A* min}, + unitD{"N95", "ampere minute", A* minute}, unitD{"N96", "biot", cgs::biot}, unitD{"N97", "gilbert", cgs::gilbert}, unitD{"N98", "volt per pascal", V / Pa}, @@ -2644,11 +2644,11 @@ namespace precise { unitD{"P12", "gamma{geo}", precise::nano* precise::T}, unitD{"P13", "kilotesla", kilo* T}, unitD{"P14", "joule per second", J / s}, - unitD{"P15", "joule per minute", J / min}, + unitD{"P15", "joule per minute", J / minute}, unitD{"P16", "joule per hour", J / hr}, unitD{"P17", "joule per day", J / day}, unitD{"P18", "kilojoule per second", kilo* J / s}, - unitD{"P19", "kilojoule per minute", kilo* J / min}, + unitD{"P19", "kilojoule per minute", kilo* J / minute}, unitD{"P2", "pound per foot", lb / ft}, unitD{"P20", "kilojoule per hour", kilo* J / hr}, unitD{"P21", "kilojoule per day", kilo* J / day}, @@ -2690,7 +2690,7 @@ namespace precise { unitD{"P43", "bel per metre", log::bel / m}, unitD{"P44", "pound mole", lb* mol}, unitD{"P45", "pound mole per second", lb* mol / s}, - unitD{"P46", "pound mole per minute", lb* mol / min}, + unitD{"P46", "pound mole per minute", lb* mol / minute}, unitD{"P47", "kilomole per kilogram", kilo* mol / kg}, unitD{"P48", "pound mole per pound", lb* mol / lb}, unitD{"P49", "newton square metre per ampere", N* m.pow(2) / A}, @@ -2702,11 +2702,11 @@ namespace precise { unitD{"P54", "milligray per second", milli* gray / s}, unitD{"P55", "microgray per second", micro* gray / s}, unitD{"P56", "nanogray per second", nano* gray / s}, - unitD{"P57", "gray per minute", gray / min}, - unitD{"P58", "milligray per minute", milli* gray / min}, - unitD{"P59", "microgray per minute", micro* gray / min}, + unitD{"P57", "gray per minute", gray / minute}, + unitD{"P58", "milligray per minute", milli* gray / minute}, + unitD{"P59", "microgray per minute", micro* gray / minute}, unitD{"P6", "six pack", {6, one}}, - unitD{"P60", "nanogray per minute", gray / min}, + unitD{"P60", "nanogray per minute", gray / minute}, unitD{"P61", "gray per hour", gray / hr}, unitD{"P62", "milligray per hour", milli* gray / hr}, unitD{"P63", "microgray per hour", micro* gray / hr}, @@ -2721,10 +2721,10 @@ namespace precise { unitD{"P71", "millisievert per hour", milli* sievert / hr}, unitD{"P72", "microsievert per hour", micro* sievert / hr}, unitD{"P73", "nanosievert per hour", nano* sievert / hr}, - unitD{"P74", "sievert per minute", sievert / min}, - unitD{"P75", "millisievert per minute", milli* sievert / min}, - unitD{"P76", "microsievert per minute", micro* sievert / min}, - unitD{"P77", "nanosievert per minute", nano* sievert / min}, + unitD{"P74", "sievert per minute", sievert / minute}, + unitD{"P75", "millisievert per minute", milli* sievert / minute}, + unitD{"P76", "microsievert per minute", micro* sievert / minute}, + unitD{"P77", "nanosievert per minute", nano* sievert / minute}, unitD{"P78", "reciprocal square inch", in.pow(2).inv()}, unitD{"P79", "pascal square metre per kilogram", Pa* m.pow(2) / kg}, unitD{"P8", "eight pack", {8, one}}, @@ -3071,7 +3071,7 @@ namespace precise { "telecommunication line in service average", precise_unit(1.0, count, commodities::linesofservice)}, unitD{"UC", "telecommunication port", {1.0, count, commodities::port}}, - unitD{"UD", "tenth minute", {0.1, min}}, + unitD{"UD", "tenth minute", {0.1, minute}}, unitD{"UE", "tenth hour", {0.1, hr}}, unitD{ "UF", diff --git a/units/unit_definitions.hpp b/units/unit_definitions.hpp index e90cf311..7d236b8b 100644 --- a/units/unit_definitions.hpp +++ b/units/unit_definitions.hpp @@ -183,11 +183,7 @@ namespace precise { constexpr precise_unit Hz = hertz; constexpr precise_unit V = volt; constexpr precise_unit N = newton; -#ifndef pascal - // in some windows networking applications pascal is a #define that will - // cause all sorts of issues - constexpr precise_unit pascal = Pa; -#endif + constexpr precise_unit J = joule; constexpr precise_unit W = watt; constexpr precise_unit C = coulomb; @@ -297,11 +293,11 @@ namespace precise { /// Units of time namespace time { // Time unit - constexpr precise_unit min{60.0, s}; + constexpr precise_unit minute{60.0, s}; constexpr precise_unit ms{0.001, s}; constexpr precise_unit ns{1e-9, s}; - constexpr precise_unit hr{60.0, min}; - constexpr precise_unit h{60.0, min}; + constexpr precise_unit hr{60.0, minute}; + constexpr precise_unit h{60.0, minute}; constexpr precise_unit day{24.0, hr}; constexpr precise_unit week{7.0, day}; constexpr precise_unit yr{8760.0, hr}; // median calendar year; @@ -316,9 +312,10 @@ namespace precise { constexpr precise_unit mos{29.53059, day}; // synodal month constexpr precise_unit moj{1.0 / 12.0, aj}; // mean julian month constexpr precise_unit mog{1.0 / 12.0, ag}; // mean gregorian month + } // namespace time - constexpr precise_unit min = time::min; + constexpr precise_unit minute = time::minute; constexpr precise_unit ms = time::ms; constexpr precise_unit ns = time::ns; constexpr precise_unit hr = time::hr; @@ -604,11 +601,11 @@ namespace precise { } // namespace metric - namespace IN { - // l'Imprimerie nationale, IN + namespace ING { + // l'Imprimerie nationale, ING constexpr precise_unit point{0.4, mm}; constexpr precise_unit pica{12.0, point}; - } // namespace IN + } // namespace ING namespace tex { constexpr precise_unit point{1.0 / 72.27, i::inch}; @@ -1291,14 +1288,14 @@ namespace precise { constexpr precise_unit pru = precise::pressure::mmHg * precise::s / precise::mL; //!< peripheral vascular resistance unit constexpr precise_unit woodu = - precise::pressure::mmHg * precise::min / precise::L; //!< wood unit + precise::pressure::mmHg * precise::minute / precise::L; //!< wood unit constexpr precise_unit diopter = m.inv(); constexpr precise_unit prism_diopter{custom::equation_unit(27)}; constexpr precise_unit mesh = i::inch.inv(); constexpr precise_unit charriere{1.0 / 3.0, mm}; constexpr precise_unit drop{0.05, mL}; constexpr precise_unit met = - precise_unit{3.5, mL / min / kg}; //!< metabolic equivalent + precise_unit{3.5, mL / minute / kg}; //!< metabolic equivalent constexpr precise_unit hounsfield = generate_custom_unit(37); constexpr precise_unit AHF = generate_custom_unit(38); } // namespace clinical @@ -1309,7 +1306,7 @@ namespace precise { constexpr precise_unit HPF{custom::custom_count_unit(5)}; constexpr precise_unit LPF{100.0, HPF}; constexpr precise_unit enzyme_unit = - precise::micro * precise::mol / precise::min; + precise::micro * precise::mol / precise::minute; // International Unit constexpr precise_unit IU{custom::custom_count_unit(2)}; // Arbitrary Unit @@ -1420,7 +1417,7 @@ namespace precise { constexpr precise_unit faraday{96485.3321233100184, C}; // others constexpr precise_unit rpm{constants::pi / 30.0, rad* Hz}; - constexpr precise_unit CFM(ft* ft* ft / min); + constexpr precise_unit CFM(ft* ft* ft / minute); constexpr precise_unit MegaBuck{1000000.0, currency}; constexpr precise_unit GigaBuck{1000.0, MegaBuck}; @@ -1555,10 +1552,6 @@ constexpr unit sievert = unit_cast(precise::sievert); constexpr unit katal = unit_cast(precise::katal); constexpr unit N = newton; -// this is something in some Windows libraries that needs to be worked around -#ifndef pascal -constexpr unit pascal = Pa; -#endif constexpr unit J = joule; constexpr unit W = watt; constexpr unit C = coulomb; @@ -1595,7 +1588,7 @@ constexpr unit nm = unit_cast(precise::nm); // Area units constexpr unit acre = unit_cast(precise::acre); // Time unit -constexpr unit min = unit_cast(precise::min); +constexpr unit minute = unit_cast(precise::minute); constexpr unit ms = unit_cast(precise::ms); constexpr unit ns = unit_cast(precise::ns); constexpr unit hr = unit_cast(precise::hr); diff --git a/units/units.cpp b/units/units.cpp index 8f866728..e7bed922 100644 --- a/units/units.cpp +++ b/units/units.cpp @@ -178,7 +178,7 @@ static UNITS_CPP14_CONSTEXPR_OBJECT std::array testUnits{ ustr{precise::Ampere, "A"}, ustr{precise::Kelvin, "K"}, ustr{precise::ms, "ms"}, - ustr{precise::min, "min"}, + ustr{precise::minute, "min"}, ustr{precise::hr, "hr"}, ustr{precise::time::day, "day"}, ustr{precise::lb, "lb"}, diff --git a/units/units_conversion_maps.hpp b/units/units_conversion_maps.hpp index b210b962..ef31d1f2 100644 --- a/units/units_conversion_maps.hpp +++ b/units/units_conversion_maps.hpp @@ -60,7 +60,7 @@ UNITS_CPP14_CONSTEXPR_OBJECT std::array, 113> {(mega * m).pow(3), "ZL"}, // another one of those units that can be confused {bar, "bar"}, - {min, "min"}, + {minute, "min"}, {ms, "ms"}, {h, "h"}, {unit_cast(precise::time::day), "day"}, @@ -572,12 +572,12 @@ UNITS_CPP14_CONSTEXPR_OBJECT std::array< {"ode", precise::climate::odp}, // ozone depletion equivalent {"ozonedepletionequivalent", precise::climate::odp}, // ozone depletion equivalent - {"min", precise::min}, - {"min_time", precise::min}, - {"mins", precise::min}, - {"mIN", precise::min}, - {"minute", precise::min}, - {"minute_time", precise::min}, + {"min", precise::minute}, + {"min_time", precise::minute}, + {"mins", precise::minute}, + {"mIN", precise::minute}, + {"minute", precise::minute}, + {"minute_time", precise::minute}, {"ms", precise::ms}, {"millisecond", precise::ms}, {"hr", precise::hr}, @@ -1218,7 +1218,7 @@ UNITS_CPP14_CONSTEXPR_OBJECT std::array< {"litre", precise::L}, {"mL", precise::mL}, // preferred US notation {"ml", precise::mL}, - {"LPM", precise::L / precise::min}, + {"LPM", precise::L / precise::minute}, {"LPS", precise::L / precise::s}, {"t", precise::mass::tonne}, // metric tonne {"mt", precise::mass::tonne}, // metric tonne @@ -1418,9 +1418,9 @@ UNITS_CPP14_CONSTEXPR_OBJECT std::array< {"shannon", precise::data::shannon}, {"Hart", precise::data::hartley}, {"hartley", precise::data::hartley}, - {"SPL", precise_unit(2 * 1e-5, precise::pascal)}, - {"soundpressurelevel", precise_unit(2 * 1e-5, precise::pascal)}, - {"soundpressure", precise_unit(2 * 1e-5, precise::pascal)}, + {"SPL", precise_unit(2 * 1e-5, precise::Pa)}, + {"soundpressurelevel", precise_unit(2 * 1e-5, precise::Pa)}, + {"soundpressure", precise_unit(2 * 1e-5, precise::Pa)}, {"sone", precise::special::sone}, {"phon", precise::generate_custom_unit(41)}, {"BSPL", precise::log::B_SPL}, @@ -2037,7 +2037,7 @@ UNITS_CPP14_CONSTEXPR_OBJECT std::array< {"knots", precise::nautical::knot}, {"kts", precise::nautical::knot}, {"fps", precise::ft / precise::s}, - {"fpm", precise::ft / precise::min}, + {"fpm", precise::ft / precise::minute}, {"fph", precise::ft / precise::hr}, {"cal", precise::cal}, {"smallcalorie", precise::cal}, @@ -2199,7 +2199,7 @@ UNITS_CPP14_CONSTEXPR_OBJECT std::array< {"cfs", precise::ft.pow(3) / precise::s}, {"cubicfeetperminute", precise::other::CFM}, {"gps", precise::gal / precise::s}, - {"gpm", precise::gal / precise::min}, + {"gpm", precise::gal / precise::minute}, {"gph", precise::gal / precise::hr}, {"att", precise::pressure::att}, {"at", precise::pressure::att}, @@ -2717,10 +2717,10 @@ UNITS_CPP14_CONSTEXPR_OBJECT std::array< {"pca_pr", precise::typographic::printers::pica}, {"pcapr", precise::typographic::printers::pica}, {"PCA_PR", precise::typographic::printers::pica}, - {"INpoint", precise::typographic::IN::point}, - {"INpica", precise::typographic::IN::pica}, - {"INPoint", precise::typographic::IN::point}, - {"INPica", precise::typographic::IN::pica}, + {"INpoint", precise::typographic::ING::point}, + {"INpica", precise::typographic::ING::pica}, + {"INPoint", precise::typographic::ING::point}, + {"INPica", precise::typographic::ING::pica}, {"pied", precise::typographic::french::pied}, {"PIED", precise::typographic::french::pied}, {"pouce", precise::typographic::french::pouce}, @@ -2824,8 +2824,8 @@ std::array, 66> {"funt", precise_unit(409.51718, precise::g)}, // Russian {"pood", precise_unit(40.0 * 409.51718, precise::g)}, // Russian {"zolotnik", precise_unit(409.51718 / 96.0, precise::g)}, // Russian - {"halakim", precise_unit(1.0 / 18.0, precise::time::min)}, // Jewish - {"halek", precise_unit(1.0 / 18.0, precise::time::min)}, // Jewish + {"halakim", precise_unit(1.0 / 18.0, precise::time::minute)}, // Jewish + {"halek", precise_unit(1.0 / 18.0, precise::time::minute)}, // Jewish {"lustrum", precise_unit(5.0, precise::time::aj)}, // Roman {"lustra", precise_unit(5.0, precise::time::aj)}, // Roman // turkey, UAE, levant unit of area diff --git a/units/units_util.hpp b/units/units_util.hpp index 642889eb..9974215b 100644 --- a/units/units_util.hpp +++ b/units/units_util.hpp @@ -15,22 +15,22 @@ namespace detail { * would overflow */ template struct bitfield { - static constexpr int32_t min = -(static_cast(1U << Bits) / 2); - static constexpr int32_t max = static_cast(1U << Bits) / 2 - 1; + static constexpr int32_t min_val = -(static_cast(1U << Bits) / 2); + static constexpr int32_t max_val = static_cast(1U << Bits) / 2 - 1; template static constexpr bool plus_overflows(const T& a, const T& b) { - return ((b > 0) && (a > max - b)) || ((b < 0) && (a < min - b)); + return ((b > 0) && (a > max_val - b)) || ((b < 0) && (a < min_val - b)); } template static constexpr bool minus_overflows(const T& a, const T& b) { - return ((b < 0) && (a > max + b)) || ((b > 0) && (a < min + b)); + return ((b < 0) && (a > max_val + b)) || ((b > 0) && (a < min_val + b)); } template static constexpr bool times_overflows(const T& a, const T& b) { - return (a * b < min) || (a * b > max); + return (a * b < min_val) || (a * b > max_val); } }; diff --git a/units/x12_conv.cpp b/units/x12_conv.cpp index cb5faaa1..ce198dd7 100644 --- a/units/x12_conv.cpp +++ b/units/x12_conv.cpp @@ -224,7 +224,7 @@ static UNITS_CPP14_CONSTEXPR_OBJECT std::array x12_units{{ unitD{"FO", "FLUID OUNCE", precise::us::floz}, unitD{"FT", "FOOT", precise::ft}, unitD{"FU", "FURLONG", precise::one}, - unitD{"G2", "GALLONS PER MINUTE", precise::gal / precise::min}, + unitD{"G2", "GALLONS PER MINUTE", precise::gal / precise::minute}, unitD{"G5", "GILL (IMPERIAL)", precise::imp::gill}, unitD{"GA", "GALLON", precise::gal}, unitD{"GG", "GREAT GROSS", precise::one}, @@ -301,7 +301,7 @@ static UNITS_CPP14_CONSTEXPR_OBJECT std::array x12_units{{ unitD{"ME", "MILLIGRAM", precise::mg}, unitD{"MG", "METRIC GROSS TON", precise::one}, unitD{"MI", "METRIC", precise::one}, - unitD{"MJ", "MINUTE", precise::min}, + unitD{"MJ", "MINUTE", precise::minute}, unitD{"ML", "MILLILITER", precise::milli* precise::L}, unitD{"MM", "MILLIMETER", precise::mm}, unitD{"MN", "METRIC NET TON", precise::one}, From 89a38e1eba31f9e9c10c416f718347915e85a0f3 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 17 Oct 2024 13:41:00 +0000 Subject: [PATCH 2/6] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- test/CMakeLists.txt | 18 +++++++++++------- test/examples_test_windows.cpp | 2 +- units/r20_conv.cpp | 5 ++++- units/unit_definitions.hpp | 4 ++-- units/units_util.hpp | 12 ++++++++---- 5 files changed, 26 insertions(+), 15 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 71ac56f1..7cbd222f 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -145,13 +145,17 @@ else() set_target_properties(examples_test PROPERTIES FOLDER "Tests") add_test(examples_test ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/examples_test) - if (WIN32) - add_executable(examples_test_windows examples_test_windows.cpp) - target_link_libraries(examples_test_windows PRIVATE ${UNITS_LC_PROJECT_NAME}::units) - target_compile_definitions(examples_test_windows PRIVATE ${TARGET_SPECIAL_COMPILER_FLAGS}) - set_target_properties(examples_test_windows PROPERTIES FOLDER "Tests") - add_test(examples_test_windows ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/examples_test) -endif() + if(WIN32) + add_executable(examples_test_windows examples_test_windows.cpp) + target_link_libraries( + examples_test_windows PRIVATE ${UNITS_LC_PROJECT_NAME}::units + ) + target_compile_definitions( + examples_test_windows PRIVATE ${TARGET_SPECIAL_COMPILER_FLAGS} + ) + set_target_properties(examples_test_windows PROPERTIES FOLDER "Tests") + add_test(examples_test_windows ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/examples_test) + endif() add_executable(test_all_unit_base test_all_unit_base.cpp) if(MSVC) diff --git a/test/examples_test_windows.cpp b/test/examples_test_windows.cpp index c4547de5..8aed09b5 100644 --- a/test/examples_test_windows.cpp +++ b/test/examples_test_windows.cpp @@ -4,8 +4,8 @@ Lawrence Livermore National Security, LLC; See the top-level NOTICE for additional details. All rights reserved. SPDX-License-Identifier: BSD-3-Clause */ -#include #include "units/units_decl.hpp" +#include #include "units/units.hpp" #include "units/units_conversion_maps.hpp" diff --git a/units/r20_conv.cpp b/units/r20_conv.cpp index e019c6bc..18fdc5e0 100644 --- a/units/r20_conv.cpp +++ b/units/r20_conv.cpp @@ -1638,7 +1638,10 @@ namespace precise { "degree Oechsle", {1.0, generate_custom_unit(110), commodities::sugar}}, unitD{"J28", "degree Rankine per hour", temperature::rankine / hr}, - unitD{"J29", "degree Rankine per minute", temperature::rankine / minute}, + unitD{ + "J29", + "degree Rankine per minute", + temperature::rankine / minute}, unitD{"J30", "degree Rankine per second", temperature::rankine / s}, unitD{"J31", "degree Twaddell", generate_custom_unit(111)}, unitD{"J32", "micropoise", micro* cgs::poise}, diff --git a/units/unit_definitions.hpp b/units/unit_definitions.hpp index 7d236b8b..224cde49 100644 --- a/units/unit_definitions.hpp +++ b/units/unit_definitions.hpp @@ -1287,8 +1287,8 @@ namespace precise { namespace clinical { constexpr precise_unit pru = precise::pressure::mmHg * precise::s / precise::mL; //!< peripheral vascular resistance unit - constexpr precise_unit woodu = - precise::pressure::mmHg * precise::minute / precise::L; //!< wood unit + constexpr precise_unit woodu = precise::pressure::mmHg * + precise::minute / precise::L; //!< wood unit constexpr precise_unit diopter = m.inv(); constexpr precise_unit prism_diopter{custom::equation_unit(27)}; constexpr precise_unit mesh = i::inch.inv(); diff --git a/units/units_util.hpp b/units/units_util.hpp index 9974215b..4dec0046 100644 --- a/units/units_util.hpp +++ b/units/units_util.hpp @@ -15,17 +15,21 @@ namespace detail { * would overflow */ template struct bitfield { - static constexpr int32_t min_val = -(static_cast(1U << Bits) / 2); - static constexpr int32_t max_val = static_cast(1U << Bits) / 2 - 1; + static constexpr int32_t min_val = + -(static_cast(1U << Bits) / 2); + static constexpr int32_t max_val = + static_cast(1U << Bits) / 2 - 1; template static constexpr bool plus_overflows(const T& a, const T& b) { - return ((b > 0) && (a > max_val - b)) || ((b < 0) && (a < min_val - b)); + return ((b > 0) && (a > max_val - b)) || + ((b < 0) && (a < min_val - b)); } template static constexpr bool minus_overflows(const T& a, const T& b) { - return ((b < 0) && (a > max_val + b)) || ((b > 0) && (a < min_val + b)); + return ((b < 0) && (a > max_val + b)) || + ((b > 0) && (a < min_val + b)); } template static constexpr bool times_overflows(const T& a, const T& b) From fbcb0f88f99a1c5e0765594e458d492f853323f6 Mon Sep 17 00:00:00 2001 From: Philip Top Date: Thu, 17 Oct 2024 06:56:41 -0700 Subject: [PATCH 3/6] fix cpplint issues --- converter/converter.cpp | 7 +++---- test/fuzz_issue_tests.cpp | 2 ++ test/test_all_unit_base.cpp | 1 + test/test_conversions2.cpp | 1 + test/test_defined_units.cpp | 1 + test/test_equation_units.cpp | 2 ++ test/test_google_units.cpp | 2 ++ test/test_measurement_strings.cpp | 2 ++ test/test_r20.cpp | 2 ++ test/test_random_round_trip.cpp | 1 + test/test_siunits.cpp | 3 +++ test/test_ucum.cpp | 3 +++ test/test_udunits.cpp | 2 ++ test/test_uncertain_measurements.cpp | 1 + test/test_unit_strings.cpp | 3 +++ units/r20_conv.cpp | 1 + units/unit_definitions.hpp | 2 +- units/x12_conv.cpp | 1 + webserver/unit_web_server.cpp | 1 + 19 files changed, 33 insertions(+), 5 deletions(-) diff --git a/converter/converter.cpp b/converter/converter.cpp index 0202d314..823ec19e 100644 --- a/converter/converter.cpp +++ b/converter/converter.cpp @@ -8,6 +8,7 @@ SPDX-License-Identifier: BSD-3-Clause #include "CLI11.hpp" #include "units/units.hpp" #include +#include int main(int argc, char* argv[]) { @@ -42,10 +43,8 @@ int main(int argc, char* argv[]) newUnits, "the units to convert the measurement to, '*' to convert to base units") ->required(); - app.add_flag_callback("--version,-v", []() { - std::cout << "Units conversion " UNITS_VERSION_STRING << '\n'; - throw CLI::Success(); - }); + app.set_version_flag("--version,-v","Units conversion " UNITS_VERSION_STRING); + app.positionals_at_end(); CLI11_PARSE(app, argc, argv); diff --git a/test/fuzz_issue_tests.cpp b/test/fuzz_issue_tests.cpp index ca19a3bc..be31b20c 100644 --- a/test/fuzz_issue_tests.cpp +++ b/test/fuzz_issue_tests.cpp @@ -11,6 +11,8 @@ SPDX-License-Identifier: BSD-3-Clause #include #include #include +#include +#include using namespace units; TEST(fuzzFailures, convFailures) diff --git a/test/test_all_unit_base.cpp b/test/test_all_unit_base.cpp index 8d5b4b38..614b70f8 100644 --- a/test/test_all_unit_base.cpp +++ b/test/test_all_unit_base.cpp @@ -9,6 +9,7 @@ SPDX-License-Identifier: BSD-3-Clause #include "units/units.hpp" #include +#include using namespace units; TEST(allUnits, all) diff --git a/test/test_conversions2.cpp b/test/test_conversions2.cpp index 3d56360d..59889291 100644 --- a/test/test_conversions2.cpp +++ b/test/test_conversions2.cpp @@ -10,6 +10,7 @@ SPDX-License-Identifier: BSD-3-Clause #include #include #include +#include // structure containing information on a single conversion struct convValue { diff --git a/test/test_defined_units.cpp b/test/test_defined_units.cpp index 5c93677b..778c073b 100644 --- a/test/test_defined_units.cpp +++ b/test/test_defined_units.cpp @@ -9,6 +9,7 @@ SPDX-License-Identifier: BSD-3-Clause #include "units/units_conversion_maps.hpp" #include #include +#include TEST(unitStringDefinitions, siVectorLength) { diff --git a/test/test_equation_units.cpp b/test/test_equation_units.cpp index 1c13de90..000f4b09 100644 --- a/test/test_equation_units.cpp +++ b/test/test_equation_units.cpp @@ -8,6 +8,8 @@ SPDX-License-Identifier: BSD-3-Clause #include "test.hpp" #include "units/units.hpp" +#include + using namespace units; TEST(logUnits, nonEquality) diff --git a/test/test_google_units.cpp b/test/test_google_units.cpp index 40684ec7..8696fd85 100644 --- a/test/test_google_units.cpp +++ b/test/test_google_units.cpp @@ -12,6 +12,8 @@ SPDX-License-Identifier: BSD-3-Clause #include #include #include +#include +#include TEST(googleUnits, unitTypes) { diff --git a/test/test_measurement_strings.cpp b/test/test_measurement_strings.cpp index cdb0ba99..f28811ea 100644 --- a/test/test_measurement_strings.cpp +++ b/test/test_measurement_strings.cpp @@ -9,6 +9,8 @@ SPDX-License-Identifier: BSD-3-Clause #include #include +#include +#include using namespace units; TEST(MeasurementStrings, basic) diff --git a/test/test_r20.cpp b/test/test_r20.cpp index 1236aa79..0de19501 100644 --- a/test/test_r20.cpp +++ b/test/test_r20.cpp @@ -9,6 +9,8 @@ SPDX-License-Identifier: BSD-3-Clause #include "units/units.hpp" #include +#include +#include using unitD = std::tuple; #ifdef ENABLE_UNIT_MAP_ACCESS diff --git a/test/test_random_round_trip.cpp b/test/test_random_round_trip.cpp index 0edbd2c1..71c5082e 100644 --- a/test/test_random_round_trip.cpp +++ b/test/test_random_round_trip.cpp @@ -11,6 +11,7 @@ SPDX-License-Identifier: BSD-3-Clause #include #include #include +#include using namespace units; diff --git a/test/test_siunits.cpp b/test/test_siunits.cpp index c918449b..1e564b05 100644 --- a/test/test_siunits.cpp +++ b/test/test_siunits.cpp @@ -12,6 +12,9 @@ SPDX-License-Identifier: BSD-3-Clause #include #include #include +#include +#include +#include static std::vector> loadCsvFile(const std::string& file) diff --git a/test/test_ucum.cpp b/test/test_ucum.cpp index 710d8f2e..b2624831 100644 --- a/test/test_ucum.cpp +++ b/test/test_ucum.cpp @@ -14,6 +14,9 @@ SPDX-License-Identifier: BSD-3-Clause #include #include #include +#include +#include +#include TEST(UCUM, domain_exclusion) { diff --git a/test/test_udunits.cpp b/test/test_udunits.cpp index 0974124b..91dec035 100644 --- a/test/test_udunits.cpp +++ b/test/test_udunits.cpp @@ -13,6 +13,8 @@ SPDX-License-Identifier: BSD-3-Clause #include #include #include +#include +#include TEST(UDUNITS, acceptedNameSymbols) { diff --git a/test/test_uncertain_measurements.cpp b/test/test_uncertain_measurements.cpp index d17bf947..4950daff 100644 --- a/test/test_uncertain_measurements.cpp +++ b/test/test_uncertain_measurements.cpp @@ -9,6 +9,7 @@ SPDX-License-Identifier: BSD-3-Clause #include "units/units.hpp" #include +#include using namespace units; TEST(uncertainOps, construction) diff --git a/test/test_unit_strings.cpp b/test/test_unit_strings.cpp index 5d348231..e411de35 100644 --- a/test/test_unit_strings.cpp +++ b/test/test_unit_strings.cpp @@ -8,6 +8,9 @@ SPDX-License-Identifier: BSD-3-Clause #include "test.hpp" #include +#include +#include +#include #if (__cplusplus >= 201703L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703) #ifndef UNITS_CONSTEXPR_IF_SUPPORTED diff --git a/units/r20_conv.cpp b/units/r20_conv.cpp index 18fdc5e0..6fdf09c1 100644 --- a/units/r20_conv.cpp +++ b/units/r20_conv.cpp @@ -11,6 +11,7 @@ SPDX-License-Identifier: BSD-3-Clause #include #include #include +#include namespace units { namespace precise { diff --git a/units/unit_definitions.hpp b/units/unit_definitions.hpp index 224cde49..754027ee 100644 --- a/units/unit_definitions.hpp +++ b/units/unit_definitions.hpp @@ -602,7 +602,7 @@ namespace precise { } // namespace metric namespace ING { - // l'Imprimerie nationale, ING + // l'Imprimerie nationale, IN Group constexpr precise_unit point{0.4, mm}; constexpr precise_unit pica{12.0, point}; } // namespace ING diff --git a/units/x12_conv.cpp b/units/x12_conv.cpp index ce198dd7..cc9a4962 100644 --- a/units/x12_conv.cpp +++ b/units/x12_conv.cpp @@ -10,6 +10,7 @@ SPDX-License-Identifier: BSD-3-Clause #include #include #include +#include namespace UNITS_NAMESPACE { using unitD = std::tuple; diff --git a/webserver/unit_web_server.cpp b/webserver/unit_web_server.cpp index 5de7ae9b..19889ce9 100644 --- a/webserver/unit_web_server.cpp +++ b/webserver/unit_web_server.cpp @@ -38,6 +38,7 @@ SPDX-License-Identifier: BSD-3-Clause #include #include #include +#include #include "units/units.hpp" From f1c25acd4b729cbfdda9a4c3bddb5a625aee7e39 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 17 Oct 2024 13:57:13 +0000 Subject: [PATCH 4/6] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- converter/converter.cpp | 5 +++-- test/fuzz_issue_tests.cpp | 2 +- test/test_all_unit_base.cpp | 2 +- test/test_conversions2.cpp | 2 +- test/test_defined_units.cpp | 2 +- test/test_google_units.cpp | 2 +- test/test_measurement_strings.cpp | 2 +- test/test_r20.cpp | 4 ++-- test/test_siunits.cpp | 2 +- test/test_ucum.cpp | 4 ++-- test/test_udunits.cpp | 2 +- units/r20_conv.cpp | 2 +- units/x12_conv.cpp | 2 +- webserver/unit_web_server.cpp | 2 +- 14 files changed, 18 insertions(+), 17 deletions(-) diff --git a/converter/converter.cpp b/converter/converter.cpp index 823ec19e..7fffda8b 100644 --- a/converter/converter.cpp +++ b/converter/converter.cpp @@ -43,8 +43,9 @@ int main(int argc, char* argv[]) newUnits, "the units to convert the measurement to, '*' to convert to base units") ->required(); - app.set_version_flag("--version,-v","Units conversion " UNITS_VERSION_STRING); - + app.set_version_flag( + "--version,-v", "Units conversion " UNITS_VERSION_STRING); + app.positionals_at_end(); CLI11_PARSE(app, argc, argv); diff --git a/test/fuzz_issue_tests.cpp b/test/fuzz_issue_tests.cpp index be31b20c..b2d7cc67 100644 --- a/test/fuzz_issue_tests.cpp +++ b/test/fuzz_issue_tests.cpp @@ -11,8 +11,8 @@ SPDX-License-Identifier: BSD-3-Clause #include #include #include -#include #include +#include using namespace units; TEST(fuzzFailures, convFailures) diff --git a/test/test_all_unit_base.cpp b/test/test_all_unit_base.cpp index 614b70f8..58c0148b 100644 --- a/test/test_all_unit_base.cpp +++ b/test/test_all_unit_base.cpp @@ -8,8 +8,8 @@ SPDX-License-Identifier: BSD-3-Clause #include "test.hpp" #include "units/units.hpp" -#include #include +#include using namespace units; TEST(allUnits, all) diff --git a/test/test_conversions2.cpp b/test/test_conversions2.cpp index 59889291..0c2342cf 100644 --- a/test/test_conversions2.cpp +++ b/test/test_conversions2.cpp @@ -9,8 +9,8 @@ SPDX-License-Identifier: BSD-3-Clause #include #include -#include #include +#include // structure containing information on a single conversion struct convValue { diff --git a/test/test_defined_units.cpp b/test/test_defined_units.cpp index 778c073b..c1cebdb9 100644 --- a/test/test_defined_units.cpp +++ b/test/test_defined_units.cpp @@ -8,8 +8,8 @@ SPDX-License-Identifier: BSD-3-Clause #include "test.hpp" #include "units/units_conversion_maps.hpp" #include -#include #include +#include TEST(unitStringDefinitions, siVectorLength) { diff --git a/test/test_google_units.cpp b/test/test_google_units.cpp index 8696fd85..b5f6a7ee 100644 --- a/test/test_google_units.cpp +++ b/test/test_google_units.cpp @@ -10,10 +10,10 @@ SPDX-License-Identifier: BSD-3-Clause #include #include +#include #include #include #include -#include TEST(googleUnits, unitTypes) { diff --git a/test/test_measurement_strings.cpp b/test/test_measurement_strings.cpp index f28811ea..1b0a2f4e 100644 --- a/test/test_measurement_strings.cpp +++ b/test/test_measurement_strings.cpp @@ -8,9 +8,9 @@ SPDX-License-Identifier: BSD-3-Clause #include "units/units.hpp" #include +#include #include #include -#include using namespace units; TEST(MeasurementStrings, basic) diff --git a/test/test_r20.cpp b/test/test_r20.cpp index 0de19501..7ff91969 100644 --- a/test/test_r20.cpp +++ b/test/test_r20.cpp @@ -8,9 +8,9 @@ SPDX-License-Identifier: BSD-3-Clause #include "test.hpp" #include "units/units.hpp" -#include -#include #include +#include +#include using unitD = std::tuple; #ifdef ENABLE_UNIT_MAP_ACCESS diff --git a/test/test_siunits.cpp b/test/test_siunits.cpp index 1e564b05..4f6e58d4 100644 --- a/test/test_siunits.cpp +++ b/test/test_siunits.cpp @@ -12,9 +12,9 @@ SPDX-License-Identifier: BSD-3-Clause #include #include #include -#include #include #include +#include static std::vector> loadCsvFile(const std::string& file) diff --git a/test/test_ucum.cpp b/test/test_ucum.cpp index b2624831..c8bc4855 100644 --- a/test/test_ucum.cpp +++ b/test/test_ucum.cpp @@ -11,12 +11,12 @@ SPDX-License-Identifier: BSD-3-Clause #include #include +#include #include #include -#include #include +#include #include -#include TEST(UCUM, domain_exclusion) { diff --git a/test/test_udunits.cpp b/test/test_udunits.cpp index 91dec035..d7d26960 100644 --- a/test/test_udunits.cpp +++ b/test/test_udunits.cpp @@ -11,10 +11,10 @@ SPDX-License-Identifier: BSD-3-Clause #include #include +#include #include #include #include -#include TEST(UDUNITS, acceptedNameSymbols) { diff --git a/units/r20_conv.cpp b/units/r20_conv.cpp index 6fdf09c1..ae506fb4 100644 --- a/units/r20_conv.cpp +++ b/units/r20_conv.cpp @@ -9,9 +9,9 @@ SPDX-License-Identifier: BSD-3-Clause #include #include #include +#include #include #include -#include namespace units { namespace precise { diff --git a/units/x12_conv.cpp b/units/x12_conv.cpp index cc9a4962..ed1bb515 100644 --- a/units/x12_conv.cpp +++ b/units/x12_conv.cpp @@ -9,8 +9,8 @@ SPDX-License-Identifier: BSD-3-Clause #include #include #include -#include #include +#include namespace UNITS_NAMESPACE { using unitD = std::tuple; diff --git a/webserver/unit_web_server.cpp b/webserver/unit_web_server.cpp index 19889ce9..28bece53 100644 --- a/webserver/unit_web_server.cpp +++ b/webserver/unit_web_server.cpp @@ -37,8 +37,8 @@ SPDX-License-Identifier: BSD-3-Clause #include #include #include -#include #include +#include #include "units/units.hpp" From 79ad859575f5fe9a6a0c708fa089ce18758beff2 Mon Sep 17 00:00:00 2001 From: Philip Top Date: Thu, 17 Oct 2024 08:38:42 -0700 Subject: [PATCH 5/6] more cpplint fixes --- test/CMakeLists.txt | 4 ++-- test/test_complete_unit_list.cpp | 2 ++ test/test_leadingNumbers.cpp | 2 ++ test/test_unit_ops.cpp | 1 + 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 7cbd222f..b9544763 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -140,7 +140,7 @@ else() endif() add_executable(examples_test examples_test.cpp) - target_link_libraries(examples_test PRIVATE ${UNITS_LC_PROJECT_NAME}::units) + target_link_libraries(examples_test PRIVATE ${UNITS_LC_PROJECT_NAME}::units compile_flags_target) target_compile_definitions(examples_test PRIVATE ${TARGET_SPECIAL_COMPILER_FLAGS}) set_target_properties(examples_test PROPERTIES FOLDER "Tests") add_test(examples_test ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/examples_test) @@ -148,7 +148,7 @@ else() if(WIN32) add_executable(examples_test_windows examples_test_windows.cpp) target_link_libraries( - examples_test_windows PRIVATE ${UNITS_LC_PROJECT_NAME}::units + examples_test_windows PRIVATE ${UNITS_LC_PROJECT_NAME}::units compile_flags_target ) target_compile_definitions( examples_test_windows PRIVATE ${TARGET_SPECIAL_COMPILER_FLAGS} diff --git a/test/test_complete_unit_list.cpp b/test/test_complete_unit_list.cpp index fde8e504..85ca67e6 100644 --- a/test/test_complete_unit_list.cpp +++ b/test/test_complete_unit_list.cpp @@ -12,6 +12,8 @@ SPDX-License-Identifier: BSD-3-Clause #include #include #include +#include +#include static std::string hexConvert(const std::string& str) { diff --git a/test/test_leadingNumbers.cpp b/test/test_leadingNumbers.cpp index f9d0d2e2..98289f0e 100644 --- a/test/test_leadingNumbers.cpp +++ b/test/test_leadingNumbers.cpp @@ -8,6 +8,8 @@ SPDX-License-Identifier: BSD-3-Clause #include "units/units.hpp" #include +#include +#include using namespace units::detail::testing; diff --git a/test/test_unit_ops.cpp b/test/test_unit_ops.cpp index a48a87bf..fa680336 100644 --- a/test/test_unit_ops.cpp +++ b/test/test_unit_ops.cpp @@ -11,6 +11,7 @@ SPDX-License-Identifier: BSD-3-Clause #include "units/units_util.hpp" #include +#include using namespace units; From 3ffab55833fa2160ce79c2f98dfbb661b52d8cd1 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 17 Oct 2024 15:39:18 +0000 Subject: [PATCH 6/6] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- test/CMakeLists.txt | 7 +++++-- test/test_complete_unit_list.cpp | 2 +- test/test_leadingNumbers.cpp | 2 +- test/test_unit_ops.cpp | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index b9544763..9bf85113 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -140,7 +140,9 @@ else() endif() add_executable(examples_test examples_test.cpp) - target_link_libraries(examples_test PRIVATE ${UNITS_LC_PROJECT_NAME}::units compile_flags_target) + target_link_libraries( + examples_test PRIVATE ${UNITS_LC_PROJECT_NAME}::units compile_flags_target + ) target_compile_definitions(examples_test PRIVATE ${TARGET_SPECIAL_COMPILER_FLAGS}) set_target_properties(examples_test PROPERTIES FOLDER "Tests") add_test(examples_test ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/examples_test) @@ -148,7 +150,8 @@ else() if(WIN32) add_executable(examples_test_windows examples_test_windows.cpp) target_link_libraries( - examples_test_windows PRIVATE ${UNITS_LC_PROJECT_NAME}::units compile_flags_target + examples_test_windows PRIVATE ${UNITS_LC_PROJECT_NAME}::units + compile_flags_target ) target_compile_definitions( examples_test_windows PRIVATE ${TARGET_SPECIAL_COMPILER_FLAGS} diff --git a/test/test_complete_unit_list.cpp b/test/test_complete_unit_list.cpp index 85ca67e6..45a97204 100644 --- a/test/test_complete_unit_list.cpp +++ b/test/test_complete_unit_list.cpp @@ -10,10 +10,10 @@ SPDX-License-Identifier: BSD-3-Clause #include #include +#include #include #include #include -#include static std::string hexConvert(const std::string& str) { diff --git a/test/test_leadingNumbers.cpp b/test/test_leadingNumbers.cpp index 98289f0e..53aa9e38 100644 --- a/test/test_leadingNumbers.cpp +++ b/test/test_leadingNumbers.cpp @@ -8,8 +8,8 @@ SPDX-License-Identifier: BSD-3-Clause #include "units/units.hpp" #include -#include #include +#include using namespace units::detail::testing; diff --git a/test/test_unit_ops.cpp b/test/test_unit_ops.cpp index fa680336..cbed2714 100644 --- a/test/test_unit_ops.cpp +++ b/test/test_unit_ops.cpp @@ -10,8 +10,8 @@ SPDX-License-Identifier: BSD-3-Clause #include "units/units_decl.hpp" #include "units/units_util.hpp" -#include #include +#include using namespace units;