From b7310b2d9796a37d42504baad164e2a778abe70d Mon Sep 17 00:00:00 2001 From: Martin Fehrs Date: Sun, 21 Jan 2024 11:58:22 +0100 Subject: [PATCH] Umstellung von Eiheitentypen auf Eiheitenkonstanten --- include/zollstock/angle_unit_constants.hpp | 6 +- include/zollstock/area_unit_constants.hpp | 5 +- include/zollstock/area_unit_types.hpp | 41 ----- include/zollstock/area_units.hpp | 1 - include/zollstock/definition_helpers.hpp | 164 +++++++++++------- include/zollstock/length_unit_constants.hpp | 2 +- include/zollstock/time_unit_constants.hpp | 10 +- include/zollstock/unit_algorithms.hpp | 9 +- include/zollstock/velocity_unit_types.hpp | 40 ----- include/zollstock/velocity_units.hpp | 8 - include/zollstock/volume_unit_constants.hpp | 5 +- include/zollstock/volume_unit_types.hpp | 41 ----- include/zollstock/volume_units.hpp | 1 - include/zollstock/zollstock.hpp | 1 - .../include/zollstock/tests/test_helpers.hpp | 142 +++++++++------ tests/sources/CMakeLists.txt | 3 - tests/sources/angle_unit_constant_tests.cpp | 6 +- tests/sources/area_unit_constant_tests.cpp | 3 +- tests/sources/area_unit_literal_tests.cpp | 2 +- tests/sources/area_unit_type_tests.cpp | 14 -- tests/sources/length_unit_constant_tests.cpp | 2 +- tests/sources/time_unit_constant_tests.cpp | 2 +- tests/sources/velocity_unit_type_tests.cpp | 84 --------- tests/sources/volume_unit_constant_tests.cpp | 3 +- tests/sources/volume_unit_literal_tests.cpp | 2 +- tests/sources/volume_unit_type_tests.cpp | 14 -- 26 files changed, 215 insertions(+), 396 deletions(-) delete mode 100644 include/zollstock/area_unit_types.hpp delete mode 100644 include/zollstock/velocity_unit_types.hpp delete mode 100644 include/zollstock/velocity_units.hpp delete mode 100644 include/zollstock/volume_unit_types.hpp delete mode 100644 tests/sources/area_unit_type_tests.cpp delete mode 100644 tests/sources/velocity_unit_type_tests.cpp delete mode 100644 tests/sources/volume_unit_type_tests.cpp diff --git a/include/zollstock/angle_unit_constants.hpp b/include/zollstock/angle_unit_constants.hpp index 862e474..3b50746 100644 --- a/include/zollstock/angle_unit_constants.hpp +++ b/include/zollstock/angle_unit_constants.hpp @@ -9,16 +9,16 @@ namespace zollstock::inline unit::inline constants { - ZOLLSTOCK_DEFINE_SI_CONSTANTS(, radian, rad) + ZOLLSTOCK_DEFINE_SI_BASE_UNIT_CONSTANTS(radian, rad) inline constexpr degree deg {}; inline constexpr arcminute arcmin{}; inline constexpr arcsecond arcsec{}; - ZOLLSTOCK_DEFINE_SI_PREFIXED_CONSTANTS(, arcsecond, as); + ZOLLSTOCK_DEFINE_SI_PREFIXED_BASE_UNIT_CONSTANTS(arcsecond, as) - ZOLLSTOCK_DEFINE_SI_CONSTANTS(, gradian, gon) + ZOLLSTOCK_DEFINE_SI_BASE_UNIT_CONSTANTS(gradian, gon) } diff --git a/include/zollstock/area_unit_constants.hpp b/include/zollstock/area_unit_constants.hpp index 81c780e..b4e1df2 100644 --- a/include/zollstock/area_unit_constants.hpp +++ b/include/zollstock/area_unit_constants.hpp @@ -2,14 +2,15 @@ #define __ZOLLSTOCK_AREA_UNIT_CONSTANTS_HPP__ -#include +#include #include +#include namespace zollstock::inline unit::inline constants { - ZOLLSTOCK_DEFINE_SI_CONSTANTS(square_, meter, m2) + ZOLLSTOCK_DEFINE_SI_DERIVED_UNIT_CONSTANTS(m, 2) } diff --git a/include/zollstock/area_unit_types.hpp b/include/zollstock/area_unit_types.hpp deleted file mode 100644 index d6fd00e..0000000 --- a/include/zollstock/area_unit_types.hpp +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef __ZOLLSTOCK_AREA_UNIT_TYPES_HPP__ -#define __ZOLLSTOCK_AREA_UNIT_TYPES_HPP__ - - -#include -#include - - -namespace zollstock::inline unit::inline types -{ - - using square_quectometer = raise_unit_v; - using square_rontometer = raise_unit_v; - using square_yoctometer = raise_unit_v; - using square_zeptometer = raise_unit_v; - using square_attometer = raise_unit_v; - using square_femtometer = raise_unit_v; - using square_picometer = raise_unit_v; - using square_nanometer = raise_unit_v; - using square_micrometer = raise_unit_v; - using square_millimeter = raise_unit_v; - using square_centimeter = raise_unit_v; - using square_decimeter = raise_unit_v; - using square_meter = raise_unit_v; - using square_decameter = raise_unit_v; - using square_hectometer = raise_unit_v; - using square_kilometer = raise_unit_v; - using square_megameter = raise_unit_v; - using square_gigameter = raise_unit_v; - using square_terameter = raise_unit_v; - using square_petameter = raise_unit_v; - using square_exameter = raise_unit_v; - using square_zettameter = raise_unit_v; - using square_yottameter = raise_unit_v; - using square_ronnameter = raise_unit_v; - using square_quettameter = raise_unit_v; - -} - - -#endif //__ZOLLSTOCK_AREA_UNIT_TYPES_HPP__ diff --git a/include/zollstock/area_units.hpp b/include/zollstock/area_units.hpp index 108d80f..38e8e3d 100644 --- a/include/zollstock/area_units.hpp +++ b/include/zollstock/area_units.hpp @@ -2,7 +2,6 @@ #define __ZOLLSTOCK_AREA_UNITS_HPP__ -#include #include #include diff --git a/include/zollstock/definition_helpers.hpp b/include/zollstock/definition_helpers.hpp index 781ec54..a4e0468 100644 --- a/include/zollstock/definition_helpers.hpp +++ b/include/zollstock/definition_helpers.hpp @@ -2,76 +2,112 @@ #define __ZOLLSTOCK_DEFINITION_HELPERS_HPP__ -#define ZOLLSTOCK_DEFINE_LITERAL(symbol) \ +#define ZOLLSTOCK_DEFINE_LITERAL(symbol) \ [[nodiscard]] constexpr auto operator""_##symbol(unsigned long long int value) noexcept \ - { \ - return scalar{ static_cast(value) }; \ - } \ - \ - [[nodiscard]] constexpr auto operator""_##symbol(long double value) noexcept \ - { \ - return scalar{ static_cast(value) }; \ - } \ + { \ + return scalar{ static_cast(value) }; \ + } \ + \ + [[nodiscard]] constexpr auto operator""_##symbol(long double value) noexcept \ + { \ + return scalar{ static_cast(value) }; \ + } \ #define ZOLLSTOCK_DEFINE_SI_PREFIXED_LITERALS(base_symbol) \ - ZOLLSTOCK_DEFINE_LITERAL(q##base_symbol ) \ - ZOLLSTOCK_DEFINE_LITERAL(r##base_symbol ) \ - ZOLLSTOCK_DEFINE_LITERAL(y##base_symbol ) \ - ZOLLSTOCK_DEFINE_LITERAL(z##base_symbol ) \ - ZOLLSTOCK_DEFINE_LITERAL(a##base_symbol ) \ - ZOLLSTOCK_DEFINE_LITERAL(f##base_symbol ) \ - ZOLLSTOCK_DEFINE_LITERAL(p##base_symbol ) \ - ZOLLSTOCK_DEFINE_LITERAL(n##base_symbol ) \ - ZOLLSTOCK_DEFINE_LITERAL(mic##base_symbol) \ - ZOLLSTOCK_DEFINE_LITERAL(m##base_symbol ) \ - ZOLLSTOCK_DEFINE_LITERAL(c##base_symbol ) \ - ZOLLSTOCK_DEFINE_LITERAL(d##base_symbol ) \ - ZOLLSTOCK_DEFINE_LITERAL(da##base_symbol ) \ - ZOLLSTOCK_DEFINE_LITERAL(h##base_symbol ) \ - ZOLLSTOCK_DEFINE_LITERAL(k##base_symbol ) \ - ZOLLSTOCK_DEFINE_LITERAL(M##base_symbol ) \ - ZOLLSTOCK_DEFINE_LITERAL(G##base_symbol ) \ - ZOLLSTOCK_DEFINE_LITERAL(T##base_symbol ) \ - ZOLLSTOCK_DEFINE_LITERAL(P##base_symbol ) \ - ZOLLSTOCK_DEFINE_LITERAL(E##base_symbol ) \ - ZOLLSTOCK_DEFINE_LITERAL(Z##base_symbol ) \ - ZOLLSTOCK_DEFINE_LITERAL(Y##base_symbol ) \ - ZOLLSTOCK_DEFINE_LITERAL(R##base_symbol ) \ - ZOLLSTOCK_DEFINE_LITERAL(Q##base_symbol ) \ + ZOLLSTOCK_DEFINE_LITERAL(q##base_symbol ) \ + ZOLLSTOCK_DEFINE_LITERAL(r##base_symbol ) \ + ZOLLSTOCK_DEFINE_LITERAL(y##base_symbol ) \ + ZOLLSTOCK_DEFINE_LITERAL(z##base_symbol ) \ + ZOLLSTOCK_DEFINE_LITERAL(a##base_symbol ) \ + ZOLLSTOCK_DEFINE_LITERAL(f##base_symbol ) \ + ZOLLSTOCK_DEFINE_LITERAL(p##base_symbol ) \ + ZOLLSTOCK_DEFINE_LITERAL(n##base_symbol ) \ + ZOLLSTOCK_DEFINE_LITERAL(mic##base_symbol) \ + ZOLLSTOCK_DEFINE_LITERAL(m##base_symbol ) \ + ZOLLSTOCK_DEFINE_LITERAL(c##base_symbol ) \ + ZOLLSTOCK_DEFINE_LITERAL(d##base_symbol ) \ + ZOLLSTOCK_DEFINE_LITERAL(da##base_symbol ) \ + ZOLLSTOCK_DEFINE_LITERAL(h##base_symbol ) \ + ZOLLSTOCK_DEFINE_LITERAL(k##base_symbol ) \ + ZOLLSTOCK_DEFINE_LITERAL(M##base_symbol ) \ + ZOLLSTOCK_DEFINE_LITERAL(G##base_symbol ) \ + ZOLLSTOCK_DEFINE_LITERAL(T##base_symbol ) \ + ZOLLSTOCK_DEFINE_LITERAL(P##base_symbol ) \ + ZOLLSTOCK_DEFINE_LITERAL(E##base_symbol ) \ + ZOLLSTOCK_DEFINE_LITERAL(Z##base_symbol ) \ + ZOLLSTOCK_DEFINE_LITERAL(Y##base_symbol ) \ + ZOLLSTOCK_DEFINE_LITERAL(R##base_symbol ) \ + ZOLLSTOCK_DEFINE_LITERAL(Q##base_symbol ) \ -#define ZOLLSTOCK_DEFINE_SI_LITERALS(base_symbol) \ - ZOLLSTOCK_DEFINE_LITERAL(base_symbol) \ - ZOLLSTOCK_DEFINE_SI_PREFIXED_LITERALS(base_symbol) +#define ZOLLSTOCK_DEFINE_SI_LITERALS(base_symbol) \ + ZOLLSTOCK_DEFINE_LITERAL(base_symbol) \ + ZOLLSTOCK_DEFINE_SI_PREFIXED_LITERALS(base_symbol) \ -#define ZOLLSTOCK_DEFINE_SI_PREFIXED_CONSTANTS(type_prefix, base_type, base_symbol) \ - inline constexpr type_prefix##quecto##base_type q##base_symbol {}; \ - inline constexpr type_prefix##ronto##base_type r##base_symbol {}; \ - inline constexpr type_prefix##yocto##base_type y##base_symbol {}; \ - inline constexpr type_prefix##zepto##base_type z##base_symbol {}; \ - inline constexpr type_prefix##atto##base_type a##base_symbol {}; \ - inline constexpr type_prefix##femto##base_type f##base_symbol {}; \ - inline constexpr type_prefix##pico##base_type p##base_symbol {}; \ - inline constexpr type_prefix##nano##base_type n##base_symbol {}; \ - inline constexpr type_prefix##micro##base_type mic##base_symbol{}; \ - inline constexpr type_prefix##milli##base_type m##base_symbol {}; \ - inline constexpr type_prefix##centi##base_type c##base_symbol {}; \ - inline constexpr type_prefix##deci##base_type d##base_symbol {}; \ - inline constexpr type_prefix##deca##base_type da##base_symbol {}; \ - inline constexpr type_prefix##hecto##base_type h##base_symbol {}; \ - inline constexpr type_prefix##kilo##base_type k##base_symbol {}; \ - inline constexpr type_prefix##mega##base_type M##base_symbol {}; \ - inline constexpr type_prefix##giga##base_type G##base_symbol {}; \ - inline constexpr type_prefix##tera##base_type T##base_symbol {}; \ - inline constexpr type_prefix##peta##base_type P##base_symbol {}; \ - inline constexpr type_prefix##exa##base_type E##base_symbol {}; \ - inline constexpr type_prefix##zetta##base_type Z##base_symbol {}; \ - inline constexpr type_prefix##yotta##base_type Y##base_symbol {}; \ - inline constexpr type_prefix##ronna##base_type R##base_symbol {}; \ - inline constexpr type_prefix##quetta##base_type Q##base_symbol {}; \ +#define ZOLLSTOCK_DEFINE_BASE_UNIT_CONSTANT(type, symbol) \ + inline constexpr type symbol{}; \ -#define ZOLLSTOCK_DEFINE_SI_CONSTANTS(type_prefix, base_type, base_symbol) \ - ZOLLSTOCK_DEFINE_SI_PREFIXED_CONSTANTS(type_prefix, base_type, base_symbol) \ - inline constexpr type_prefix##base_type base_symbol{}; +#define ZOLLSTOCK_DEFINE_SI_PREFIXED_BASE_UNIT_CONSTANTS(base_type, base_symbol) \ + ZOLLSTOCK_DEFINE_BASE_UNIT_CONSTANT(quecto##base_type, q##base_symbol ) \ + ZOLLSTOCK_DEFINE_BASE_UNIT_CONSTANT(ronto##base_type , r##base_symbol ) \ + ZOLLSTOCK_DEFINE_BASE_UNIT_CONSTANT(yocto##base_type , y##base_symbol ) \ + ZOLLSTOCK_DEFINE_BASE_UNIT_CONSTANT(zepto##base_type , z##base_symbol ) \ + ZOLLSTOCK_DEFINE_BASE_UNIT_CONSTANT(atto##base_type , a##base_symbol ) \ + ZOLLSTOCK_DEFINE_BASE_UNIT_CONSTANT(femto##base_type , f##base_symbol ) \ + ZOLLSTOCK_DEFINE_BASE_UNIT_CONSTANT(pico##base_type , p##base_symbol ) \ + ZOLLSTOCK_DEFINE_BASE_UNIT_CONSTANT(nano##base_type , n##base_symbol ) \ + ZOLLSTOCK_DEFINE_BASE_UNIT_CONSTANT(micro##base_type , mic##base_symbol) \ + ZOLLSTOCK_DEFINE_BASE_UNIT_CONSTANT(milli##base_type , m##base_symbol ) \ + ZOLLSTOCK_DEFINE_BASE_UNIT_CONSTANT(centi##base_type , c##base_symbol ) \ + ZOLLSTOCK_DEFINE_BASE_UNIT_CONSTANT(deci##base_type , d##base_symbol ) \ + ZOLLSTOCK_DEFINE_BASE_UNIT_CONSTANT(deca##base_type , da##base_symbol ) \ + ZOLLSTOCK_DEFINE_BASE_UNIT_CONSTANT(hecto##base_type , h##base_symbol ) \ + ZOLLSTOCK_DEFINE_BASE_UNIT_CONSTANT(kilo##base_type , k##base_symbol ) \ + ZOLLSTOCK_DEFINE_BASE_UNIT_CONSTANT(mega##base_type , M##base_symbol ) \ + ZOLLSTOCK_DEFINE_BASE_UNIT_CONSTANT(giga##base_type , G##base_symbol ) \ + ZOLLSTOCK_DEFINE_BASE_UNIT_CONSTANT(tera##base_type , T##base_symbol ) \ + ZOLLSTOCK_DEFINE_BASE_UNIT_CONSTANT(peta##base_type , P##base_symbol ) \ + ZOLLSTOCK_DEFINE_BASE_UNIT_CONSTANT(exa##base_type , E##base_symbol ) \ + ZOLLSTOCK_DEFINE_BASE_UNIT_CONSTANT(zetta##base_type , Z##base_symbol ) \ + ZOLLSTOCK_DEFINE_BASE_UNIT_CONSTANT(yotta##base_type , Y##base_symbol ) \ + ZOLLSTOCK_DEFINE_BASE_UNIT_CONSTANT(ronna##base_type , R##base_symbol ) \ + ZOLLSTOCK_DEFINE_BASE_UNIT_CONSTANT(quetta##base_type, Q##base_symbol ) \ + +#define ZOLLSTOCK_DEFINE_SI_BASE_UNIT_CONSTANTS(base_type, base_symbol) \ + ZOLLSTOCK_DEFINE_SI_PREFIXED_BASE_UNIT_CONSTANTS(base_type, base_symbol) \ + ZOLLSTOCK_DEFINE_BASE_UNIT_CONSTANT(base_type, base_symbol) \ + +#define ZOLLSTOCK_DEFINE_DERIVED_UNIT_CONSTANT(base_symbol, exponent) \ + inline constexpr auto base_symbol##exponent = zollstock::pow(base_symbol); \ + +#define ZOLLSTOCK_DEFINE_SI_PREFIXED_DERIVED_UNIT_CONSTANTS(base_symbol, exponent) \ + ZOLLSTOCK_DEFINE_DERIVED_UNIT_CONSTANT(q##base_symbol , exponent) \ + ZOLLSTOCK_DEFINE_DERIVED_UNIT_CONSTANT(r##base_symbol , exponent) \ + ZOLLSTOCK_DEFINE_DERIVED_UNIT_CONSTANT(y##base_symbol , exponent) \ + ZOLLSTOCK_DEFINE_DERIVED_UNIT_CONSTANT(z##base_symbol , exponent) \ + ZOLLSTOCK_DEFINE_DERIVED_UNIT_CONSTANT(a##base_symbol , exponent) \ + ZOLLSTOCK_DEFINE_DERIVED_UNIT_CONSTANT(f##base_symbol , exponent) \ + ZOLLSTOCK_DEFINE_DERIVED_UNIT_CONSTANT(p##base_symbol , exponent) \ + ZOLLSTOCK_DEFINE_DERIVED_UNIT_CONSTANT(n##base_symbol , exponent) \ + ZOLLSTOCK_DEFINE_DERIVED_UNIT_CONSTANT(mic##base_symbol, exponent) \ + ZOLLSTOCK_DEFINE_DERIVED_UNIT_CONSTANT(m##base_symbol , exponent) \ + ZOLLSTOCK_DEFINE_DERIVED_UNIT_CONSTANT(c##base_symbol , exponent) \ + ZOLLSTOCK_DEFINE_DERIVED_UNIT_CONSTANT(d##base_symbol , exponent) \ + ZOLLSTOCK_DEFINE_DERIVED_UNIT_CONSTANT(da##base_symbol , exponent) \ + ZOLLSTOCK_DEFINE_DERIVED_UNIT_CONSTANT(h##base_symbol , exponent) \ + ZOLLSTOCK_DEFINE_DERIVED_UNIT_CONSTANT(k##base_symbol , exponent) \ + ZOLLSTOCK_DEFINE_DERIVED_UNIT_CONSTANT(M##base_symbol , exponent) \ + ZOLLSTOCK_DEFINE_DERIVED_UNIT_CONSTANT(G##base_symbol , exponent) \ + ZOLLSTOCK_DEFINE_DERIVED_UNIT_CONSTANT(T##base_symbol , exponent) \ + ZOLLSTOCK_DEFINE_DERIVED_UNIT_CONSTANT(P##base_symbol , exponent) \ + ZOLLSTOCK_DEFINE_DERIVED_UNIT_CONSTANT(E##base_symbol , exponent) \ + ZOLLSTOCK_DEFINE_DERIVED_UNIT_CONSTANT(Z##base_symbol , exponent) \ + ZOLLSTOCK_DEFINE_DERIVED_UNIT_CONSTANT(Y##base_symbol , exponent) \ + ZOLLSTOCK_DEFINE_DERIVED_UNIT_CONSTANT(R##base_symbol , exponent) \ + ZOLLSTOCK_DEFINE_DERIVED_UNIT_CONSTANT(Q##base_symbol , exponent) \ + +#define ZOLLSTOCK_DEFINE_SI_DERIVED_UNIT_CONSTANTS(base_symbol, exponent) \ + ZOLLSTOCK_DEFINE_SI_PREFIXED_DERIVED_UNIT_CONSTANTS(base_symbol, exponent) \ + ZOLLSTOCK_DEFINE_DERIVED_UNIT_CONSTANT(base_symbol, exponent) \ #endif //__ZOLLSTOCK_DEFINITION_HELPERS_HPP__ diff --git a/include/zollstock/length_unit_constants.hpp b/include/zollstock/length_unit_constants.hpp index 5843ddd..fe37131 100644 --- a/include/zollstock/length_unit_constants.hpp +++ b/include/zollstock/length_unit_constants.hpp @@ -9,7 +9,7 @@ namespace zollstock::inline unit::inline constants { - ZOLLSTOCK_DEFINE_SI_CONSTANTS(, meter, m) + ZOLLSTOCK_DEFINE_SI_BASE_UNIT_CONSTANTS(meter, m) } diff --git a/include/zollstock/time_unit_constants.hpp b/include/zollstock/time_unit_constants.hpp index 30ffa66..31849d8 100644 --- a/include/zollstock/time_unit_constants.hpp +++ b/include/zollstock/time_unit_constants.hpp @@ -9,12 +9,12 @@ namespace zollstock::inline unit::inline constants { - ZOLLSTOCK_DEFINE_SI_CONSTANTS(, second, s) + ZOLLSTOCK_DEFINE_SI_BASE_UNIT_CONSTANTS(second, s) - inline constexpr minute min{}; - inline constexpr hour h {}; - inline constexpr day d {}; - inline constexpr year a {}; + ZOLLSTOCK_DEFINE_BASE_UNIT_CONSTANT(minute, min) + ZOLLSTOCK_DEFINE_BASE_UNIT_CONSTANT(hour , h ) + ZOLLSTOCK_DEFINE_BASE_UNIT_CONSTANT(day , d ) + ZOLLSTOCK_DEFINE_BASE_UNIT_CONSTANT(year , a ) } diff --git a/include/zollstock/unit_algorithms.hpp b/include/zollstock/unit_algorithms.hpp index 13fea26..8820fce 100644 --- a/include/zollstock/unit_algorithms.hpp +++ b/include/zollstock/unit_algorithms.hpp @@ -153,19 +153,19 @@ namespace zollstock template - [[nodiscard]] constexpr multiply_units_v operator*(Unit1, Unit2) noexcept + [[nodiscard]] consteval multiply_units_v operator*(Unit1, Unit2) noexcept { return {}; } template - [[nodiscard]] constexpr divide_units_v operator/(Unit1, Unit2) noexcept + [[nodiscard]] consteval divide_units_v operator/(Unit1, Unit2) noexcept { return {}; } - template - [[nodiscard]] constexpr auto pow(Unit unit) noexcept + template + [[nodiscard]] consteval auto pow(Unit unit) noexcept { if constexpr(exponent == 0) { @@ -179,7 +179,6 @@ namespace zollstock { return (_1 / unit) * pow(unit); } - } namespace detail diff --git a/include/zollstock/velocity_unit_types.hpp b/include/zollstock/velocity_unit_types.hpp deleted file mode 100644 index 42231a5..0000000 --- a/include/zollstock/velocity_unit_types.hpp +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef __ZOLLSTOCK_VELOCITY_UNIT_TYPES_HPP__ -#define __ZOLLSTOCK_VELOCITY_UNIT_TYPES_HPP__ - - -#include -#include -#include - - -namespace zollstock::inline unit::inline types -{ - - using centimeter_per_second = divide_units_v; - using centimeter_per_minute = divide_units_v; - using centimeter_per_hour = divide_units_v; - - using decimeter_per_second = divide_units_v; - using decimeter_per_minute = divide_units_v; - using decimeter_per_hour = divide_units_v; - - using meter_per_second = divide_units_v; - using meter_per_minute = divide_units_v; - using meter_per_hour = divide_units_v; - - using decameter_per_second = divide_units_v; - using decameter_per_minute = divide_units_v; - using decameter_per_hour = divide_units_v; - - using hectometer_per_second = divide_units_v; - using hectometer_per_minute = divide_units_v; - using hectometer_per_hour = divide_units_v; - - using kilometer_per_second = divide_units_v; - using kilometer_per_minute = divide_units_v; - using kilometer_per_hour = divide_units_v; - -} - - -#endif //__ZOLLSTOCK_VELOCITY_UNIT_TYPES_HPP__ diff --git a/include/zollstock/velocity_units.hpp b/include/zollstock/velocity_units.hpp deleted file mode 100644 index ef00052..0000000 --- a/include/zollstock/velocity_units.hpp +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef __ZOLLSTOCK_VELOCITY_UNITS_HPP__ -#define __ZOLLSTOCK_VELOCITY_UNITS_HPP__ - - -#include - - -#endif //__ZOLLSTOCK_VELOCITY_UNITS_HPP__ diff --git a/include/zollstock/volume_unit_constants.hpp b/include/zollstock/volume_unit_constants.hpp index 3aa6040..78e6565 100644 --- a/include/zollstock/volume_unit_constants.hpp +++ b/include/zollstock/volume_unit_constants.hpp @@ -2,14 +2,15 @@ #define __ZOLLSTOCK_VOLUME_UNIT_CONSTANTS_HPP__ -#include +#include #include +#include namespace zollstock::inline unit::inline constants { - ZOLLSTOCK_DEFINE_SI_CONSTANTS(cubic_, meter, m3) + ZOLLSTOCK_DEFINE_SI_DERIVED_UNIT_CONSTANTS(m, 3) } diff --git a/include/zollstock/volume_unit_types.hpp b/include/zollstock/volume_unit_types.hpp deleted file mode 100644 index 56fa58d..0000000 --- a/include/zollstock/volume_unit_types.hpp +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef __ZOLLSTOCK_VOLUME_UNIT_TYPES_HPP__ -#define __ZOLLSTOCK_VOLUME_UNIT_TYPES_HPP__ - - -#include -#include - - -namespace zollstock::inline unit::inline types -{ - - using cubic_quectometer = raise_unit_v; - using cubic_rontometer = raise_unit_v; - using cubic_yoctometer = raise_unit_v; - using cubic_zeptometer = raise_unit_v; - using cubic_attometer = raise_unit_v; - using cubic_femtometer = raise_unit_v; - using cubic_picometer = raise_unit_v; - using cubic_nanometer = raise_unit_v; - using cubic_micrometer = raise_unit_v; - using cubic_millimeter = raise_unit_v; - using cubic_centimeter = raise_unit_v; - using cubic_decimeter = raise_unit_v; - using cubic_meter = raise_unit_v; - using cubic_decameter = raise_unit_v; - using cubic_hectometer = raise_unit_v; - using cubic_kilometer = raise_unit_v; - using cubic_megameter = raise_unit_v; - using cubic_gigameter = raise_unit_v; - using cubic_terameter = raise_unit_v; - using cubic_petameter = raise_unit_v; - using cubic_exameter = raise_unit_v; - using cubic_zettameter = raise_unit_v; - using cubic_yottameter = raise_unit_v; - using cubic_ronnameter = raise_unit_v; - using cubic_quettameter = raise_unit_v; - -} - - -#endif //__ZOLLSTOCK_VOLUME_UNIT_TYPES_HPP__ diff --git a/include/zollstock/volume_units.hpp b/include/zollstock/volume_units.hpp index f70e851..e490493 100644 --- a/include/zollstock/volume_units.hpp +++ b/include/zollstock/volume_units.hpp @@ -2,7 +2,6 @@ #define __ZOLLSTOCK_VOLUME_UNITS_HPP__ -#include #include #include diff --git a/include/zollstock/zollstock.hpp b/include/zollstock/zollstock.hpp index 33bfe93..9eea54c 100644 --- a/include/zollstock/zollstock.hpp +++ b/include/zollstock/zollstock.hpp @@ -8,7 +8,6 @@ #include #include #include -#include #endif /*__ZOLLSTOCK_HPP__*/ diff --git a/tests/include/zollstock/tests/test_helpers.hpp b/tests/include/zollstock/tests/test_helpers.hpp index 58ba8fe..25a2659 100644 --- a/tests/include/zollstock/tests/test_helpers.hpp +++ b/tests/include/zollstock/tests/test_helpers.hpp @@ -2,66 +2,98 @@ #define __ZOLLSTOCK_TESTS_TEST_HELPERS_HPP__ -#define ZOLLSTOCK_TESTS_TEST_SI_PREFIXED_CONSTANTS(type_prefix, base_type, base_symbol) \ - REQUIRE(q##base_symbol == type_prefix##quecto##base_type{}); \ - REQUIRE(r##base_symbol == type_prefix##ronto##base_type {}); \ - REQUIRE(y##base_symbol == type_prefix##yocto##base_type {}); \ - REQUIRE(z##base_symbol == type_prefix##zepto##base_type {}); \ - REQUIRE(a##base_symbol == type_prefix##atto##base_type {}); \ - REQUIRE(f##base_symbol == type_prefix##femto##base_type {}); \ - REQUIRE(p##base_symbol == type_prefix##pico##base_type {}); \ - REQUIRE(mic##base_symbol == type_prefix##micro##base_type {}); \ - REQUIRE(m##base_symbol == type_prefix##milli##base_type {}); \ - REQUIRE(c##base_symbol == type_prefix##centi##base_type {}); \ - REQUIRE(da##base_symbol == type_prefix##deca##base_type {}); \ - REQUIRE(h##base_symbol == type_prefix##hecto##base_type {}); \ - REQUIRE(k##base_symbol == type_prefix##kilo##base_type {}); \ - REQUIRE(M##base_symbol == type_prefix##mega##base_type {}); \ - REQUIRE(G##base_symbol == type_prefix##giga##base_type {}); \ - REQUIRE(T##base_symbol == type_prefix##tera##base_type {}); \ - REQUIRE(P##base_symbol == type_prefix##peta##base_type {}); \ - REQUIRE(E##base_symbol == type_prefix##exa##base_type {}); \ - REQUIRE(Z##base_symbol == type_prefix##zetta##base_type {}); \ - REQUIRE(Y##base_symbol == type_prefix##yotta##base_type {}); \ - REQUIRE(R##base_symbol == type_prefix##ronna##base_type {}); \ - REQUIRE(Q##base_symbol == type_prefix##quetta##base_type{}); \ - -#define ZOLLSTOCK_TESTS_TEST_SI_CONSTANTS(type_prefix, base_type, base_symbol) \ - REQUIRE(base_symbol == type_prefix##base_type{}); \ - ZOLLSTOCK_TESTS_TEST_SI_PREFIXED_CONSTANTS(type_prefix, base_type, base_symbol) \ +#define ZOLLSTOCK_TESTS_TEST_SI_PREFIXED_BASE_UNIT_CONSTANTS(base_type, base_symbol) \ + REQUIRE(q##base_symbol == quecto##base_type{}); \ + REQUIRE(r##base_symbol == ronto##base_type {}); \ + REQUIRE(y##base_symbol == yocto##base_type {}); \ + REQUIRE(z##base_symbol == zepto##base_type {}); \ + REQUIRE(a##base_symbol == atto##base_type {}); \ + REQUIRE(f##base_symbol == femto##base_type {}); \ + REQUIRE(p##base_symbol == pico##base_type {}); \ + REQUIRE(mic##base_symbol == micro##base_type {}); \ + REQUIRE(m##base_symbol == milli##base_type {}); \ + REQUIRE(c##base_symbol == centi##base_type {}); \ + REQUIRE(da##base_symbol == deca##base_type {}); \ + REQUIRE(h##base_symbol == hecto##base_type {}); \ + REQUIRE(k##base_symbol == kilo##base_type {}); \ + REQUIRE(M##base_symbol == mega##base_type {}); \ + REQUIRE(G##base_symbol == giga##base_type {}); \ + REQUIRE(T##base_symbol == tera##base_type {}); \ + REQUIRE(P##base_symbol == peta##base_type {}); \ + REQUIRE(E##base_symbol == exa##base_type {}); \ + REQUIRE(Z##base_symbol == zetta##base_type {}); \ + REQUIRE(Y##base_symbol == yotta##base_type {}); \ + REQUIRE(R##base_symbol == ronna##base_type {}); \ + REQUIRE(Q##base_symbol == quetta##base_type{}); \ + +#define ZOLLSTOCK_TESTS_TEST_SI_BASE_UNIT_CONSTANTS(base_type, base_symbol) \ + REQUIRE(base_symbol == base_type{}); \ + ZOLLSTOCK_TESTS_TEST_SI_PREFIXED_BASE_UNIT_CONSTANTS(base_type, base_symbol) \ + +#define ZOLLSTOCK_TESTS_TEST_DERIVED_UNIT_CONSTANT(symbol, exponent) \ + REQUIRE(symbol##exponent == zollstock::pow(symbol)); \ + +#define ZOLLSTOCK_TESTS_TEST_SI_PREFIXED_DERIVED_UNIT_CONSTANTS(base_symbol, exponent) \ + ZOLLSTOCK_TESTS_TEST_DERIVED_UNIT_CONSTANT(q##base_symbol , exponent) \ + ZOLLSTOCK_TESTS_TEST_DERIVED_UNIT_CONSTANT(r##base_symbol , exponent) \ + ZOLLSTOCK_TESTS_TEST_DERIVED_UNIT_CONSTANT(y##base_symbol , exponent) \ + ZOLLSTOCK_TESTS_TEST_DERIVED_UNIT_CONSTANT(z##base_symbol , exponent) \ + ZOLLSTOCK_TESTS_TEST_DERIVED_UNIT_CONSTANT(a##base_symbol , exponent) \ + ZOLLSTOCK_TESTS_TEST_DERIVED_UNIT_CONSTANT(f##base_symbol , exponent) \ + ZOLLSTOCK_TESTS_TEST_DERIVED_UNIT_CONSTANT(p##base_symbol , exponent) \ + ZOLLSTOCK_TESTS_TEST_DERIVED_UNIT_CONSTANT(mic##base_symbol, exponent) \ + ZOLLSTOCK_TESTS_TEST_DERIVED_UNIT_CONSTANT(m##base_symbol , exponent) \ + ZOLLSTOCK_TESTS_TEST_DERIVED_UNIT_CONSTANT(c##base_symbol , exponent) \ + ZOLLSTOCK_TESTS_TEST_DERIVED_UNIT_CONSTANT(d##base_symbol , exponent) \ + ZOLLSTOCK_TESTS_TEST_DERIVED_UNIT_CONSTANT(da##base_symbol , exponent) \ + ZOLLSTOCK_TESTS_TEST_DERIVED_UNIT_CONSTANT(h##base_symbol , exponent) \ + ZOLLSTOCK_TESTS_TEST_DERIVED_UNIT_CONSTANT(k##base_symbol , exponent) \ + ZOLLSTOCK_TESTS_TEST_DERIVED_UNIT_CONSTANT(M##base_symbol , exponent) \ + ZOLLSTOCK_TESTS_TEST_DERIVED_UNIT_CONSTANT(G##base_symbol , exponent) \ + ZOLLSTOCK_TESTS_TEST_DERIVED_UNIT_CONSTANT(T##base_symbol , exponent) \ + ZOLLSTOCK_TESTS_TEST_DERIVED_UNIT_CONSTANT(P##base_symbol , exponent) \ + ZOLLSTOCK_TESTS_TEST_DERIVED_UNIT_CONSTANT(E##base_symbol , exponent) \ + ZOLLSTOCK_TESTS_TEST_DERIVED_UNIT_CONSTANT(Z##base_symbol , exponent) \ + ZOLLSTOCK_TESTS_TEST_DERIVED_UNIT_CONSTANT(Y##base_symbol , exponent) \ + ZOLLSTOCK_TESTS_TEST_DERIVED_UNIT_CONSTANT(R##base_symbol , exponent) \ + ZOLLSTOCK_TESTS_TEST_DERIVED_UNIT_CONSTANT(Q##base_symbol , exponent) \ + +#define ZOLLSTOCK_TESTS_TEST_SI_DERIVED_UNIT_CONSTANTS(base_symbol, exponent) \ + ZOLLSTOCK_TESTS_TEST_SI_PREFIXED_DERIVED_UNIT_CONSTANTS(base_symbol, exponent) \ + ZOLLSTOCK_TESTS_TEST_DERIVED_UNIT_CONSTANT(base_symbol, exponent) \ #define ZOLLSTOCK_TESTS_TEST_LITERAL(symbol) \ REQUIRE(1.0_##symbol == 1.0 * symbol); \ REQUIRE(1_##symbol == 1.0 * symbol); \ #define ZOLLSTOCK_TESTS_TEST_SI_PREFIXED_LITERALS(base_symbol) \ - ZOLLSTOCK_TESTS_TEST_LITERAL(q##base_symbol ) \ - ZOLLSTOCK_TESTS_TEST_LITERAL(r##base_symbol ) \ - ZOLLSTOCK_TESTS_TEST_LITERAL(y##base_symbol ) \ - ZOLLSTOCK_TESTS_TEST_LITERAL(z##base_symbol ) \ - ZOLLSTOCK_TESTS_TEST_LITERAL(a##base_symbol ) \ - ZOLLSTOCK_TESTS_TEST_LITERAL(f##base_symbol ) \ - ZOLLSTOCK_TESTS_TEST_LITERAL(p##base_symbol ) \ - ZOLLSTOCK_TESTS_TEST_LITERAL(n##base_symbol ) \ - ZOLLSTOCK_TESTS_TEST_LITERAL(mic##base_symbol) \ - ZOLLSTOCK_TESTS_TEST_LITERAL(m##base_symbol ) \ - ZOLLSTOCK_TESTS_TEST_LITERAL(c##base_symbol ) \ - ZOLLSTOCK_TESTS_TEST_LITERAL(d##base_symbol ) \ - ZOLLSTOCK_TESTS_TEST_LITERAL(da##base_symbol ) \ - ZOLLSTOCK_TESTS_TEST_LITERAL(h##base_symbol ) \ - ZOLLSTOCK_TESTS_TEST_LITERAL(k##base_symbol ) \ - ZOLLSTOCK_TESTS_TEST_LITERAL(M##base_symbol ) \ - ZOLLSTOCK_TESTS_TEST_LITERAL(G##base_symbol ) \ - ZOLLSTOCK_TESTS_TEST_LITERAL(T##base_symbol ) \ - ZOLLSTOCK_TESTS_TEST_LITERAL(P##base_symbol ) \ - ZOLLSTOCK_TESTS_TEST_LITERAL(E##base_symbol ) \ - ZOLLSTOCK_TESTS_TEST_LITERAL(Z##base_symbol ) \ - ZOLLSTOCK_TESTS_TEST_LITERAL(Y##base_symbol ) \ - ZOLLSTOCK_TESTS_TEST_LITERAL(R##base_symbol ) \ - ZOLLSTOCK_TESTS_TEST_LITERAL(Q##base_symbol ) \ - -#define ZOLLSTOCK_TESTS_TEST_SI_LITERALS(base_symbol) \ - ZOLLSTOCK_TESTS_TEST_LITERAL(base_symbol) \ + ZOLLSTOCK_TESTS_TEST_LITERAL(q##base_symbol ) \ + ZOLLSTOCK_TESTS_TEST_LITERAL(r##base_symbol ) \ + ZOLLSTOCK_TESTS_TEST_LITERAL(y##base_symbol ) \ + ZOLLSTOCK_TESTS_TEST_LITERAL(z##base_symbol ) \ + ZOLLSTOCK_TESTS_TEST_LITERAL(a##base_symbol ) \ + ZOLLSTOCK_TESTS_TEST_LITERAL(f##base_symbol ) \ + ZOLLSTOCK_TESTS_TEST_LITERAL(p##base_symbol ) \ + ZOLLSTOCK_TESTS_TEST_LITERAL(n##base_symbol ) \ + ZOLLSTOCK_TESTS_TEST_LITERAL(mic##base_symbol) \ + ZOLLSTOCK_TESTS_TEST_LITERAL(m##base_symbol ) \ + ZOLLSTOCK_TESTS_TEST_LITERAL(c##base_symbol ) \ + ZOLLSTOCK_TESTS_TEST_LITERAL(d##base_symbol ) \ + ZOLLSTOCK_TESTS_TEST_LITERAL(da##base_symbol ) \ + ZOLLSTOCK_TESTS_TEST_LITERAL(h##base_symbol ) \ + ZOLLSTOCK_TESTS_TEST_LITERAL(k##base_symbol ) \ + ZOLLSTOCK_TESTS_TEST_LITERAL(M##base_symbol ) \ + ZOLLSTOCK_TESTS_TEST_LITERAL(G##base_symbol ) \ + ZOLLSTOCK_TESTS_TEST_LITERAL(T##base_symbol ) \ + ZOLLSTOCK_TESTS_TEST_LITERAL(P##base_symbol ) \ + ZOLLSTOCK_TESTS_TEST_LITERAL(E##base_symbol ) \ + ZOLLSTOCK_TESTS_TEST_LITERAL(Z##base_symbol ) \ + ZOLLSTOCK_TESTS_TEST_LITERAL(Y##base_symbol ) \ + ZOLLSTOCK_TESTS_TEST_LITERAL(R##base_symbol ) \ + ZOLLSTOCK_TESTS_TEST_LITERAL(Q##base_symbol ) \ + +#define ZOLLSTOCK_TESTS_TEST_SI_LITERALS(base_symbol) \ + ZOLLSTOCK_TESTS_TEST_LITERAL(base_symbol) \ ZOLLSTOCK_TESTS_TEST_SI_PREFIXED_LITERALS(base_symbol) \ @@ -96,7 +128,7 @@ REQUIRE(type::symbols == _ZOLLSTOCK_TESTS_MAKE_QUANTITY_SYMBOLS(quantity)(symbol)); \ -#define ZOLLSTOCK_TESTS_TEST_SI_PREFIXED_TYPES(quantity, type_prefix, base_type, base_factor, base_symbol) \ +#define ZOLLSTOCK_TESTS_TEST_SI_PREFIXED_TYPES(quantity, type_prefix, base_type, base_factor, base_symbol) \ ZOLLSTOCK_TESTS_TEST_TYPE(quantity, type_prefix##quecto##base_type, 1e-30L * base_factor, q##base_symbol ) \ ZOLLSTOCK_TESTS_TEST_TYPE(quantity, type_prefix##ronto##base_type , 1e-27L * base_factor, r##base_symbol ) \ ZOLLSTOCK_TESTS_TEST_TYPE(quantity, type_prefix##yocto##base_type , 1e-24L * base_factor, y##base_symbol ) \ diff --git a/tests/sources/CMakeLists.txt b/tests/sources/CMakeLists.txt index 24431dc..ee3cb0e 100644 --- a/tests/sources/CMakeLists.txt +++ b/tests/sources/CMakeLists.txt @@ -5,13 +5,10 @@ target_sources(tests PRIVATE length_unit_literal_tests.cpp) target_sources(tests PRIVATE time_unit_type_tests.cpp) target_sources(tests PRIVATE time_unit_constant_tests.cpp) target_sources(tests PRIVATE time_unit_literal_tests.cpp) -target_sources(tests PRIVATE area_unit_type_tests.cpp) target_sources(tests PRIVATE area_unit_constant_tests.cpp) target_sources(tests PRIVATE area_unit_literal_tests.cpp) -target_sources(tests PRIVATE volume_unit_type_tests.cpp) target_sources(tests PRIVATE volume_unit_constant_tests.cpp) target_sources(tests PRIVATE volume_unit_literal_tests.cpp) target_sources(tests PRIVATE angle_unit_type_tests.cpp) target_sources(tests PRIVATE angle_unit_constant_tests.cpp) target_sources(tests PRIVATE angle_unit_literal_tests.cpp) -target_sources(tests PRIVATE velocity_unit_type_tests.cpp) diff --git a/tests/sources/angle_unit_constant_tests.cpp b/tests/sources/angle_unit_constant_tests.cpp index 9d0c614..c90b9d2 100644 --- a/tests/sources/angle_unit_constant_tests.cpp +++ b/tests/sources/angle_unit_constant_tests.cpp @@ -10,15 +10,15 @@ using namespace zollstock; TEST_CASE("angle-unit-constants", "[angle][unit][constants]") { - ZOLLSTOCK_TESTS_TEST_SI_CONSTANTS(, radian, rad) + ZOLLSTOCK_TESTS_TEST_SI_BASE_UNIT_CONSTANTS(radian, rad) REQUIRE(deg == degree{}); REQUIRE(arcmin == arcminute{}); REQUIRE(arcsec == arcsecond{}); - ZOLLSTOCK_TESTS_TEST_SI_PREFIXED_CONSTANTS(, arcsecond, as) + ZOLLSTOCK_TESTS_TEST_SI_PREFIXED_BASE_UNIT_CONSTANTS(arcsecond, as) - ZOLLSTOCK_TESTS_TEST_SI_CONSTANTS(, gradian, gon) + ZOLLSTOCK_TESTS_TEST_SI_BASE_UNIT_CONSTANTS(gradian, gon) } diff --git a/tests/sources/area_unit_constant_tests.cpp b/tests/sources/area_unit_constant_tests.cpp index 202ed62..29c510c 100644 --- a/tests/sources/area_unit_constant_tests.cpp +++ b/tests/sources/area_unit_constant_tests.cpp @@ -1,6 +1,5 @@ #include #include -#include #include @@ -10,6 +9,6 @@ using namespace zollstock; TEST_CASE("area-unit-constants", "[area][unit][constants]") { - ZOLLSTOCK_TESTS_TEST_SI_CONSTANTS(square_, meter, m2) + ZOLLSTOCK_TESTS_TEST_SI_DERIVED_UNIT_CONSTANTS(m, 2) } diff --git a/tests/sources/area_unit_literal_tests.cpp b/tests/sources/area_unit_literal_tests.cpp index 6bed03b..e2aa1db 100644 --- a/tests/sources/area_unit_literal_tests.cpp +++ b/tests/sources/area_unit_literal_tests.cpp @@ -1,7 +1,7 @@ #include -#include #include #include +#include using namespace zollstock; diff --git a/tests/sources/area_unit_type_tests.cpp b/tests/sources/area_unit_type_tests.cpp deleted file mode 100644 index 543a41b..0000000 --- a/tests/sources/area_unit_type_tests.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include -#include -#include - - -using namespace zollstock; - - -TEST_CASE("area-unit-types", "[area][unit][types]") -{ - - ZOLLSTOCK_TESTS_TEST_SI_TYPES(AREA, square_, meter, 1e0, m2) - -} diff --git a/tests/sources/length_unit_constant_tests.cpp b/tests/sources/length_unit_constant_tests.cpp index 067f229..994cc0b 100644 --- a/tests/sources/length_unit_constant_tests.cpp +++ b/tests/sources/length_unit_constant_tests.cpp @@ -10,7 +10,7 @@ using namespace zollstock; TEST_CASE("length-unit-constants", "[length][unit][constants]") { - ZOLLSTOCK_TESTS_TEST_SI_CONSTANTS(, meter, m) + ZOLLSTOCK_TESTS_TEST_SI_BASE_UNIT_CONSTANTS(meter, m) } diff --git a/tests/sources/time_unit_constant_tests.cpp b/tests/sources/time_unit_constant_tests.cpp index 58e4aa5..7b6639d 100644 --- a/tests/sources/time_unit_constant_tests.cpp +++ b/tests/sources/time_unit_constant_tests.cpp @@ -10,6 +10,6 @@ using namespace zollstock; TEST_CASE("time-unit-constants", "[time][unit][constants]") { - ZOLLSTOCK_TESTS_TEST_SI_CONSTANTS(, second, s) + ZOLLSTOCK_TESTS_TEST_SI_BASE_UNIT_CONSTANTS(second, s) } diff --git a/tests/sources/velocity_unit_type_tests.cpp b/tests/sources/velocity_unit_type_tests.cpp deleted file mode 100644 index 988e47e..0000000 --- a/tests/sources/velocity_unit_type_tests.cpp +++ /dev/null @@ -1,84 +0,0 @@ -#include -#include -#include - - -using namespace zollstock; - - -TEST_CASE("velocity-unit-types", "[velocity][unit][types]") -{ - - REQUIRE(centimeter_per_second::exponents == quantity_exponents{ 1 , -1 , 0 }); - REQUIRE(centimeter_per_second::factors == quantity_factors { 1e-2L , 1e0L , 0.0L }); - REQUIRE(centimeter_per_second::symbols == quantity_symbols { "cm"_us , "s"_us , ""_us }); - - REQUIRE(centimeter_per_minute::exponents == quantity_exponents{ 1 , -1 , 0 }); - REQUIRE(centimeter_per_minute::factors == quantity_factors { 1e-2L , 60.0L , 0.0L }); - REQUIRE(centimeter_per_minute::symbols == quantity_symbols { "cm"_us , "min"_us, ""_us }); - - REQUIRE(centimeter_per_hour ::exponents == quantity_exponents{ 1 , -1 , 0 }); - REQUIRE(centimeter_per_hour ::factors == quantity_factors { 1e-2L , 3600.0L , 0.0L }); - REQUIRE(centimeter_per_hour ::symbols == quantity_symbols { "cm"_us , "h"_us , ""_us }); - - REQUIRE(decimeter_per_second ::exponents == quantity_exponents{ 1 , -1 , 0 }); - REQUIRE(decimeter_per_second ::factors == quantity_factors { 1e-1L , 1e0L , 0.0L }); - REQUIRE(decimeter_per_second ::symbols == quantity_symbols { "dm"_us , "s"_us , ""_us }); - - REQUIRE(decimeter_per_minute ::exponents == quantity_exponents{ 1 , -1 , 0 }); - REQUIRE(decimeter_per_minute ::factors == quantity_factors { 1e-1L , 60.0L , 0.0L }); - REQUIRE(decimeter_per_minute ::symbols == quantity_symbols { "dm"_us , "min"_us, ""_us }); - - REQUIRE(decimeter_per_hour ::exponents == quantity_exponents{ 1 , -1 , 0 }); - REQUIRE(decimeter_per_hour ::factors == quantity_factors { 1e-1L , 3600.0L , 0.0L }); - REQUIRE(decimeter_per_hour ::symbols == quantity_symbols { "dm"_us , "h"_us , ""_us }); - - REQUIRE(meter_per_second ::exponents == quantity_exponents{ 1 , -1 , 0 }); - REQUIRE(meter_per_second ::factors == quantity_factors { 1e0L , 1e0L , 0.0L }); - REQUIRE(meter_per_second ::symbols == quantity_symbols { "m"_us , "s"_us , ""_us }); - - REQUIRE(meter_per_minute ::exponents == quantity_exponents{ 1 , -1 , 0 }); - REQUIRE(meter_per_minute ::factors == quantity_factors { 1e0L , 60.0L , 0.0L }); - REQUIRE(meter_per_minute ::symbols == quantity_symbols { "m"_us , "min"_us, ""_us }); - - REQUIRE(meter_per_hour ::exponents == quantity_exponents{ 1 , -1 , 0 }); - REQUIRE(meter_per_hour ::factors == quantity_factors { 1e0L , 3600.0L , 0.0L }); - REQUIRE(meter_per_hour ::symbols == quantity_symbols { "m"_us , "h"_us , ""_us }); - - REQUIRE(decameter_per_second ::exponents == quantity_exponents{ 1 , -1 , 0 }); - REQUIRE(decameter_per_second ::factors == quantity_factors { 1e1L , 1e0L , 0.0L }); - REQUIRE(decameter_per_second ::symbols == quantity_symbols { "dam"_us, "s"_us , ""_us }); - - REQUIRE(decameter_per_minute ::exponents == quantity_exponents{ 1 , -1 , 0 }); - REQUIRE(decameter_per_minute ::factors == quantity_factors { 1e1L , 60.0L , 0.0L }); - REQUIRE(decameter_per_minute ::symbols == quantity_symbols { "dam"_us, "min"_us, ""_us }); - - REQUIRE(decameter_per_hour ::exponents == quantity_exponents{ 1 , -1 , 0 }); - REQUIRE(decameter_per_hour ::factors == quantity_factors { 1e1L , 3600.0L , 0.0L }); - REQUIRE(decameter_per_hour ::symbols == quantity_symbols { "dam"_us, "h"_us , ""_us }); - - REQUIRE(hectometer_per_second::exponents == quantity_exponents{ 1 , -1 , 0 }); - REQUIRE(hectometer_per_second::factors == quantity_factors { 1e2L , 1e0L , 0.0L }); - REQUIRE(hectometer_per_second::symbols == quantity_symbols { "hm"_us , "s"_us , ""_us }); - - REQUIRE(hectometer_per_minute::exponents == quantity_exponents{ 1 , -1 , 0 }); - REQUIRE(hectometer_per_minute::factors == quantity_factors { 1e2L , 60.0L , 0.0L }); - REQUIRE(hectometer_per_minute::symbols == quantity_symbols { "hm"_us , "min"_us, ""_us }); - - REQUIRE(hectometer_per_hour ::exponents == quantity_exponents{ 1 , -1 , 0 }); - REQUIRE(hectometer_per_hour ::factors == quantity_factors { 1e2L , 3600.0L , 0.0L }); - REQUIRE(hectometer_per_hour ::symbols == quantity_symbols { "hm"_us , "h"_us , ""_us }); - - REQUIRE(kilometer_per_second ::exponents == quantity_exponents{ 1 , -1 , 0 }); - REQUIRE(kilometer_per_second ::factors == quantity_factors { 1e3L , 1e0L , 0.0L }); - REQUIRE(kilometer_per_second ::symbols == quantity_symbols { "km"_us , "s"_us , ""_us }); - - REQUIRE(kilometer_per_minute::exponents == quantity_exponents{ 1 , -1 , 0 }); - REQUIRE(kilometer_per_minute::factors == quantity_factors { 1e3L , 60.0L , 0.0L }); - REQUIRE(kilometer_per_minute::symbols == quantity_symbols { "km"_us , "min"_us, ""_us }); - - REQUIRE(kilometer_per_hour ::exponents == quantity_exponents{ 1 , -1 , 0 }); - REQUIRE(kilometer_per_hour ::factors == quantity_factors { 1e3L , 3600.0L , 0.0L }); - REQUIRE(kilometer_per_hour ::symbols == quantity_symbols { "km"_us , "h"_us , ""_us }); - -} diff --git a/tests/sources/volume_unit_constant_tests.cpp b/tests/sources/volume_unit_constant_tests.cpp index 5d42cd6..105fe49 100644 --- a/tests/sources/volume_unit_constant_tests.cpp +++ b/tests/sources/volume_unit_constant_tests.cpp @@ -1,6 +1,5 @@ #include #include -#include #include @@ -10,6 +9,6 @@ using namespace zollstock; TEST_CASE("volume-unit-constants", "[volume][unit][constants]") { - ZOLLSTOCK_TESTS_TEST_SI_CONSTANTS(cubic_, meter, m3) + ZOLLSTOCK_TESTS_TEST_SI_DERIVED_UNIT_CONSTANTS(m, 3) } diff --git a/tests/sources/volume_unit_literal_tests.cpp b/tests/sources/volume_unit_literal_tests.cpp index 69955f3..3d42ce0 100644 --- a/tests/sources/volume_unit_literal_tests.cpp +++ b/tests/sources/volume_unit_literal_tests.cpp @@ -1,7 +1,7 @@ #include -#include #include #include +#include using namespace zollstock; diff --git a/tests/sources/volume_unit_type_tests.cpp b/tests/sources/volume_unit_type_tests.cpp deleted file mode 100644 index 7509dac..0000000 --- a/tests/sources/volume_unit_type_tests.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include -#include -#include - - -using namespace zollstock; - - -TEST_CASE("volume-unit-types", "[volume][unit][types]") -{ - - ZOLLSTOCK_TESTS_TEST_SI_TYPES(VOLUME, cubic_, meter, 1e0, m3) - -}