forked from mpusz/mp-units
Tests for #58 added (uncomment when fixed)
This commit is contained in:
@@ -202,8 +202,8 @@ static constexpr std::intmax_t sqrt_impl(std::intmax_t v) { return sqrt_impl(v,
|
|||||||
|
|
||||||
template<typename R>
|
template<typename R>
|
||||||
struct ratio_sqrt_impl {
|
struct ratio_sqrt_impl {
|
||||||
// TODO this is broken..need /2 logic on EXP
|
// TODO(#58) Provide sqrt on exp
|
||||||
using type = ratio<detail::sqrt_impl(R::num), detail::sqrt_impl(R::den)>;
|
using type = ratio<detail::sqrt_impl(R::num), detail::sqrt_impl(R::den) /* , exp */>;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<std::intmax_t Den>
|
template<std::intmax_t Den>
|
||||||
|
@@ -21,15 +21,22 @@
|
|||||||
// SOFTWARE.
|
// SOFTWARE.
|
||||||
|
|
||||||
#include "units/physical/si/area.h"
|
#include "units/physical/si/area.h"
|
||||||
|
#include "units/physical/si/velocity.h"
|
||||||
|
#include "units/physical/international/area.h"
|
||||||
#include "units/math.h"
|
#include "units/math.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
using namespace units::si::literals;
|
using namespace units::si::literals;
|
||||||
|
using namespace units::international::literals;
|
||||||
|
|
||||||
static_assert(std::is_same_v<decltype(pow<0>(2m)), std::int64_t>);
|
static_assert(std::is_same_v<decltype(pow<0>(2m)), std::int64_t>);
|
||||||
static_assert(std::is_same_v<decltype(pow<1>(2m)), decltype(2m)>);
|
static_assert(std::is_same_v<decltype(pow<1>(2m)), decltype(2m)>);
|
||||||
static_assert(std::is_same_v<decltype(pow<2>(2m)), decltype(4m2)>);
|
static_assert(std::is_same_v<decltype(pow<2>(2m)), decltype(4m2)>);
|
||||||
|
static_assert(std::is_same_v<decltype(pow<2>(2km)), decltype(4km2)>);
|
||||||
|
static_assert(std::is_same_v<decltype(pow<2>(2ft)), decltype(4ft2)>);
|
||||||
static_assert(std::is_same_v<decltype(sqrt(4m2)), decltype(2m)>);
|
static_assert(std::is_same_v<decltype(sqrt(4m2)), decltype(2m)>);
|
||||||
|
// static_assert(std::is_same_v<decltype(sqrt(4km2)), decltype(2km)>);
|
||||||
|
// static_assert(std::is_same_v<decltype(sqrt(4ft2)), decltype(2ft)>);
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
Reference in New Issue
Block a user