mirror of
https://github.com/mpusz/mp-units.git
synced 2025-08-04 20:54:28 +02:00
type_list_test enabled
This commit is contained in:
@@ -30,7 +30,7 @@ add_library(unit_tests_static
|
||||
# quantity_test.cpp
|
||||
ratio_test.cpp
|
||||
# si_test.cpp
|
||||
# type_list_test.cpp
|
||||
type_list_test.cpp
|
||||
unit_test.cpp
|
||||
)
|
||||
target_link_libraries(unit_tests_static
|
||||
|
@@ -21,7 +21,8 @@
|
||||
// SOFTWARE.
|
||||
|
||||
#include "units/bits/type_list.h"
|
||||
#include "units/dimension.h"
|
||||
#include "units/derived_dimension.h"
|
||||
#include "units/unit.h"
|
||||
#include <utility>
|
||||
|
||||
namespace {
|
||||
@@ -83,8 +84,10 @@ namespace {
|
||||
std::is_same_v<type_list_split_half<type_list<int, long, double, float>>::second_list, type_list<double, float>>);
|
||||
|
||||
// type_list_merge_sorted
|
||||
struct d0 : base_dimension<"d0", ""> {};
|
||||
struct d1 : base_dimension<"d1", ""> {};
|
||||
struct u0 : unit<u0> {};
|
||||
struct d0 : base_dimension<"d0", u0> {};
|
||||
struct u1 : unit<u1> {};
|
||||
struct d1 : base_dimension<"d1", u1> {};
|
||||
|
||||
static_assert(std::is_same_v<type_list_merge_sorted<type_list<exp<d0, 1>>, type_list<exp<d1, 1>>, exp_less>,
|
||||
type_list<exp<d0, 1>, exp<d1, 1>>>);
|
||||
@@ -96,8 +99,10 @@ namespace {
|
||||
template<TypeList List>
|
||||
using exp_sort = type_list_sort<List, exp_less>;
|
||||
|
||||
static_assert(std::is_same_v<exp_sort<dimension<exp<d0, 1>>>, dimension<exp<d0, 1>>>);
|
||||
static_assert(std::is_same_v<exp_sort<dimension<exp<d0, 1>, exp<d1, -1>>>, dimension<exp<d0, 1>, exp<d1, -1>>>);
|
||||
static_assert(std::is_same_v<exp_sort<dimension<exp<d1, 1>, exp<d0, -1>>>, dimension<exp<d0, -1>, exp<d1, 1>>>);
|
||||
static_assert(std::is_same_v<exp_sort<derived_dimension<exp<d0, 1>>>, derived_dimension<exp<d0, 1>>>);
|
||||
static_assert(
|
||||
std::is_same_v<exp_sort<derived_dimension<exp<d0, 1>, exp<d1, -1>>>, derived_dimension<exp<d0, 1>, exp<d1, -1>>>);
|
||||
static_assert(
|
||||
std::is_same_v<exp_sort<derived_dimension<exp<d1, 1>, exp<d0, -1>>>, derived_dimension<exp<d0, -1>, exp<d1, 1>>>);
|
||||
|
||||
} // namespace
|
||||
|
Reference in New Issue
Block a user