halcheck 1.0
Loading...
Searching...
No Matches
config.hpp
1#ifndef HALCHECK_TEST_CONFIG_HPP
2#define HALCHECK_TEST_CONFIG_HPP
3
4#include <halcheck/lib/string.hpp>
5#include <halcheck/lib/type_traits.hpp>
6#include <halcheck/test/strategy.hpp>
7
8#include <initializer_list>
9#include <string>
10#include <type_traits>
11#include <utility>
12
13namespace halcheck { namespace test {
14
15struct set {
16 template<typename T>
17 set(std::string key, const T &value, bool weak = false)
18 : key(std::move(key)), value(lib::to_string(value)), weak(weak) {}
19
20 std::string key;
21 std::string value;
22 bool weak;
23};
24
25test::strategy config(const std::initializer_list<test::set> &);
26
27template<typename... Args, HALCHECK_REQUIRE(lib::conjunction<std::is_convertible<Args, test::set>...>())>
28test::strategy config(Args &&...args) {
29 return test::config({test::set(std::forward<Args>(args))...});
30}
31
32}} // namespace halcheck::test
33
34#endif
T forward(T... args)
#define HALCHECK_REQUIRE(...)
Expands to a template argument that is only valid if the given argument evaluates to true.
Definition type_traits.hpp:24
STL namespace.
T to_string(T... args)