forked from mpusz/mp-units
added ASCII-only format output support
This commit is contained in:
committed by
Mateusz Pusz
parent
99c309ef19
commit
e9272ac108
@@ -29,6 +29,7 @@
|
||||
#include "units/physical/si/velocity.h"
|
||||
#include "units/physical/si/volume.h"
|
||||
#include "units/physical/si/surface_tension.h"
|
||||
#include "units/physical/si/resistance.h"
|
||||
#include "units/format.h"
|
||||
#include "units/math.h"
|
||||
#include <catch2/catch.hpp>
|
||||
@@ -706,7 +707,22 @@ TEST_CASE("format string with only %q should print quantity unit symbol only", "
|
||||
CHECK(fmt::format("{:%q}", 123q_km_per_h) == "km/h");
|
||||
}
|
||||
|
||||
TEST_CASE("%q an %Q can be put anywhere in a format string", "[text][fmt]")
|
||||
TEST_CASE("format string with only %q for unit with ASCII quantity unit symbol should print Unicode quantity unit symbol only", "[text][fmt]")
|
||||
{
|
||||
CHECK(fmt::format("{:%Q%q}", 123q_kR) == "123kΩ");
|
||||
}
|
||||
|
||||
TEST_CASE("format string with %Aq for unit with ASCII quantity unit symbol should print ASCII quantity unit symbol only", "[text][fmt]")
|
||||
{
|
||||
CHECK(fmt::format("{:%Q%Aq}", 123q_kR) == "123kohm");
|
||||
}
|
||||
|
||||
TEST_CASE("format string with %Aq for unit with no ASCII quantity unit symbol should print Unicode quantity unit symbol only", "[text][fmt]")
|
||||
{
|
||||
CHECK(fmt::format("{:%Aq}", 123q_km_per_h) == "km/h");
|
||||
}
|
||||
|
||||
TEST_CASE("%q and %Q can be put anywhere in a format string", "[text][fmt]")
|
||||
{
|
||||
SECTION("no space")
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user