493 static_assert(std::is_same<std::decay_t<decltype(expected)>,
milliseconds>());
495 auto q = util::quantities::makeQuantity<milliseconds>(
"3.0 ms");
496 static_assert(std::is_same<std::decay_t<decltype(q)>,
milliseconds>());
499 BOOST_TEST(q.value() == expected.value(),
tol);
501 q = util::quantities::makeQuantity<milliseconds>(
" 3.0ms ");
502 BOOST_TEST(q.value() == expected.value(),
tol);
504 q = util::quantities::makeQuantity<milliseconds>(
"3ms");
505 BOOST_TEST(q.value() == expected.value(),
tol);
507 q = util::quantities::makeQuantity<milliseconds>(
"3000 us");
508 BOOST_TEST(q.value() == expected.value(),
tol);
510 q = util::quantities::makeQuantity<milliseconds>(
"0.03e+2 ms");
511 BOOST_TEST(q.value() == expected.value(),
tol);
513 q = util::quantities::makeQuantity<milliseconds>(
"+3ms");
514 BOOST_TEST(q.value() == expected.value(),
tol);
516 q = util::quantities::makeQuantity<milliseconds>(
"+3E-3s");
517 BOOST_TEST(q.value() == expected.value(),
tol);
519 q = util::quantities::makeQuantity<milliseconds>(
"3",
true);
520 BOOST_TEST(q.value() == expected.value(),
tol);
522 q = util::quantities::makeQuantity<milliseconds>(
"3.0",
true);
523 BOOST_TEST(q.value() == expected.value(),
tol);
525 q = util::quantities::makeQuantity<milliseconds>(
"30e-1",
true);
526 BOOST_TEST(q.value() == expected.value(),
tol);
528 BOOST_CHECK_THROW(util::quantities::makeQuantity<milliseconds>(
"3"),
531 BOOST_CHECK_THROW(util::quantities::makeQuantity<milliseconds>(
"3 kg"),
534 BOOST_CHECK_THROW(util::quantities::makeQuantity<milliseconds>(
"3 dumbs"),
537 BOOST_CHECK_THROW(util::quantities::makeQuantity<milliseconds>(
"three ms"),
540 BOOST_CHECK_THROW(util::quantities::makeQuantity<milliseconds>(
"3.zero ms"),
Literal constants for time quantities.
millisecond milliseconds
Alias for common language habits.
String representing a quantity has no unit.
String representing a quantity has an invalid number.