mirror of
https://github.com/mpusz/mp-units.git
synced 2025-08-03 20:34:26 +02:00
refactor: angle_test
refactored to V2
This commit is contained in:
@@ -34,8 +34,7 @@ cmake_minimum_required(VERSION 3.2)
|
||||
# )
|
||||
add_library(
|
||||
unit_tests_static
|
||||
dimension_test.cpp
|
||||
# angle_test.cpp
|
||||
angle_test.cpp
|
||||
# cgs_test.cpp
|
||||
chrono_test.cpp
|
||||
# concepts_test.cpp
|
||||
|
@@ -20,33 +20,19 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#include <mp_units/generic/angle.h>
|
||||
#include <mp_units/generic/solid_angle.h>
|
||||
#include <mp_units/systems/isq_angle/isq_angle.h>
|
||||
#include <numbers>
|
||||
|
||||
namespace {
|
||||
|
||||
// plane angle
|
||||
|
||||
using namespace mp_units::references;
|
||||
using namespace mp_units::literals;
|
||||
using namespace mp_units::angular::unit_symbols;
|
||||
|
||||
static_assert(360 * deg == 1 * rev);
|
||||
static_assert(400 * grad == 1 * rev);
|
||||
static_assert(std::numbers::pi * 2 * rad == 1. * rev);
|
||||
|
||||
static_assert(360_q_deg == 1_q_rev);
|
||||
static_assert(400_q_grad == 1_q_rev);
|
||||
static_assert(std::numbers::pi * value_cast<double>(2._q_rad) == value_cast<double>(1._q_rev));
|
||||
|
||||
static_assert(mp_units::aliases::deg<>(360.) == mp_units::aliases::rev<>(1.));
|
||||
static_assert(mp_units::aliases::deg<int>(360) == mp_units::aliases::rev<int>(1));
|
||||
static_assert(mp_units::aliases::grad<int>(400) == mp_units::aliases::rev<int>(1));
|
||||
static_assert(std::numbers::pi * mp_units::aliases::rad<>(2.) == mp_units::aliases::rev<>(1.));
|
||||
|
||||
// solid angle
|
||||
|
||||
static_assert(1_q_rad * 1_q_rad == 1_q_sr);
|
||||
static_assert(1_q_deg * 1_q_deg == 1_q_deg2);
|
||||
static_assert(1 * rad * (1 * rad) == 1 * sr);
|
||||
static_assert(1 * rad * (1 * rad) == 1 * rad2);
|
||||
static_assert(1 * deg * (1 * deg) == 1 * deg2);
|
||||
|
||||
} // namespace
|
||||
|
Reference in New Issue
Block a user