Skip to content

Commit c13000e

Browse files
committed
Split tests to multiple files
1 parent 9b104a0 commit c13000e

File tree

6 files changed

+65
-56
lines changed

6 files changed

+65
-56
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#include "lax_v1/comparison.hpp"
2+
3+
#include "config.hpp"
4+
5+
static_assert(
6+
lax::value_of_v<lax::gt_m<lax::value_t<int, 2>, lax::value_t<int, 1>>>);
Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1 @@
1-
#include "lax_v1/comparison.hpp"
2-
#include "lax_v1/logical.hpp"
3-
#include "lax_v1/type.hpp"
4-
#include "lax_v1/type_traits.hpp"
5-
#include "lax_v1/value.hpp"
6-
7-
#include <type_traits>
8-
9-
namespace lax = lax_v1;
10-
11-
static_assert(std::is_same_v<lax::value_t<bool, true>::value_type, bool>);
12-
13-
static_assert(std::is_same_v<lax::value_t<char, 'x'>::value_type, char>);
14-
static_assert(std::is_same_v<lax::value_t<short, 101>::value_type, short>);
15-
static_assert(std::is_same_v<lax::value_t<int, 101>::value_type, int>);
16-
static_assert(
17-
std::is_same_v<lax::value_t<unsigned, 101u>::value_type, unsigned>);
18-
static_assert(std::is_same_v<lax::value_t<long, 101l>::value_type, long>);
19-
static_assert(std::is_same_v<lax::value_t<unsigned long, 101ul>::value_type,
20-
unsigned long>);
21-
static_assert(
22-
std::is_same_v<lax::value_t<unsigned long long, 101ull>::value_type,
23-
unsigned long long>);
24-
25-
static_assert(lax::value_of_v<lax::is_array_m<lax::type_t<int[2]>>>);
26-
27-
static_assert(lax::value_of_v<lax::not_m<lax::false_t>>);
28-
29-
static_assert(
30-
lax::value_of_v<lax::gt_m<lax::value_t<int, 2>, lax::value_t<int, 1>>>);
31-
32-
template <class Value>
33-
struct is_stored_plain_m
34-
: lax::or_m<
35-
lax::and_m<
36-
lax::is_pointer_m<Value>,
37-
lax::lte_m<lax::value_t<size_t, 2>,
38-
lax::alignment_of_m<lax::remove_pointer_m<Value>>>>,
39-
lax::and_m<lax::is_array_m<Value>,
40-
is_stored_plain_m<lax::remove_all_extents_m<Value>>>> {};
41-
42-
template <class Value>
43-
static inline constexpr bool is_stored_plain_v =
44-
lax::value_of_v<is_stored_plain_m<lax::type_t<Value>>>;
45-
46-
static_assert(!is_stored_plain_v<char>);
47-
static_assert(!is_stored_plain_v<char *>);
48-
static_assert(is_stored_plain_v<int *>);
49-
static_assert(is_stored_plain_v<int * [2]>);
50-
51-
static_assert(lax::value_of_v<lax::if_m<lax::and_m<>, lax::value_t<int, 1>,
52-
lax::value_t<int, 2>>> == 1);
53-
54-
static_assert(lax::value_of_v<lax::if_m<lax::or_m<>, lax::value_t<int, 1>,
55-
lax::value_t<int, 2>>> == 2);
56-
571
int main() { return 0; }

internals/testing/config.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#include "lax_v1/config.hpp"
2+
3+
namespace lax = lax_v1;

internals/testing/logical_test.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#include "lax_v1/logical.hpp"
2+
3+
#include "config.hpp"
4+
5+
static_assert(lax::value_of_v<lax::if_m<lax::and_m<>, lax::value_t<int, 1>,
6+
lax::value_t<int, 2>>> == 1);
7+
8+
static_assert(lax::value_of_v<lax::if_m<lax::or_m<>, lax::value_t<int, 1>,
9+
lax::value_t<int, 2>>> == 2);
10+
11+
static_assert(lax::value_of_v<lax::not_m<lax::false_t>>);
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#include "lax_v1/comparison.hpp"
2+
#include "lax_v1/logical.hpp"
3+
#include "lax_v1/type_traits.hpp"
4+
5+
#include "config.hpp"
6+
7+
static_assert(lax::value_of_v<lax::is_array_m<lax::type_t<int[2]>>>);
8+
9+
template <class Value>
10+
struct is_stored_plain_m
11+
: lax::or_m<
12+
lax::and_m<
13+
lax::is_pointer_m<Value>,
14+
lax::lte_m<lax::value_t<size_t, 2>,
15+
lax::alignment_of_m<lax::remove_pointer_m<Value>>>>,
16+
lax::and_m<lax::is_array_m<Value>,
17+
is_stored_plain_m<lax::remove_all_extents_m<Value>>>> {};
18+
19+
template <class Value>
20+
static inline constexpr bool is_stored_plain_v =
21+
lax::value_of_v<is_stored_plain_m<lax::type_t<Value>>>;
22+
23+
static_assert(!is_stored_plain_v<char>);
24+
static_assert(!is_stored_plain_v<char *>);
25+
static_assert(is_stored_plain_v<int *>);
26+
static_assert(is_stored_plain_v<int * [2]>);

internals/testing/value_test.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#include "lax_v1/value.hpp"
2+
3+
#include "config.hpp"
4+
5+
#include <type_traits>
6+
7+
static_assert(std::is_same_v<lax::value_t<bool, true>::value_type, bool>);
8+
9+
static_assert(std::is_same_v<lax::value_t<char, 'x'>::value_type, char>);
10+
static_assert(std::is_same_v<lax::value_t<short, 101>::value_type, short>);
11+
static_assert(std::is_same_v<lax::value_t<int, 101>::value_type, int>);
12+
static_assert(
13+
std::is_same_v<lax::value_t<unsigned, 101u>::value_type, unsigned>);
14+
static_assert(std::is_same_v<lax::value_t<long, 101l>::value_type, long>);
15+
static_assert(std::is_same_v<lax::value_t<unsigned long, 101ul>::value_type,
16+
unsigned long>);
17+
static_assert(
18+
std::is_same_v<lax::value_t<unsigned long long, 101ull>::value_type,
19+
unsigned long long>);

0 commit comments

Comments
 (0)