Physical units put in the physical namespace (I am sorry)

This commit is contained in:
Mateusz Pusz committed 2020-05-08 22:39:24 +02:00
1 parent 771a9a1551
commit 7e935a4108
117 files changed
+352 -349

No files matched your search

+3 -2
View File
@@ -37,7 +37,8 @@
#include <sstream>
using namespace units;
using namespace units::si;
using namespace units::physical;
using namespace units::physical::si;
using namespace Catch::Matchers;
TEST_CASE("operator<< on a quantity", "[text][ostream][fmt]")
@@ -290,7 +291,7 @@ TEST_CASE("operator<< on a quantity", "[text][ostream][fmt]")
SECTION("surface tension")
{
struct newton_per_centimetre : deduced_unit<newton_per_centimetre, dim_surface_tension, newton, centimetre> {};
struct newton_per_centimetre : deduced_unit<newton_per_centimetre, si::dim_surface_tension, newton, centimetre> {};
const surface_tension<newton_per_centimetre> q(123);
os << q;
+6 -6
View File
@@ -32,12 +32,12 @@
#include "units/format.h"
#include <catch2/catch.hpp>
using namespace units::si;
using namespace units::international;
using namespace units::us;
using namespace units::iau;
using namespace units::imperial;
using namespace units::typographic;
using namespace units::physical::si;
using namespace units::physical::international;
using namespace units::physical::us;
using namespace units::physical::iau;
using namespace units::physical::imperial;
using namespace units::physical::typographic;
TEST_CASE("fmt::format on synthesized unit symbols", "[text][fmt]")
{
+1 -1
View File
@@ -26,7 +26,7 @@
#include <catch2/catch.hpp>
using namespace units;
using namespace units::si;
using namespace units::physical::si;
// classical
+1 -1
View File
@@ -34,7 +34,7 @@
namespace {
using namespace units;
using namespace units::cgs;
using namespace units::physical::cgs;
/* ************** BASE DIMENSIONS **************** */
@@ -165,7 +165,7 @@ struct quantity_values<impl<T>> {
namespace {
using namespace units::si;
using namespace units::physical::si;
// constructors
+3 -3
View File
@@ -29,7 +29,7 @@
namespace {
using namespace units;
using namespace units::si;
using namespace units::physical::si;
// power spectral density
struct sq_volt_per_hertz : unit<sq_volt_per_hertz> {};
@@ -60,8 +60,8 @@ static_assert(std::is_same_v<decltype(sqrt(power_spectral_density<sq_volt_per_he
namespace {
struct kilogram_per_second : unit<kilogram_per_second> {};
struct dim_mass_rate : derived_dimension<dim_mass_rate, kilogram_per_second, units::exp<si::dim_mass, 1>, units::exp<si::dim_time, -1>> {};
struct kilogram_per_hour : deduced_unit<kilogram_per_hour, dim_mass_rate, si::kilogram, si::hour> {};
struct dim_mass_rate : derived_dimension<dim_mass_rate, kilogram_per_second, units::exp<dim_mass, 1>, units::exp<dim_time, -1>> {};
struct kilogram_per_hour : deduced_unit<kilogram_per_hour, dim_mass_rate, kilogram, hour> {};
constexpr auto a = 1q_kg / 1q_h;
static_assert(std::is_same_v<decltype(a)::unit, kilogram_per_hour>);
@@ -25,7 +25,7 @@
namespace {
using namespace units;
using namespace units::physical;
static_assert(Length<si::length<si::metre>>);
static_assert(!Length<si::time<si::second>>);
+2 -2
View File
@@ -27,8 +27,8 @@
namespace {
using namespace units::si::literals;
using namespace units::international::literals;
using namespace units::physical::si::literals;
using namespace units::physical::international::literals;
static_assert(std::is_same_v<decltype(pow<0>(2q_m)), std::int64_t>);
static_assert(std::is_same_v<decltype(pow<1>(2q_m)), decltype(2q_m)>);
+10 -10
View File
@@ -31,7 +31,7 @@
namespace {
using namespace units;
using namespace units::si;
using namespace units::physical::si;
// class invariants
@@ -135,24 +135,24 @@ 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>() * si::time<second, int>()), length<metre, int>>);
std::is_same_v<decltype(velocity<metre_per_second, int>() * physical::si::time<second, int>()), length<metre, int>>);
static_assert(
std::is_same_v<decltype(velocity<metre_per_second, int>() * si::time<hour, int>()), length<scaled_unit<ratio<36, 1, 2>, metre>, int>>);
static_assert(std::is_same_v<decltype(length<metre>() * si::time<minute>()),
std::is_same_v<decltype(velocity<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 / si::time<second, int>()), frequency<hertz, int>>);
static_assert(std::is_same_v<decltype(1 / si::time<minute, int>()), frequency<scaled_unit<ratio<1, 6, -1>, hertz>, int>>);
static_assert(std::is_same_v<decltype(1 / frequency<hertz, int>()), si::time<second, int>>);
static_assert(std::is_same_v<decltype(1 / physical::si::time<second, int>()), frequency<hertz, int>>);
static_assert(std::is_same_v<decltype(1 / physical::si::time<minute, int>()), frequency<scaled_unit<ratio<1, 6, -1>, hertz>, int>>);
static_assert(std::is_same_v<decltype(1 / frequency<hertz, int>()), physical::si::time<second, int>>);
static_assert(std::is_same_v<decltype(1 / length<kilometre>()),
quantity<unknown_dimension<units::exp<dim_length, -1>>, scaled_unit<ratio<1, 1, -3>, unknown_coherent_unit>>>);
static_assert(std::is_same_v<decltype(length<metre, int>() / 1.0), length<metre, double>>);
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>() / si::time<second, int>()), velocity<metre_per_second, int>>);
std::is_same_v<decltype(length<metre, int>() / physical::si::time<second, int>()), velocity<metre_per_second, int>>);
static_assert(
std::is_same_v<decltype(length<metre>() / si::time<minute>()), velocity<scaled_unit<ratio<1, 6, -1>, metre_per_second>>>);
static_assert(std::is_same_v<decltype(si::time<minute>() / length<metre>()),
std::is_same_v<decltype(length<metre>() / physical::si::time<minute>()), velocity<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>>);
static_assert(std::is_same_v<decltype(length<metre, int>() % length<metre, short>(1)), length<metre, int>>);
+5 -5
View File
@@ -44,7 +44,7 @@
namespace {
using namespace units;
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));
@@ -59,7 +59,7 @@ static_assert(cgs::pressure<cgs::barye>(10) == si::pressure<si::pascal>(1));
namespace si_test {
using namespace units::si::literals;
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);
@@ -75,7 +75,7 @@ static_assert(cgs::pressure<cgs::barye>(10) == 1q_Pa);
namespace cgs_test {
using namespace units::cgs::literals;
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));
@@ -91,8 +91,8 @@ static_assert(10q_Ba == si::pressure<si::pascal>(1));
namespace both_test {
using namespace units::si::literals;
using namespace units::cgs::literals;
using namespace units::physical::si::literals;
using namespace units::physical::cgs::literals;
// static_assert(100q_cm == 1q_m); // ambiguous
// static_assert(1'000q_g == 1q_kg); // ambiguous
+1 -1
View File
@@ -26,7 +26,7 @@
namespace {
using namespace units;
using namespace units::si;
using namespace units::physical::si;
/* ************** BASE DIMENSIONS **************** */
+1
View File
@@ -26,6 +26,7 @@
namespace {
using namespace units;
using namespace units::physical;
struct metre : named_unit<metre, "m", si::prefix> {};
struct centimetre : prefixed_unit<centimetre, si::centi, metre> {};
+3 -3
View File
@@ -34,9 +34,9 @@
namespace {
using namespace units;
using namespace units::si;
using namespace units::us;
using namespace units::international;
using namespace units::physical::si;
using namespace units::physical::us;
using namespace units::physical::international;
/* ************** BASE DIMENSIONS **************** */