123456789101112131415161718192021 |
- #include "simple/support/math/abs.hpp"
- #include <cassert>
- #include <type_traits>
- using simple::support::abs;
- int main()
- {
- static_assert(std::is_same_v<decltype(abs(short{})), int>);
- constexpr auto x = abs(-1);
- static_assert(x == 1);
- static_assert(abs(x) == 1);
- assert(abs(-13) == 13);
- assert(abs(13) == 13);
- static_assert(noexcept(abs(0)));
- static_assert(noexcept(abs(0.0)));
- static_assert(abs(-0.0) == 0.0);
- return 0;
- }
|