Skip to content

Commit fea6c58

Browse files
committed
do not print permill as milli_scale "m"
1 parent aaf9451 commit fea6c58

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

common.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,7 @@ UNLIB_DEFINE_QUANTITY_LITERAL_TRAITS_SCALED (mega , ampere_hour , "MAh
445445
UNLIB_DEFINE_QUANTITY_LITERAL_TRAITS_SCALED (giga , ampere_hour , "GAh")
446446

447447
UNLIB_DEFINE_QUANTITY_LITERAL_TRAITS_NOSCALE( percent , "%" )
448+
UNLIB_DEFINE_QUANTITY_LITERAL_TRAITS_NOSCALE( permill , "" ) //"‰"
448449

449450
UNLIB_DEFINE_QUANTITY_LITERAL_TRAITS_NOSCALE( bar , "bar")
450451

test/test_common.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
namespace {
1212

13+
using unlib::literals::get_quantity_string;
14+
1315
template<typename D, typename F, typename S1, typename S2, typename T>
1416
bool is_near_equal(const unlib::quantity<D,S1,F,T> lhs, const unlib::quantity<D,S2,F,T> rhs) {
1517
using std::max;
@@ -58,8 +60,6 @@ TEST_CASE("common quantities") {
5860
}
5961
}
6062

61-
using unlib::literals::get_quantity_string;
62-
6363
SUBCASE("time") {
6464
const unlib::second<VT> s{ 1}; CHECK(get_quantity_string( s) == "s"); REQUIRE(s.get() == 1);
6565

@@ -756,6 +756,11 @@ TEST_CASE("common quantities") {
756756

757757
CHECK(std::is_same<unlib::percent<VT>::tag_type, unlib::no_tag>::value);
758758

759+
CHECK(get_quantity_string(unlib::scalar <VT,unlib::no_tag>{}) == "");
760+
CHECK(get_quantity_string(unlib::fraction<VT >{}) == "");
761+
CHECK(get_quantity_string(unlib::percent <VT >{}) == "%");
762+
CHECK(get_quantity_string(unlib::permill <VT >{}) == "");
763+
759764
using namespace unlib::literals;
760765

761766
const auto power = 1000._kW;

0 commit comments

Comments
 (0)