refactor: angle_test refactored to V2

This commit is contained in:
Mateusz Pusz
2023-04-03 19:23:39 +02:00
parent 660e62c0a6
commit 42a73739eb
2 changed files with 6 additions and 21 deletions

View File

@@ -34,8 +34,7 @@ cmake_minimum_required(VERSION 3.2)
# ) # )
add_library( add_library(
unit_tests_static unit_tests_static
dimension_test.cpp angle_test.cpp
# angle_test.cpp
# cgs_test.cpp # cgs_test.cpp
chrono_test.cpp chrono_test.cpp
# concepts_test.cpp # concepts_test.cpp

View File

@@ -20,33 +20,19 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE. // SOFTWARE.
#include <mp_units/generic/angle.h> #include <mp_units/systems/isq_angle/isq_angle.h>
#include <mp_units/generic/solid_angle.h>
#include <numbers> #include <numbers>
namespace { namespace {
// plane angle using namespace mp_units::angular::unit_symbols;
using namespace mp_units::references;
using namespace mp_units::literals;
static_assert(360 * deg == 1 * rev); static_assert(360 * deg == 1 * rev);
static_assert(400 * grad == 1 * rev); static_assert(400 * grad == 1 * rev);
static_assert(std::numbers::pi * 2 * rad == 1. * rev); static_assert(std::numbers::pi * 2 * rad == 1. * rev);
static_assert(360_q_deg == 1_q_rev); static_assert(1 * rad * (1 * rad) == 1 * sr);
static_assert(400_q_grad == 1_q_rev); static_assert(1 * rad * (1 * rad) == 1 * rad2);
static_assert(std::numbers::pi * value_cast<double>(2._q_rad) == value_cast<double>(1._q_rev)); static_assert(1 * deg * (1 * deg) == 1 * deg2);
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);
} // namespace } // namespace