Commit 55a4c999 by Benjamin Kosnik Committed by Benjamin Kosnik

trait.hpp: Format.

2006-07-06  Benjamin Kosnik  <bkoz@redhat.com>

	* testsuite/util/regression/trait/assoc/trait.hpp: Format.
	* testsuite/util/regression/rand/priority_queue/
	rand_regression_test.hpp: Same.
	* testsuite/util/regression/rand/assoc/rand_regression_test.hpp: Same.
	* testsuite/util/regression/rand/
	assoc/container_rand_regression_test.hpp: Same.
	* testsuite/util/regression/priority_queue/common_type.hpp: Same.
	* testsuite/util/regression/assoc/common_type.hpp: Same.
	* testsuite/util/regression/basic_type.hpp: Same.

From-SVN: r115226
parent cec12c7a
2006-07-06 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/util/regression/trait/assoc/trait.hpp: Format.
* testsuite/util/regression/rand/priority_queue/
rand_regression_test.hpp: Same.
* testsuite/util/regression/rand/assoc/rand_regression_test.hpp: Same.
* testsuite/util/regression/rand/
assoc/container_rand_regression_test.hpp: Same.
* testsuite/util/regression/priority_queue/common_type.hpp: Same.
* testsuite/util/regression/assoc/common_type.hpp: Same.
* testsuite/util/regression/basic_type.hpp: Same.
2006-07-05 Benjamin Kosnik <bkoz@redhat.com>
* include/Makefile.am (pch_output): New.
......
......@@ -52,74 +52,37 @@
namespace pb_ds
{
namespace test
{
typedef
pb_ds::test::dbg_ex_allocator<
pb_ds::test::basic_type>
alloc_type;
namespace test
{
typedef dbg_ex_allocator<basic_type> alloc_type;
struct hash
{
typedef
alloc_type::rebind<
pb_ds::test::basic_type>::other::const_reference
const_key_reference;
typedef alloc_type::rebind<basic_type>::other::const_reference const_key_reference;
size_t
operator()(const_key_reference r_key) const
{
size_t ret = 0;
for (pb_ds::test::basic_type::const_iterator it = r_key.begin(); it != r_key.end(); ++it)
ret = ret* 5 + static_cast<size_t>(*it);
return (ret);
typedef basic_type::const_iterator const_iterator;
for (const_iterator it = r_key.begin(); it != r_key.end(); ++it)
ret = ret * 5 + static_cast<size_t>(*it);
return ret;
}
};
typedef
pb_ds::string_trie_e_access_traits<
basic_type,
'a',
'a' + basic_type::distinct_chars - 1,
false,
alloc_type>
e_access_traits_t;
typedef pb_ds::string_trie_e_access_traits<basic_type, 'a', 'a' + basic_type::distinct_chars - 1, false, alloc_type> e_access_traits_t;
template<typename Data_Type>
struct tree_types
{
private:
typedef
typename pb_ds::test::tree_common_types<
pb_ds::test::basic_type,
Data_Type,
std::less<
pb_ds::test::basic_type>,
pb_ds::null_tree_node_update,
alloc_type>::regression_tl
no_order_statistics_tl_t;
typedef typename tree_common_types<basic_type, Data_Type, std::less<basic_type>, pb_ds::null_tree_node_update, alloc_type>::regression_tl no_order_statistics_tl_t;
typedef
typename pb_ds::test::tree_common_types<
pb_ds::test::basic_type,
Data_Type,
std::less<
pb_ds::test::basic_type>,
pb_ds::tree_order_statistics_node_update,
alloc_type>::regression_tl
order_statistics_tl_t;
typedef typename tree_common_types<basic_type, Data_Type, std::less<basic_type>, pb_ds::tree_order_statistics_node_update, alloc_type>::regression_tl order_statistics_tl_t;
public:
typedef
typename pb_ds::detail::typelist_append<
no_order_statistics_tl_t,
order_statistics_tl_t>::type
tl_t;
typedef typename pb_ds::detail::typelist_append<no_order_statistics_tl_t, order_statistics_tl_t>::type tl_t;
typedef no_order_statistics_tl_t min_tl_t;
};
......@@ -128,44 +91,14 @@ namespace pb_ds
struct trie_types
{
private:
typedef
typename pb_ds::test::trie_common_types<
pb_ds::test::basic_type,
Data_Type,
e_access_traits_t,
pb_ds::pat_trie_tag,
pb_ds::null_trie_node_update,
alloc_type>::regression_tl
no_updates_tl_t;
typedef typename trie_common_types<basic_type, Data_Type, e_access_traits_t, pb_ds::pat_trie_tag, pb_ds::null_trie_node_update, alloc_type>::regression_tl no_updates_tl_t;
typedef
typename pb_ds::test::trie_common_types<
pb_ds::test::basic_type,
Data_Type,
e_access_traits_t,
pb_ds::pat_trie_tag,
pb_ds::trie_order_statistics_node_update,
alloc_type>::regression_tl
order_statistics_tl_t;
typedef typename trie_common_types<basic_type, Data_Type, e_access_traits_t, pb_ds::pat_trie_tag, pb_ds::trie_order_statistics_node_update, alloc_type>::regression_tl order_statistics_tl_t;
typedef
typename pb_ds::test::trie_common_types<
pb_ds::test::basic_type,
Data_Type,
e_access_traits_t,
pb_ds::pat_trie_tag,
pb_ds::trie_prefix_search_node_update,
alloc_type>::regression_tl
prefix_search_tl_t;
typedef typename trie_common_types<basic_type, Data_Type, e_access_traits_t, pb_ds::pat_trie_tag, pb_ds::trie_prefix_search_node_update, alloc_type>::regression_tl prefix_search_tl_t;
public:
typedef
typename pb_ds::detail::typelist_append<
no_updates_tl_t,
typename pb_ds::detail::typelist_append<
prefix_search_tl_t,
order_statistics_tl_t>::type>::type
tl_t;
typedef typename pb_ds::detail::typelist_append<no_updates_tl_t, typename pb_ds::detail::typelist_append<prefix_search_tl_t, order_statistics_tl_t>::type>::type tl_t;
typedef no_updates_tl_t min_tl_t;
};
......@@ -173,15 +106,7 @@ namespace pb_ds
template<typename Data_Type>
struct hash_types
{
typedef
typename pb_ds::test::hash_common_types<
pb_ds::test::basic_type,
Data_Type,
hash,
std::equal_to<
pb_ds::test::basic_type>,
alloc_type>::regression_tl
tl_t;
typedef typename hash_common_types<basic_type, Data_Type, hash, std::equal_to<basic_type>, alloc_type>::regression_tl tl_t;
typedef tl_t min_tl_t;
};
......@@ -189,73 +114,31 @@ namespace pb_ds
template<typename Data_Type>
struct lu_types
{
typedef
typename pb_ds::test::lu_common_types<
pb_ds::test::basic_type,
Data_Type,
std::equal_to<
pb_ds::test::basic_type>,
alloc_type>::regression_tl
tl_t;
typedef typename lu_common_types<basic_type, Data_Type, std::equal_to<basic_type>, alloc_type>::regression_tl tl_t;
typedef tl_t min_tl_t;
};
typedef
tree_types<
pb_ds::null_mapped_type>::tl_t
tree_set_tl_t;
typedef
tree_types<
pb_ds::null_mapped_type>::min_tl_t
min_tree_set_tl_t;
typedef
hash_types<
pb_ds::null_mapped_type>::tl_t
hash_set_tl_t;
typedef
hash_types<
pb_ds::null_mapped_type>::min_tl_t
min_hash_set_tl_t;
typedef lu_types< pb_ds::null_mapped_type>::tl_t lu_set_tl_t;
typedef
lu_types<
pb_ds::null_mapped_type>::min_tl_t
min_lu_set_tl_t;
typedef
trie_types<
pb_ds::null_mapped_type>::tl_t
trie_set_tl_t;
typedef
trie_types<
pb_ds::null_mapped_type>::min_tl_t
min_trie_set_tl_t;
typedef tree_types< basic_type>::tl_t tree_map_tl_t;
typedef tree_types< basic_type>::min_tl_t min_tree_map_tl_t;
typedef hash_types< basic_type>::tl_t hash_map_tl_t;
typedef hash_types< basic_type>::min_tl_t min_hash_map_tl_t;
typedef lu_types< basic_type>::tl_t lu_map_tl_t;
typedef lu_types< basic_type>::min_tl_t min_lu_map_tl_t;
typedef trie_types< basic_type>::tl_t trie_map_tl_t;
typedef trie_types< basic_type>::min_tl_t min_trie_map_tl_t;
} // namespace test
typedef tree_types<null_mapped_type>::tl_t tree_set_tl_t;
typedef tree_types<null_mapped_type>::min_tl_t min_tree_set_tl_t;
typedef tree_types<basic_type>::tl_t tree_map_tl_t;
typedef tree_types<basic_type>::min_tl_t min_tree_map_tl_t;
typedef hash_types<null_mapped_type>::tl_t hash_set_tl_t;
typedef hash_types<null_mapped_type>::min_tl_t min_hash_set_tl_t;
typedef hash_types<basic_type>::tl_t hash_map_tl_t;
typedef hash_types<basic_type>::min_tl_t min_hash_map_tl_t;
typedef lu_types<null_mapped_type>::tl_t lu_set_tl_t;
typedef lu_types<null_mapped_type>::min_tl_t min_lu_set_tl_t;
typedef lu_types<basic_type>::tl_t lu_map_tl_t;
typedef lu_types<basic_type>::min_tl_t min_lu_map_tl_t;
typedef trie_types<null_mapped_type>::tl_t trie_set_tl_t;
typedef trie_types<null_mapped_type>::min_tl_t min_trie_set_tl_t;
typedef trie_types<basic_type>::tl_t trie_map_tl_t;
typedef trie_types<basic_type>::min_tl_t min_trie_map_tl_t;
} // namespace test
} // namespace pb_ds
#endif // #ifndef PB_DS_RAND_REGRESSION_TEST_COMMON_TYPE_HPP
......@@ -52,41 +52,31 @@
namespace pb_ds
{
namespace test
{
namespace test
{
#define PB_DS_BASE_C_DEC \
std::basic_string< \
char, \
std::char_traits< \
char>, \
dbg_ex_allocator< \
char> >
std::basic_string<char, std::char_traits<char>, dbg_ex_allocator<char> >
struct basic_type : public PB_DS_BASE_C_DEC
{
private:
typedef PB_DS_BASE_C_DEC base_type;
public:
enum
{
distinct_chars = 4
};
public:
basic_type()
{ }
basic_type() { }
template<typename Gen>
basic_type(Gen& r_gen, size_t max)
{
size_t rnd =
r_gen.get_unsigned_long(0, static_cast<unsigned long>(max));
size_t rnd = r_gen.get_unsigned_long(0, static_cast<unsigned long>(max));
while (rnd > 0)
{
PB_DS_BASE_C_DEC::push_back('a' +
static_cast<char>(rnd % distinct_chars));
base_type::push_back('a' + static_cast<char>(rnd % distinct_chars));
rnd /= distinct_chars;
}
}
......@@ -94,25 +84,20 @@ namespace pb_ds
basic_type(const std::string other)
{
std::string::const_iterator it = other.begin();
while (it != other.end())
{
PB_DS_BASE_C_DEC::push_back(*it);
base_type::push_back(*it);
++it;
}
}
operator std::string() const
{
return (std::string(PB_DS_BASE_C_DEC::c_str()));
}
{ return std::string(base_type::c_str());}
};
#undef PB_DS_BASE_C_DEC
} // namespace test
} // namespace test
} // namespace pb_ds
#endif // #ifndef PB_DS_BASIC_TYPE_HPP
......@@ -52,27 +52,14 @@
namespace pb_ds
{
namespace test
{
typedef dbg_ex_allocator<basic_type> alloc_type;
namespace test
{
typedef
pb_ds::test::dbg_ex_allocator<
pb_ds::test::basic_type>
alloc_type;
typedef
pb_ds::test::pq_common_types<
pb_ds::test::basic_type,
std::less<
pb_ds::test::basic_type>,
alloc_type>::regression_tl
pq_tl_t;
typedef pq_common_types<basic_type, std::less<basic_type>, alloc_type>::regression_tl pq_tl_t;
typedef pq_tl_t min_pq_tl_t;
} // namespace test
} // namespace test
} // namespace pb_ds
#endif // #ifndef PB_DS_RAND_REGRESSION_TEST_COMMON_TYPE_HPP
#endif
......@@ -60,25 +60,22 @@
namespace pb_ds
{
namespace test
{
namespace detail
{
namespace test
{
namespace detail
{
#ifdef PB_DS_REGRESSION_TRACE
#define PB_DS_TRACE(X) std::cerr << X << std::endl
#else // #ifdef PB_DS_REGRESSION_TRACE
#else
#define PB_DS_TRACE(X)
#endif // #ifdef PB_DS_REGRESSION_TRACE
#endif
#define PB_DS_CLASS_T_DEC \
template<typename Cntnr>
#define PB_DS_CLASS_C_DEC \
container_rand_regression_test< \
Cntnr>
container_rand_regression_test<Cntnr>
#define PB_DS_COND_COMPARE(L, R) \
if (m_g.get_prob() < m_mp) \
......@@ -96,19 +93,13 @@ namespace pb_ds
if (!(PRED)) \
{ \
std::cerr << "Failure at " << F << ": " << L << std::endl; \
\
std::cerr << MORE << std::endl; \
\
std::cerr << "container:" << std::endl; \
\
print_container(*(P_C)); \
std::cerr << std::endl; \
\
std::cerr << "native container:" << std::endl; \
\
print_container(*(P_NC)); \
std::cerr << std::endl; \
\
throw std::logic_error("fucked!"); \
}
......@@ -125,10 +116,10 @@ namespace pb_ds
template<typename Cntnr>
class container_rand_regression_test
{
public:
container_rand_regression_test(unsigned long seed, size_t n, size_t m, double tp, double ip, double ep, double cp, double mp, bool disp);
container_rand_regression_test(unsigned long, size_t, size_t, double,
double, double, double, double, bool);
virtual
~container_rand_regression_test();
......@@ -145,9 +136,9 @@ namespace pb_ds
typedef twister_rand_gen gen;
typedef regression_test_traits< Cntnr> test_traits;
typedef regression_test_traits<Cntnr> test_traits;
typedef pb_ds::container_traits< Cntnr> container_traits;
typedef pb_ds::container_traits<Cntnr> container_traits;
typedef typename test_traits::key_type key_type;
......@@ -165,7 +156,7 @@ namespace pb_ds
other_op
};
typedef dbg_ex_allocator< char> alloc_t;
typedef dbg_ex_allocator<char> alloc_t;
private:
......@@ -173,7 +164,7 @@ namespace pb_ds
get_next_op();
size_t
get_next_sub_op(size_t max);
get_next_sub_op(size_t);
static void
defs();
......@@ -371,96 +362,105 @@ namespace pb_ds
split_join_imp(pb_ds::detail::true_type);
void
cmp(const Cntnr& r_container, const native_type& r_native_c, const std::string& r_call_fn);
cmp(const Cntnr&, const native_type&, const std::string&);
void
basic_cmp_(const Cntnr& r_container, const native_type& r_native_c);
basic_cmp_(const Cntnr&, const native_type&);
void
cmp_(const Cntnr& r_container, const native_type& r_native_c);
cmp_(const Cntnr&, const native_type&);
void
order_preserving_cmp_imp(const Cntnr& r_c, const native_type& r_native_c, pb_ds::detail::false_type);
order_preserving_cmp_imp(const Cntnr&, const native_type&,
pb_ds::detail::false_type);
void
order_preserving_cmp_imp(const Cntnr& r_c, const native_type& r_native_c, pb_ds::detail::true_type);
order_preserving_cmp_imp(const Cntnr&, const native_type&,
pb_ds::detail::true_type);
void
back_order_preserving_cmp_imp(const Cntnr& r_c, const native_type& r_native_c, pb_ds::detail::false_type);
back_order_preserving_cmp_imp(const Cntnr&, const native_type&,
pb_ds::detail::false_type);
void
back_order_preserving_cmp_imp(const Cntnr& r_c, const native_type& r_native_c, pb_ds::detail::true_type);
back_order_preserving_cmp_imp(const Cntnr&, const native_type&,
pb_ds::detail::true_type);
void
reverse_iteration_cmp_imp(const Cntnr& r_c, const native_type& r_native_c, pb_ds::detail::false_type);
reverse_iteration_cmp_imp(const Cntnr&, const native_type&,
pb_ds::detail::false_type);
void
reverse_iteration_cmp_imp(const Cntnr& r_c, const native_type& r_native_c, pb_ds::detail::true_type);
reverse_iteration_cmp_imp(const Cntnr&, const native_type&,
pb_ds::detail::true_type);
void
order_statistics_cmp_imp(const Cntnr& r_c, const native_type& r_native_c, pb_ds::detail::false_type);
order_statistics_cmp_imp(const Cntnr&, const native_type&,
pb_ds::detail::false_type);
void
order_statistics_cmp_imp(const Cntnr& r_c, const native_type& r_native_c, pb_ds::detail::true_type);
order_statistics_cmp_imp(const Cntnr&, const native_type&,
pb_ds::detail::true_type);
void
prefix_search_cmp_imp(const Cntnr& r_c, const native_type& r_native_c, pb_ds::detail::false_type);
prefix_search_cmp_imp(const Cntnr&, const native_type&,
pb_ds::detail::false_type);
void
prefix_search_cmp_imp(const Cntnr& r_c, const native_type& r_native_c, pb_ds::detail::true_type);
prefix_search_cmp_imp(const Cntnr&, const native_type&,
pb_ds::detail::true_type);
template<typename Const_It, class Const_Native_It>
void
it_cmp_imp(Const_It b, Const_It e, Const_Native_It native_b, Const_Native_It native_e);
it_cmp_imp(Const_It, Const_It, Const_Native_It, Const_Native_It);
template<typename Const_It, class Const_Native_It>
void
back_it_cmp_imp(Const_It b, Const_It e, Const_Native_It native_b, Const_Native_It native_e);
back_it_cmp_imp(Const_It, Const_It, Const_Native_It, Const_Native_It);
void
lower_bound_cmp_imp(const Cntnr& r_c, const native_type& r_native_c, pb_ds::detail::false_type);
lower_bound_cmp_imp(const Cntnr&, const native_type&,
pb_ds::detail::false_type);
void
lower_bound_cmp_imp(const Cntnr& r_c, const native_type& r_native_c, pb_ds::detail::true_type);
lower_bound_cmp_imp(const Cntnr&, const native_type&,
pb_ds::detail::true_type);
void
upper_bound_cmp_imp(const Cntnr& r_c, const native_type& r_native_c, pb_ds::detail::false_type);
upper_bound_cmp_imp(const Cntnr&, const native_type&,
pb_ds::detail::false_type);
void
upper_bound_cmp_imp(const Cntnr& r_c, const native_type& r_native_c, pb_ds::detail::true_type);
upper_bound_cmp_imp(const Cntnr&, const native_type&,
pb_ds::detail::true_type);
void
print_container(const native_type& r_cnt, std::ostream& r_os = std::cerr) const;
print_container(const native_type&, std::ostream& r_os = std::cerr) const;
void
print_container(const cntnr& r_cnt, std::ostream& r_os = std::cerr) const;
print_container(const cntnr&, std::ostream& r_os = std::cerr) const;
private:
struct destructor_printer
{
destructor_printer(const std::string& r_msg) : m_msg(r_msg),
m_print(true)
{ }
destructor_printer(const std::string& r_msg)
: m_msg(r_msg), m_print(true) { }
void
cancel_print()
{
m_print = false;
}
{ m_print = false; }
~destructor_printer()
{
if (!m_print)
return;
std::cerr << std::endl <<
"Uncaught exception: " << std::endl <<
m_msg << std::endl;
std::cerr << std::endl << "Uncaught exception: " << std::endl
<< m_msg << std::endl;
}
private:
const std::string m_msg;
bool m_print;
};
......@@ -504,27 +504,17 @@ namespace pb_ds
#include <regression/rand/assoc/detail/diagnostic_fn_imps.hpp>
#undef PB_DS_COND_COMPARE
#undef PB_DS_RUN_MTHD
#undef PB_DS_CLASS_T_DEC
#undef PB_DS_CLASS_C_DEC
#undef PB_DS_THROW_IF_FAILED_
#undef PB_DS_THROW_IF_FAILED
#undef PB_DS_SET_DESTRUCT_PRINT
#undef PB_DS_CANCEL_DESTRUCT_PRINT
#undef PB_DS_TRACE
} // namespace detail
} // namespace test
} // namespace detail
} // namespace test
} // namespace pb_ds
#endif // #ifndef PB_DS_CONTAINER_RAND_REGRESSION_TEST_HPP
#endif
......@@ -44,6 +44,9 @@
* Contains a random-operation test.
*/
#ifndef PB_DS_ASSOC_RAND_REGRESSION_TEST_HPP
#define PB_DS_ASSOC_RAND_REGRESSION_TEST_HPP
#include <iostream>
#include <vector>
#include <regression/rand/assoc/container_rand_regression_test.hpp>
......@@ -120,12 +123,12 @@ namespace detail
{
detail::verify_params(sd, n, m, tp, ip, ep, cp, mp, disp);
}
catch(pb_ds::test::illegal_input_error&)
catch (pb_ds::test::illegal_input_error&)
{
detail::usage(name);
return -1;
}
catch(...)
catch (...)
{
return -2;
};
......@@ -204,3 +207,4 @@ namespace detail
} // namespace test
} // namespace pb_ds
#endif
......@@ -44,6 +44,9 @@
* Contains a random-operation test.
*/
#ifndef PB_DS_PQ_RAND_REGRESSION_TEST_HPP
#define PB_DS_PQ_RAND_REGRESSION_TEST_HPP
#include <iostream>
#include <vector>
#include <regression/rand/priority_queue/container_rand_regression_test.hpp>
......@@ -208,3 +211,4 @@ namespace detail
} // namespace test
} // namespace pb_ds
#endif
......@@ -59,49 +59,37 @@
namespace pb_ds
{
namespace test
{
namespace detail
{
namespace test
{
namespace detail
{
#define PB_DS_CLASS_T_DEC \
template<typename Cntnr>
#define PB_DS_CLASS_C_DEC \
regression_test_traits< \
Cntnr>
regression_test_traits<Cntnr>
#define PB_DS_TYPE_TRAITS_C_DEC \
regression_test_type_traits< \
Cntnr>
regression_test_type_traits<Cntnr>
#define PB_DS_NATIVE_TYPE_TRAITS_C_DEC \
native_type_traits< \
typename PB_DS_TYPE_TRAITS_C_DEC::key_type, \
native_type_traits<typename PB_DS_TYPE_TRAITS_C_DEC::key_type, \
typename PB_DS_TYPE_TRAITS_C_DEC::mapped_type, \
typename Cntnr::allocator>
#define PB_DS_RESIZE_TRAITS_C_DEC \
regression_test_resize_traits< \
Cntnr, \
typename Cntnr::container_category>
regression_test_resize_traits<Cntnr, typename Cntnr::container_category>
#define PB_DS_SET_LOADS_TRAITS_C_DEC \
regression_test_get_set_loacontainer_traits< \
Cntnr, \
regression_test_get_set_loacontainer_traits<Cntnr, \
typename Cntnr::container_category>
#define PB_DS_SET_LOAD_TRAITS_C_DEC \
regression_test_get_set_load_traits< \
Cntnr, \
typename Cntnr::container_category>
regression_test_get_set_load_traits<Cntnr,typename Cntnr::container_category>
#define PB_DS_NODE_UPDATOR_TRAITS_C_DEC \
regression_test_node_update_traits< \
Cntnr, \
typename Cntnr::container_category>
regression_test_node_update_traits<Cntnr, typename Cntnr::container_category>
template<typename Cntnr>
struct regression_test_traits : private PB_DS_TYPE_TRAITS_C_DEC,
......@@ -111,14 +99,12 @@ namespace pb_ds
private PB_DS_SET_LOADS_TRAITS_C_DEC,
private PB_DS_SET_LOAD_TRAITS_C_DEC
{
private:
typedef PB_DS_NATIVE_TYPE_TRAITS_C_DEC native_type_traits_base;
typedef PB_DS_TYPE_TRAITS_C_DEC type_traits_base;
public:
typedef typename Cntnr::key_type key_type;
typedef typename Cntnr::const_key_reference const_key_reference;
......@@ -138,44 +124,31 @@ namespace pb_ds
resize = PB_DS_RESIZE_TRAITS_C_DEC::value,
get_set_loads = PB_DS_SET_LOADS_TRAITS_C_DEC::value,
get_set_load = PB_DS_SET_LOAD_TRAITS_C_DEC::value,
order_statistics =
PB_DS_NODE_UPDATOR_TRAITS_C_DEC::order_statistics,
prefix_search =
PB_DS_NODE_UPDATOR_TRAITS_C_DEC::prefix_search
order_statistics = PB_DS_NODE_UPDATOR_TRAITS_C_DEC::order_statistics,
prefix_search = PB_DS_NODE_UPDATOR_TRAITS_C_DEC::prefix_search
};
template<typename T>
struct erase_if_fn : public regression_test_erase_if_fn<
T>
{
};
struct erase_if_fn : public regression_test_erase_if_fn<T>
{ };
static size_t
erase_if(native_type& r_native_c)
{
typedef
regression_test_erase_if_fn<
typename native_type::value_type>
erase_if_fn;
typedef regression_test_erase_if_fn<typename native_type::value_type> erase_if_fn;
typename native_type::iterator it = r_native_c.begin();
size_t num_ersd = 0;
while (it != r_native_c.end())
if (erase_if_fn()(*it))
{
++num_ersd;
r_native_c.erase(it);
it = r_native_c.begin();
}
else
++it;
return (num_ersd);
return num_ersd;
}
static void
......@@ -190,14 +163,14 @@ namespace pb_ds
static key_type
generate_key(Gen& r_gen, size_t max)
{
return (PB_DS_TYPE_TRAITS_C_DEC::generate_key(r_gen, max));
return PB_DS_TYPE_TRAITS_C_DEC::generate_key(r_gen, max);
}
template<typename Gen>
static value_type
generate_value(Gen& r_gen, size_t max)
{
return (PB_DS_TYPE_TRAITS_C_DEC::generate_value(r_gen, max));
return PB_DS_TYPE_TRAITS_C_DEC::generate_value(r_gen, max);
}
static const_key_reference
......@@ -209,81 +182,70 @@ namespace pb_ds
static native_key_type
native_key(const_key_reference r_key)
{
return (native_type_traits_base::native_key(r_key));
return native_type_traits_base::native_key(r_key);
}
static native_value_type
native_value(const_reference r_val)
{
return (native_type_traits_base::native_value(r_val));
return native_type_traits_base::native_value(r_val);
}
static const native_key_type&
extract_native_key(const native_value_type& r_val)
{
return (native_type_traits_base::extract_key(r_val));
return native_type_traits_base::extract_key(r_val);
}
static bool
cmp(const_reference r_val, const native_value_type& r_native_val)
{
return (val_to_string(r_val) ==
native_val_to_string(r_native_val));
return val_to_string(r_val) == native_val_to_string(r_native_val);
}
static std::string
val_to_string(const_reference r_val)
{
return (to_string(r_val));
return to_string(r_val);
}
static std::string
key_to_string(const_key_reference r_key)
{
return (to_string(r_key));
return to_string(r_key);
}
static std::string
native_val_to_string(const native_value_type& r_native_val)
{
return (to_string(r_native_val));
return to_string(r_native_val);
}
static bool
prefix_match(const_key_reference r_key, const std::string& r_native_key)
{
const size_t native_substr_len = std::min(
r_key.length(),
const size_t native_substr_len = std::min(r_key.length(),
r_native_key.length());
const std::string native_substr =
r_native_key.substr(0, native_substr_len);
const std::string native_substr = r_native_key.substr(0,
native_substr_len);
return (native_substr == (const std::string& )r_key);
return native_substr == (const std::string&) r_key;
}
};
#undef PB_DS_TYPE_TRAITS_C_DEC
#undef PB_DS_NATIVE_TYPE_TRAITS_C_DEC
#undef PB_DS_RESIZE_TRAITS_C_DEC
#undef PB_DS_SET_LOADS_TRAITS_C_DEC
#undef PB_DS_SET_LOAD_TRAITS_C_DEC
#undef PB_DS_NODE_UPDATOR_TRAITS_C_DEC
#undef PB_DS_CLASS_T_DEC
#undef PB_DS_CLASS_C_DEC
} // namespace detail
} // namespace test
} // namespace detail
} // namespace test
} // namespace pb_ds
#endif // #ifndef PB_DS_REGRESSION_TEST_TRAIT_HPP
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment