-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrandom_test.cpp
36 lines (36 loc) · 1.24 KB
/
random_test.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <boost/ut.hpp>// single header
// import boost.ut; // single module (C++20)
#include "tl/random.hpp"
#include "tl/algorithm.hpp"
#include <string_view>
int
main()
{
using namespace boost::ut::literals;
using namespace boost::ut::operators::terse;
using namespace boost::ut;
using namespace std::string_view_literals;
using namespace std::string_literals;
[[maybe_unused]] suite random = [] {
const auto check_type = []<tl::concepts::is_integral integralT>() {
const auto random_values = tl::random::iota<char, 10U>();
expect(tl::algorithm::any_of(random_values, [](const auto &value) -> bool {
return value != integralT{};
}));
};
const auto check_types = [&check_type]<tl::concepts::is_integral... integralT2>()
{
(check_type.template operator()<integralT2>(), ...);
};
"create random char array"_test = [&check_types] {
check_types.operator()<std::int8_t,
std::uint8_t,
std::int16_t,
std::uint16_t,
std::int32_t,
std::uint32_t,
std::int64_t,
std::uint64_t>();
};
};
}