13 #include "cmdline.hpp"
23 static constexpr
int default_capacity = 8;
29 template <
class Property>
32 quickcheck::check<Property>(msg.c_str(),
nb_tests);
38 template <
class Properties>
40 util::cmdline::argmap_dispatch c;
42 auto msg =
"we get consistent results on randomly selected "
43 "sequences of pushes and pops";
44 checkit<typename Properties::push_pop_sequence_same>(msg);
47 auto msg =
"we get consistent results for calls to split on a "
48 "random position in the sequence";
49 checkit<typename Properties::split_same>(msg);
51 c.add(
"split_in_range", [] {
52 auto msg =
"we get consistent results for calls to split on "
53 "a range of valid positions";
54 checkit<typename Properties::split_in_range_same>(msg);
57 auto msg =
"we get consistent results on calls to concat";
58 checkit<typename Properties::concat_same>(msg);
60 c.add(
"random_access", [] {
61 auto msg =
"we get consistent results on random accesses to the "
63 checkit<typename Properties::random_access_same>(msg);
65 c.add(
"iterator", [] {
66 auto msg =
"we get consistent results on iterator-based traversal";
67 checkit<typename Properties::iterator_same>(msg);
69 c.add(
"random_access_iterator", [] {
70 auto msg =
"we get consistent results on random iterator-based traversal";
71 checkit<typename Properties::random_access_iterator_same>(msg);
74 auto msg =
"we get consistent results over calls to insert";
75 checkit<typename Properties::insert_same>(msg);
78 auto msg =
"we get consistent results over calls to erase";
79 checkit<typename Properties::erase_same>(msg);
81 c.add(
"for_each_segment", [] {
82 auto msg =
"we get correct results over calls to for_each_segment";
83 checkit<typename Properties::for_each_segment_correct>(msg);
85 c.add(
"for_each_in_interval", [] {
86 auto msg =
"we get correct results over calls to for_each_segment on random intervals";
87 checkit<typename Properties::for_each_in_interval_correct>(msg);
89 c.add(
"pushn_popn", [] {
90 auto msg =
"we get correct results over calls to pushn and to popn";
91 checkit<typename Properties::pushn_popn_sequence_same>(msg);
93 c.add(
"backn_frontn", [] {
94 auto msg =
"we get correct results over calls to backn and frontn";
95 checkit<typename Properties::backn_frontn_sequence_same>(msg);
98 util::cmdline::dispatch_by_argmap_with_default_all(c,
"property");
105 template <
class Untrusted_container>
106 class container_copy_from_untrusted_to_trusted {
116 template <
class Untrusted_sequence_container>
118 template <
class Untrusted_sequence_container>
121 template <
int Chunk_capacity>
123 util::cmdline::argmap_dispatch c;
124 c.add(
"chunked_bootstrapped_deque", [] {
126 chunkedseq_dispatch_by_property<sequence_container_properties<deque_type>>();
128 #ifndef SKIP_NON_DEQUE
129 c.add(
"chunked_bootstrapped_stack", [] {
131 chunkedseq_dispatch_by_property<sequence_container_properties<deque_type>>();
133 c.add(
"chunked_ftree_deque", [] {
135 chunkedseq_dispatch_by_property<sequence_container_properties<deque_type>>();
137 c.add(
"chunked_ftree_stack", [] {
139 chunkedseq_dispatch_by_property<sequence_container_properties<deque_type>>();
148 util::cmdline::dispatch_by_argmap_with_default_all(c,
"datastruct");
152 util::cmdline::argmap_dispatch c;
153 c.add(
"2", [] { seq_dispatch_by_container<2>(); });
154 c.add(
"8", [] { seq_dispatch_by_container<8>(); });
155 c.add(
"512", [] { seq_dispatch_by_container<512>(); });
156 util::cmdline::dispatch_by_argmap(c,
"chunk_capacity", std::to_string(default_capacity));
162 template <
class Properties>
164 util::cmdline::argmap_dispatch c;
165 c.add(
"pushpop", [] {
166 auto msg =
"we get consistent results on randomly selected "
167 "sequences of pushes and pops";
168 checkit<typename Properties::push_pop_sequence_same>(msg);
171 auto msg =
"we get consistent results for calls to split on a "
172 "random position in the sequence";
173 checkit<typename Properties::split_same>(msg);
176 auto msg =
"we get consistent results on calls to concat";
177 checkit<typename Properties::concat_same>(msg);
179 c.add(
"iterator", [] {
180 auto msg =
"we get consistent results on iterator-based traversal";
181 checkit<typename Properties::iterator_same>(msg);
183 c.add(
"for_each_segment", [] {
184 auto msg =
"we get correct results over calls to for_each_segment";
185 checkit<typename Properties::for_each_segment_correct>(msg);
187 c.add(
"pushn_popn", [] {
188 auto msg =
"we get correct results over calls to pushn and to popn";
189 checkit<typename Properties::pushn_popn_sequence_same>(msg);
191 c.add(
"backn_frontn", [] {
192 auto msg =
"we get correct results over calls to backn and frontn";
193 checkit<typename Properties::backn_frontn_sequence_same>(msg);
196 util::cmdline::dispatch_by_argmap_with_default_all(c,
"property");
200 template <
class Untrusted_bag_container>
202 template <
class Untrusted_bag_container>
205 template <
int Chunk_capacity>
207 util::cmdline::argmap_dispatch c;
208 c.add(
"chunked_bootstrapped", [] {
210 chunkedbag_dispatch_by_property<bag_container_properties<bag_type>>();
212 #ifndef SKIP_NON_DEQUE
213 c.add(
"chunked_ftree_bag", [] {
215 chunkedbag_dispatch_by_property<bag_container_properties<deque_type>>();
218 util::cmdline::dispatch_by_argmap_with_default_all(c,
"datastruct");
222 util::cmdline::argmap_dispatch c;
223 c.add(
"2", [] { bag_dispatch_by_container<2>(); });
224 c.add(
"8", [] { bag_dispatch_by_container<8>(); });
225 c.add(
"512", [] { bag_dispatch_by_container<512>(); });
226 util::cmdline::dispatch_by_argmap(c,
"chunk_capacity", std::to_string(default_capacity));
234 class map_copy_from_untrusted_to_trusted {
238 for (
auto it = u.
begin(); it != u.
end(); it++) {
240 t[p.first] = p.second;
249 auto msg =
"we get consistent results with std::map";
250 checkit<typename map_properties::map_same>(msg);
258 int main(
int argc,
char** argv) {
259 pasl::util::cmdline::set(argc, argv);
263 pasl::util::cmdline::argmap_dispatch c;
267 pasl::util::cmdline::dispatch_by_argmap(c,
"profile",
"sequence");
void bag_dispatch_by_capacity()
void chunkedbag_dispatch_by_property()
Testing properties to be used by randomize unit testing to check invariants.
void seq_dispatch_by_capacity()
int main(int argc, char **argv)
trusted_sequence_container_type trusted_bag_container_type
pasl::data::stl::deque_seq< value_type > trusted_sequence_container_type
void chunkedseq_dispatch_by_property()
void seq_dispatch_by_container()
void checkit(std::string msg)
void bag_dispatch_by_container()
bool print_chunkedseq_verbose
std::map< int, int > trusted_map_type