halcheck 1.0
Loading...
Searching...
No Matches
serialize.hpp
1#ifndef HALCHECK_TEST_SERIALIZE_HPP
2#define HALCHECK_TEST_SERIALIZE_HPP
3
4#include <halcheck/lib/effect.hpp>
5#include <halcheck/lib/string.hpp>
6#include <halcheck/lib/type_traits.hpp>
7#include <halcheck/lib/utility.hpp>
8#include <halcheck/test/strategy.hpp>
9
10#include <string>
11#include <type_traits>
12
13namespace halcheck { namespace test {
14
15struct write_effect {
16 std::string key;
17 std::string value;
18 void fallback() const {}
19};
20
21template<typename T, HALCHECK_REQUIRE(!std::is_convertible<T, std::string>())>
22void write(std::string key, const T &value) {
24}
25
26inline void write(std::string key, std::string value) {
27 lib::effect::invoke<write_effect>(std::move(key), std::move(value));
28}
29
30test::strategy serialize(std::string name);
31
32}} // namespace halcheck::test
33
34#endif
static lib::effect_result_t< T > invoke(T args)
Invokes an effect.
Definition effect.hpp:118
std::string to_string(const T &value)
Converts a value to a std::string using operator<<.
Definition string.hpp:28