Velocity renamed to Speed (resolves #103)
This commit is contained in:
1 parent
f70d6d0be1
commit
ce301748dd
42 files changed
+151
-150
No files matched your search
@@ -26,7 +26,7 @@
|
||||
#include "units/physical/si/frequency.h"
|
||||
#include "units/physical/si/power.h"
|
||||
#include "units/physical/si/pressure.h"
|
||||
#include "units/physical/si/velocity.h"
|
||||
#include "units/physical/si/speed.h"
|
||||
#include "units/physical/si/volume.h"
|
||||
#include "units/physical/si/surface_tension.h"
|
||||
#include "units/physical/si/resistance.h"
|
||||
@@ -268,7 +268,7 @@ TEST_CASE("operator<< on a quantity", "[text][ostream][fmt]")
|
||||
|
||||
SECTION("deduced derived unit")
|
||||
{
|
||||
SECTION("velocity")
|
||||
SECTION("speed")
|
||||
{
|
||||
const auto q = 20q_km / 2q_h;
|
||||
os << q;
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#include "units/physical/international/length.h"
|
||||
#include "units/physical/international/area.h"
|
||||
#include "units/physical/international/volume.h"
|
||||
#include "units/physical/international/velocity.h"
|
||||
#include "units/physical/international/speed.h"
|
||||
#include "units/physical/iau/length.h"
|
||||
#include "units/physical/typographic/length.h"
|
||||
#include "units/format.h"
|
||||
@@ -152,7 +152,7 @@ TEST_CASE("fmt::format on synthesized unit symbols", "[text][fmt]")
|
||||
CHECK(fmt::format("{}", 1q_THz) == "1 THz");
|
||||
}
|
||||
|
||||
SECTION("velocity")
|
||||
SECTION("speed")
|
||||
{
|
||||
CHECK(fmt::format("{}", 1q_m_per_s) == "1 m/s");
|
||||
CHECK(fmt::format("{}", 1q_km_per_h) == "1 km/h");
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include <units/physical/cgs/power.h>
|
||||
#include <units/physical/cgs/pressure.h>
|
||||
#include <units/physical/cgs/time.h>
|
||||
#include <units/physical/cgs/velocity.h>
|
||||
#include <units/physical/cgs/speed.h>
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -48,7 +48,7 @@ static_assert(centimetre::symbol == "cm");
|
||||
|
||||
/* ************** DERIVED DIMENSIONS IN TERMS OF BASE UNITS **************** */
|
||||
|
||||
// velocity
|
||||
// speed
|
||||
|
||||
static_assert(10q_cm / 5q_s == 2q_cm_per_s);
|
||||
static_assert(10q_cm / 2q_cm_per_s == 5q_s);
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include "units/math.h"
|
||||
#include "units/physical/si/area.h"
|
||||
#include "units/physical/si/frequency.h"
|
||||
#include "units/physical/si/velocity.h"
|
||||
#include "units/physical/si/speed.h"
|
||||
#include <chrono>
|
||||
#include <utility>
|
||||
|
||||
@@ -249,30 +249,30 @@ static_assert(length<kilometre, expl_impl<int>>(quantity_cast<kilometre>(length<
|
||||
// static_assert(length<kilometre, expl_expl<int>>(length<metre, expl_expl<int>>(expl_expl<int>(2000))).count() == expl_expl<int>(2)); // should not compile (truncating conversion)
|
||||
static_assert(length<kilometre, expl_expl<int>>(quantity_cast<kilometre>(length<metre, expl_expl<int>>(expl_expl<int>(2000)))).count() == expl_expl<int>(2));
|
||||
|
||||
// static_assert(velocity<metre_per_second, impl<int>>(velocity<kilometre_per_hour, impl<int>>(72)).count() == impl<int>(20)); // should not compile (truncating conversion)
|
||||
static_assert(velocity<metre_per_second, impl<int>>(quantity_cast<metre_per_second>(velocity<kilometre_per_hour, impl<int>>(72))).count() == impl<int>(20));
|
||||
// static_assert(velocity<metre_per_second, expl<int>>(velocity<kilometre_per_hour, expl<int>>(expl(72))).count() == expl<int>(20)); // should not compile (truncating conversion)
|
||||
static_assert(velocity<metre_per_second, expl<int>>(quantity_cast<metre_per_second>(velocity<kilometre_per_hour, expl<int>>(expl<int>(72)))).count() == expl<int>(20));
|
||||
// static_assert(velocity<metre_per_second, impl_impl<int>>(velocity<kilometre_per_hour, impl_impl<int>>(72)).count() == impl_impl<int>(20)); // should not compile (truncating conversion)
|
||||
static_assert(velocity<metre_per_second, impl_impl<int>>(quantity_cast<metre_per_second>(velocity<kilometre_per_hour, impl_impl<int>>(72))).count() == impl_impl<int>(20));
|
||||
// static_assert(velocity<metre_per_second, impl_expl<int>>(velocity<kilometre_per_hour, impl_expl<int>>(72)).count() == impl_expl<int>(20)); // should not compile (truncating conversion)
|
||||
static_assert(velocity<metre_per_second, impl_expl<int>>(quantity_cast<metre_per_second>(velocity<kilometre_per_hour, impl_expl<int>>(72))).count() == impl_expl<int>(20));
|
||||
// static_assert(velocity<metre_per_second, expl_impl<int>>(velocity<kilometre_per_hour, expl_impl<int>>(expl_impl(72))).count() == expl_impl<int>(20)); // should not compile (truncating conversion)
|
||||
static_assert(velocity<metre_per_second, expl_impl<int>>(quantity_cast<metre_per_second>(velocity<kilometre_per_hour, expl_impl<int>>(expl_impl<int>(72)))).count() == expl_impl<int>(20));
|
||||
// static_assert(velocity<metre_per_second, expl_expl<int>>(velocity<kilometre_per_hour, expl_expl<int>>(expl_expl(72))).count() == expl_expl<int>(20)); // should not compile (truncating conversion)
|
||||
static_assert(velocity<metre_per_second, expl_expl<int>>(quantity_cast<metre_per_second>(velocity<kilometre_per_hour, expl_expl<int>>(expl_expl<int>(72)))).count() == expl_expl<int>(20));
|
||||
// static_assert(speed<metre_per_second, impl<int>>(speed<kilometre_per_hour, impl<int>>(72)).count() == impl<int>(20)); // should not compile (truncating conversion)
|
||||
static_assert(speed<metre_per_second, impl<int>>(quantity_cast<metre_per_second>(speed<kilometre_per_hour, impl<int>>(72))).count() == impl<int>(20));
|
||||
// static_assert(speed<metre_per_second, expl<int>>(speed<kilometre_per_hour, expl<int>>(expl(72))).count() == expl<int>(20)); // should not compile (truncating conversion)
|
||||
static_assert(speed<metre_per_second, expl<int>>(quantity_cast<metre_per_second>(speed<kilometre_per_hour, expl<int>>(expl<int>(72)))).count() == expl<int>(20));
|
||||
// static_assert(speed<metre_per_second, impl_impl<int>>(speed<kilometre_per_hour, impl_impl<int>>(72)).count() == impl_impl<int>(20)); // should not compile (truncating conversion)
|
||||
static_assert(speed<metre_per_second, impl_impl<int>>(quantity_cast<metre_per_second>(speed<kilometre_per_hour, impl_impl<int>>(72))).count() == impl_impl<int>(20));
|
||||
// static_assert(speed<metre_per_second, impl_expl<int>>(speed<kilometre_per_hour, impl_expl<int>>(72)).count() == impl_expl<int>(20)); // should not compile (truncating conversion)
|
||||
static_assert(speed<metre_per_second, impl_expl<int>>(quantity_cast<metre_per_second>(speed<kilometre_per_hour, impl_expl<int>>(72))).count() == impl_expl<int>(20));
|
||||
// static_assert(speed<metre_per_second, expl_impl<int>>(speed<kilometre_per_hour, expl_impl<int>>(expl_impl(72))).count() == expl_impl<int>(20)); // should not compile (truncating conversion)
|
||||
static_assert(speed<metre_per_second, expl_impl<int>>(quantity_cast<metre_per_second>(speed<kilometre_per_hour, expl_impl<int>>(expl_impl<int>(72)))).count() == expl_impl<int>(20));
|
||||
// static_assert(speed<metre_per_second, expl_expl<int>>(speed<kilometre_per_hour, expl_expl<int>>(expl_expl(72))).count() == expl_expl<int>(20)); // should not compile (truncating conversion)
|
||||
static_assert(speed<metre_per_second, expl_expl<int>>(quantity_cast<metre_per_second>(speed<kilometre_per_hour, expl_expl<int>>(expl_expl<int>(72)))).count() == expl_expl<int>(20));
|
||||
|
||||
// static_assert(velocity<kilometre_per_hour, impl<int>>(velocity<metre_per_second, impl<int>>(20)).count() == impl<int>(72)); // should not compile (truncating conversion)
|
||||
static_assert(velocity<kilometre_per_hour, impl<int>>(quantity_cast<kilometre_per_hour>(velocity<metre_per_second, impl<int>>(20))).count() == impl<int>(72));
|
||||
// static_assert(velocity<kilometre_per_hour, expl<int>>(velocity<metre_per_second, expl<int>>(expl<int>(20))).count() == expl<int>(72)); // should not compile (truncating conversion)
|
||||
static_assert(velocity<kilometre_per_hour, expl<int>>(quantity_cast<kilometre_per_hour>(velocity<metre_per_second, expl<int>>(expl<int>(20)))).count() == expl<int>(72));
|
||||
// static_assert(velocity<kilometre_per_hour, impl_impl<int>>(velocity<metre_per_second, impl_impl<int>>(20)).count() == impl_impl<int>(72)); // should not compile (truncating conversion)
|
||||
static_assert(velocity<kilometre_per_hour, impl_impl<int>>(quantity_cast<kilometre_per_hour>(velocity<metre_per_second, impl_impl<int>>(20))).count() == impl_impl<int>(72));
|
||||
// static_assert(velocity<kilometre_per_hour, impl_expl<int>>(velocity<metre_per_second, impl_expl<int>>(20)).count() == impl_expl<int>(72)); // should not compile (truncating conversion)
|
||||
static_assert(velocity<kilometre_per_hour, impl_expl<int>>(quantity_cast<kilometre_per_hour>(velocity<metre_per_second, impl_expl<int>>(20))).count() == impl_expl<int>(72));
|
||||
// static_assert(velocity<kilometre_per_hour, expl_impl<int>>(velocity<metre_per_second, expl_impl<int>>(expl_impl<int>(20))).count() == expl_impl<int>(72)); // should not compile (truncating conversion)
|
||||
static_assert(velocity<kilometre_per_hour, expl_impl<int>>(quantity_cast<kilometre_per_hour>(velocity<metre_per_second, expl_impl<int>>(expl_impl<int>(20)))).count() == expl_impl<int>(72));
|
||||
// static_assert(velocity<kilometre_per_hour, expl_expl<int>>(velocity<metre_per_second, expl_expl<int>>(expl_expl<int>(20))).count() == expl_expl<int>(72)); // should not compile (truncating conversion)
|
||||
static_assert(velocity<kilometre_per_hour, expl_expl<int>>(quantity_cast<kilometre_per_hour>(velocity<metre_per_second, expl_expl<int>>(expl_expl<int>(20)))).count() == expl_expl<int>(72));
|
||||
// static_assert(speed<kilometre_per_hour, impl<int>>(speed<metre_per_second, impl<int>>(20)).count() == impl<int>(72)); // should not compile (truncating conversion)
|
||||
static_assert(speed<kilometre_per_hour, impl<int>>(quantity_cast<kilometre_per_hour>(speed<metre_per_second, impl<int>>(20))).count() == impl<int>(72));
|
||||
// static_assert(speed<kilometre_per_hour, expl<int>>(speed<metre_per_second, expl<int>>(expl<int>(20))).count() == expl<int>(72)); // should not compile (truncating conversion)
|
||||
static_assert(speed<kilometre_per_hour, expl<int>>(quantity_cast<kilometre_per_hour>(speed<metre_per_second, expl<int>>(expl<int>(20)))).count() == expl<int>(72));
|
||||
// static_assert(speed<kilometre_per_hour, impl_impl<int>>(speed<metre_per_second, impl_impl<int>>(20)).count() == impl_impl<int>(72)); // should not compile (truncating conversion)
|
||||
static_assert(speed<kilometre_per_hour, impl_impl<int>>(quantity_cast<kilometre_per_hour>(speed<metre_per_second, impl_impl<int>>(20))).count() == impl_impl<int>(72));
|
||||
// static_assert(speed<kilometre_per_hour, impl_expl<int>>(speed<metre_per_second, impl_expl<int>>(20)).count() == impl_expl<int>(72)); // should not compile (truncating conversion)
|
||||
static_assert(speed<kilometre_per_hour, impl_expl<int>>(quantity_cast<kilometre_per_hour>(speed<metre_per_second, impl_expl<int>>(20))).count() == impl_expl<int>(72));
|
||||
// static_assert(speed<kilometre_per_hour, expl_impl<int>>(speed<metre_per_second, expl_impl<int>>(expl_impl<int>(20))).count() == expl_impl<int>(72)); // should not compile (truncating conversion)
|
||||
static_assert(speed<kilometre_per_hour, expl_impl<int>>(quantity_cast<kilometre_per_hour>(speed<metre_per_second, expl_impl<int>>(expl_impl<int>(20)))).count() == expl_impl<int>(72));
|
||||
// static_assert(speed<kilometre_per_hour, expl_expl<int>>(speed<metre_per_second, expl_expl<int>>(expl_expl<int>(20))).count() == expl_expl<int>(72)); // should not compile (truncating conversion)
|
||||
static_assert(speed<kilometre_per_hour, expl_expl<int>>(quantity_cast<kilometre_per_hour>(speed<metre_per_second, expl_expl<int>>(expl_expl<int>(20)))).count() == expl_expl<int>(72));
|
||||
|
||||
} // namespace
|
||||
@@ -57,8 +57,8 @@ static_assert(!Area<si::time<si::second>>);
|
||||
static_assert(Volume<si::volume<si::cubic_metre>>);
|
||||
static_assert(!Volume<si::time<si::second>>);
|
||||
|
||||
static_assert(Velocity<si::velocity<si::metre_per_second>>);
|
||||
static_assert(!Velocity<si::time<si::second>>);
|
||||
static_assert(Speed<si::speed<si::metre_per_second>>);
|
||||
static_assert(!Speed<si::time<si::second>>);
|
||||
|
||||
static_assert(Acceleration<si::acceleration<si::metre_per_second_sq>>);
|
||||
static_assert(!Acceleration<si::time<si::second>>);
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
// SOFTWARE.
|
||||
|
||||
#include "units/physical/si/area.h"
|
||||
#include "units/physical/si/velocity.h"
|
||||
#include "units/physical/si/speed.h"
|
||||
#include "units/physical/international/area.h"
|
||||
#include "units/math.h"
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include "units/math.h"
|
||||
#include "units/physical/si/area.h"
|
||||
#include "units/physical/si/frequency.h"
|
||||
#include "units/physical/si/velocity.h"
|
||||
#include "units/physical/si/speed.h"
|
||||
#include "units/physical/si/volume.h"
|
||||
#include <chrono>
|
||||
#include <utility>
|
||||
@@ -135,9 +135,9 @@ static_assert(
|
||||
static_assert(std::is_same_v<decltype(length<metre, int>() * 1.0), length<metre, double>>);
|
||||
static_assert(std::is_same_v<decltype(1.0 * length<metre, int>()), length<metre, double>>);
|
||||
static_assert(
|
||||
std::is_same_v<decltype(velocity<metre_per_second, int>() * physical::si::time<second, int>()), length<metre, int>>);
|
||||
std::is_same_v<decltype(speed<metre_per_second, int>() * physical::si::time<second, int>()), length<metre, int>>);
|
||||
static_assert(
|
||||
std::is_same_v<decltype(velocity<metre_per_second, int>() * physical::si::time<hour, int>()), length<scaled_unit<ratio<36, 1, 2>, metre>, int>>);
|
||||
std::is_same_v<decltype(speed<metre_per_second, int>() * physical::si::time<hour, int>()), length<scaled_unit<ratio<36, 1, 2>, metre>, int>>);
|
||||
static_assert(std::is_same_v<decltype(length<metre>() * physical::si::time<minute>()),
|
||||
quantity<unknown_dimension<units::exp<dim_length, 1>, units::exp<dim_time, 1>>, scaled_unit<ratio<6, 1, 1>, unknown_coherent_unit>>>);
|
||||
static_assert(std::is_same_v<decltype(1 / physical::si::time<second, int>()), frequency<hertz, int>>);
|
||||
@@ -149,9 +149,9 @@ static_assert(std::is_same_v<decltype(length<metre, int>() / 1.0), length<metre,
|
||||
static_assert(std::is_same_v<decltype(length<metre, int>() / length<metre, double>()), double>);
|
||||
static_assert(std::is_same_v<decltype(length<kilometre, int>() / length<metre, double>()), double>);
|
||||
static_assert(
|
||||
std::is_same_v<decltype(length<metre, int>() / physical::si::time<second, int>()), velocity<metre_per_second, int>>);
|
||||
std::is_same_v<decltype(length<metre, int>() / physical::si::time<second, int>()), speed<metre_per_second, int>>);
|
||||
static_assert(
|
||||
std::is_same_v<decltype(length<metre>() / physical::si::time<minute>()), velocity<scaled_unit<ratio<1, 6, -1>, metre_per_second>>>);
|
||||
std::is_same_v<decltype(length<metre>() / physical::si::time<minute>()), speed<scaled_unit<ratio<1, 6, -1>, metre_per_second>>>);
|
||||
static_assert(std::is_same_v<decltype(physical::si::time<minute>() / length<metre>()),
|
||||
quantity<unknown_dimension<units::exp<dim_length, -1>, units::exp<dim_time, 1>>, scaled_unit<ratio<6 ,1 , 1>, unknown_coherent_unit>>>);
|
||||
static_assert(std::is_same_v<decltype(length<metre, int>() % short(1)), length<metre, int>>);
|
||||
@@ -245,7 +245,7 @@ static_assert(1q_km + 1q_m == 1001q_m);
|
||||
static_assert(10q_km / 5q_km == 2);
|
||||
static_assert(10q_km / 2 == 5q_km);
|
||||
|
||||
// velocity
|
||||
// speed
|
||||
|
||||
static_assert(10q_m / 5q_s == 2q_m_per_s);
|
||||
static_assert(10 / 5q_s * 1q_m == 2q_m_per_s);
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#include <units/physical/cgs/power.h>
|
||||
#include <units/physical/cgs/pressure.h>
|
||||
#include <units/physical/cgs/time.h>
|
||||
#include <units/physical/cgs/velocity.h>
|
||||
#include <units/physical/cgs/speed.h>
|
||||
#include <units/physical/si/acceleration.h>
|
||||
#include <units/physical/si/area.h>
|
||||
#include <units/physical/si/energy.h>
|
||||
@@ -40,7 +40,7 @@
|
||||
#include <units/physical/si/power.h>
|
||||
#include <units/physical/si/pressure.h>
|
||||
#include <units/physical/si/time.h>
|
||||
#include <units/physical/si/velocity.h>
|
||||
#include <units/physical/si/speed.h>
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -49,7 +49,7 @@ using namespace units::physical;
|
||||
static_assert(cgs::length<cgs::centimetre>(100) == si::length<si::metre>(1));
|
||||
static_assert(cgs::mass<cgs::gram>(1'000) == si::mass<si::kilogram>(1));
|
||||
static_assert(cgs::time<cgs::second>(1) == si::time<si::second>(1));
|
||||
static_assert(cgs::velocity<cgs::centimetre_per_second>(100) == si::velocity<si::metre_per_second>(1));
|
||||
static_assert(cgs::speed<cgs::centimetre_per_second>(100) == si::speed<si::metre_per_second>(1));
|
||||
static_assert(cgs::area<cgs::square_centimetre>(10000) == si::area<si::square_metre>(1));
|
||||
static_assert(cgs::acceleration<cgs::gal>(100) == si::acceleration<si::metre_per_second_sq>(1));
|
||||
static_assert(cgs::force<cgs::dyne>(100'000) == si::force<si::newton>(1));
|
||||
@@ -64,7 +64,7 @@ using namespace units::physical::si::literals;
|
||||
static_assert(cgs::length<cgs::centimetre>(100) == 1q_m);
|
||||
static_assert(cgs::mass<cgs::gram>(1'000) == 1q_kg);
|
||||
static_assert(cgs::time<cgs::second>(1) == 1q_s);
|
||||
static_assert(cgs::velocity<cgs::centimetre_per_second>(100) == 1q_m_per_s);
|
||||
static_assert(cgs::speed<cgs::centimetre_per_second>(100) == 1q_m_per_s);
|
||||
static_assert(cgs::acceleration<cgs::gal>(100) == 1q_m_per_s2);
|
||||
static_assert(cgs::force<cgs::dyne>(100'000) == 1q_N);
|
||||
static_assert(cgs::energy<cgs::erg>(10'000'000) == 1q_J);
|
||||
@@ -80,7 +80,7 @@ using namespace units::physical::cgs::literals;
|
||||
static_assert(100q_cm == si::length<si::metre>(1));
|
||||
static_assert(1'000q_g == si::mass<si::kilogram>(1));
|
||||
static_assert(1q_s == si::time<si::second>(1));
|
||||
static_assert(100q_cm_per_s == si::velocity<si::metre_per_second>(1));
|
||||
static_assert(100q_cm_per_s == si::speed<si::metre_per_second>(1));
|
||||
static_assert(100q_Gal == si::acceleration<si::metre_per_second_sq>(1));
|
||||
static_assert(100'000q_dyn == si::force<si::newton>(1));
|
||||
static_assert(10'000'000q_erg == si::energy<si::joule>(1));
|
||||
|
||||
@@ -235,9 +235,9 @@ static_assert(kilogray::symbol == "kGy");
|
||||
|
||||
/* ************** DERIVED DIMENSIONS IN TERMS OF BASE UNITS **************** */
|
||||
|
||||
// velocity
|
||||
// speed
|
||||
|
||||
static_assert(std::is_same_v<decltype(1q_km / 1q_s), velocity<scaled_unit<ratio<1, 1, 3>, metre_per_second>, std::int64_t>>);
|
||||
static_assert(std::is_same_v<decltype(1q_km / 1q_s), speed<scaled_unit<ratio<1, 1, 3>, metre_per_second>, std::int64_t>>);
|
||||
|
||||
static_assert(10q_m / 5q_s == 2q_m_per_s);
|
||||
static_assert(10 / 5q_s * 1q_m == 2q_m_per_s);
|
||||
|
||||
@@ -23,11 +23,11 @@
|
||||
#include <units/physical/si/area.h>
|
||||
#include <units/physical/si/length.h>
|
||||
#include <units/physical/international/length.h>
|
||||
#include <units/physical/si/velocity.h>
|
||||
#include <units/physical/si/speed.h>
|
||||
#include <units/physical/si/volume.h>
|
||||
#include <units/physical/international/area.h>
|
||||
#include <units/physical/us/length.h>
|
||||
#include <units/physical/international/velocity.h>
|
||||
#include <units/physical/international/speed.h>
|
||||
#include <units/physical/international/volume.h>
|
||||
#include <utility>
|
||||
|
||||
@@ -52,7 +52,7 @@ static_assert(5q_in + 8q_cm == 207q_mm);
|
||||
|
||||
/* ************** DERIVED DIMENSIONS IN TERMS OF BASE UNITS **************** */
|
||||
|
||||
// velocity
|
||||
// speed
|
||||
|
||||
static_assert(10.0q_mi / 2q_h == 5q_mi_per_h);
|
||||
|
||||
|
||||
Reference in new issue
Block a user