Fixed text formatting for current density in unit test

This commit is contained in:
rbrugo
2020-04-07 04:20:17 +02:00
committed by Mateusz Pusz
parent e6b34b6b1b
commit 15833669d8
3 changed files with 5 additions and 5 deletions

View File

@@ -131,8 +131,8 @@ struct dim_catalytic_activity : derived_dimension<Child, U, exp<T, -1>, exp<M, 1
template<typename Child, Unit U, DimensionOf<dim_energy> E, DimensionOf<dim_mass> M>
struct dim_absorbed_dose : derived_dimension<Child, U, exp<E, 1>, exp<M, -1>> {};
template<typename Child, Unit U, DimensionOf<dim_electric_current> I, DimensionOf<dim_area> A>
struct dim_current_density : derived_dimension<Child, U, exp<I, 1>, exp<A, -1>> {};
template<typename Child, Unit U, DimensionOf<dim_electric_current> I, DimensionOf<dim_length> L>
struct dim_current_density : derived_dimension<Child, U, exp<I, 1>, exp<L, -2>> {};
} // namespace physical

View File

@@ -24,7 +24,7 @@
#include <units/physical/dimensions.h>
#include <units/physical/si/current.h>
#include <units/physical/si/area.h>
#include <units/physical/si/length.h>
#include <units/physical/si/prefixes.h>
#include <units/quantity.h>
@@ -32,7 +32,7 @@ namespace units::si {
struct ampere_per_metre_sq : unit<ampere_per_metre_sq> {};
struct dim_current_density : physical::dim_current_density<dim_current_density, ampere_per_metre_sq, dim_electric_current, dim_area> {};
struct dim_current_density : physical::dim_current_density<dim_current_density, ampere_per_metre_sq, dim_electric_current, dim_length> {};
template<Unit U, Scalar Rep = double>
using current_density = quantity<dim_current_density, U, Rep>;

View File

@@ -236,7 +236,7 @@ TEST_CASE("fmt::format on synthesized unit symbols", "[text][fmt]")
SECTION("current density")
{
CHECK(fmt::format("{}", 1q_A_per_m2) == "1 A/m²");
CHECK(fmt::format("{:%q %AQ}", 1q_A_per_m2) == "1 A/m^2");
CHECK(fmt::format("{:%Q %Aq}", 1q_A_per_m2) == "1 A/m^2");
}
SECTION("incoherent units with powers")