22 #include "container.hpp"
25 #ifndef _PASL_DATA_TEST_PRELIMS_H_
26 #define _PASL_DATA_TEST_PRELIMS_H_
41 std::ostream& operator<<(std::ostream& out, const std::map<Key, T, Compare, Alloc>& xs);
48 std::ostream& operator<<(std::ostream& out, const map::map<Key, Item, Compare, Key_swap, Alloc>& xs);
51 std::ostream& operator<<(std::ostream& out, const pasl::data::stl::deque_seq<Item>& seq);
56 static bool same(
const T& x,
const T& y) {
64 static bool same(
const T& x,
const T& y) {
67 std::sort(xx.begin(), xx.end());
68 std::sort(yy.begin(), yy.end());
75 class Trusted_container,
class Untrusted_container,
76 class Untrusted_to_trusted,
77 class Trusted_same=default_container_same<Trusted_container>
96 : trusted(other.trusted), untrusted(other.untrusted) {
98 std::cout << trusted << std::endl;
99 std::cout << Untrusted_to_trusted::conv(untrusted) << std::endl;
104 static bool same(
const Trusted_container& t,
const Untrusted_container& u) {
105 return Trusted_same::same(t, Untrusted_to_trusted::conv(u));
109 bool size_same1 = trusted.size() == untrusted.size();
110 bool size_same2 = trusted.size() == Untrusted_to_trusted::conv(untrusted).size();
111 bool same1 =
same(trusted, untrusted);
118 assert(untrusted.empty());
119 if (untrusted.empty())
120 assert(trusted.empty());
129 static inline void print_dashes() {
130 static constexpr
int nb_dashes = 30;
131 for (
int i = 0; i < nb_dashes; i++)
133 std::cout << std::endl;
136 template <
class Item>
137 std::ostream& operator<<(std::ostream& out, const pasl::data::stl::deque_seq<Item>& seq) {
141 template <
class Item>
142 std::ostream& operator<<(std::ostream& out, const std::vector<Item>& seq) {
144 size_t sz = seq.size();
145 for (
auto it = seq.begin(); it != seq.end(); it++,sz--) {
154 template <
class Item,
int Chunk_capacity>
155 std::ostream& operator<<(std::ostream& out, const chunkedseq::bootchunkedseq::triv<Item, Chunk_capacity>& seq) {
159 template <
class Key,
164 std::ostream& operator<<(std::ostream& out, const std::map<Key, T, Compare, Alloc>& xs) {
166 size_t sz = xs.size();
167 for (
auto it = xs.begin(); it != xs.end(); it++, sz--) {
169 out <<
"(" << v.first <<
"," << v.second <<
")";
181 std::ostream& operator<<(std::ostream& out, const map::map<Key, Item, Compare, Key_swap, Alloc>& xs) {
182 return xs.stream(out);
185 template <
class T,
class U,
class C,
class S>
186 std::ostream& operator<<(std::ostream& out, const container_pair<T, U, C, S>& cp) {
188 out <<
"trusted (sz= " << cp.trusted.size() <<
"):" << std::endl;
189 out << cp.trusted << std::endl;
190 out <<
"untrusted (sz= " << cp.untrusted.size() <<
"):" << std::endl;
191 out << C::conv(cp.untrusted) << std::endl;
192 out << C::conv(cp.untrusted).size() << std::endl;
197 template <
class T,
class U,
class C,
class S>
202 std::cout <<
"check on " << msg <<
" failed with:" << std::endl;
203 std::cout << cp << std::endl;
211 template <
class T,
class U,
class C,
class S>
212 void generate(
size_t& nb, container_pair<T, U, C, S>& dst);
Trivial instantiation of bootstrapped chunked sequence.
Untrusted_container untrusted_container_type
static bool same(const Trusted_container &t, const Untrusted_container &u)
trusted_container_type trusted
container_pair(const self_type &other)
STL-style map data structure.
Trusted_same trusted_same
static bool same(const T &x, const T &y)
untrusted_container_type untrusted
Trusted_container trusted_container_type
static bool same(const T &x, const T &y)
bool print_chunkedseq_verbose
bool check_and_print_container_pair(const container_pair< T, U, C, S > &cp, std::string msg="")
void generate(size_t &nb, container_pair< pasl::data::stl::deque_seq< Item >, U, C, S > &dst)
Chunked-sequence functor.