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-05 Benjamin Kosnik <bkoz@redhat.com> 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. * include/Makefile.am (pch_output): New.
(clean-local): Use it. (clean-local): Use it.
......
...@@ -52,210 +52,93 @@ ...@@ -52,210 +52,93 @@
namespace pb_ds namespace pb_ds
{ {
namespace test
{
typedef dbg_ex_allocator<basic_type> alloc_type;
namespace test struct hash
{ {
typedef alloc_type::rebind<basic_type>::other::const_reference const_key_reference;
typedef size_t
pb_ds::test::dbg_ex_allocator< operator()(const_key_reference r_key) const
pb_ds::test::basic_type>
alloc_type;
struct hash
{
typedef
alloc_type::rebind<
pb_ds::test::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
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 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;
public:
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;
};
template<typename Data_Type>
struct trie_types
{ {
private: size_t ret = 0;
typedef typedef basic_type::const_iterator const_iterator;
typename pb_ds::test::trie_common_types< for (const_iterator it = r_key.begin(); it != r_key.end(); ++it)
pb_ds::test::basic_type, ret = ret * 5 + static_cast<size_t>(*it);
Data_Type, return ret;
e_access_traits_t, }
pb_ds::pat_trie_tag, };
pb_ds::null_trie_node_update,
alloc_type>::regression_tl typedef pb_ds::string_trie_e_access_traits<basic_type, 'a', 'a' + basic_type::distinct_chars - 1, false, alloc_type> e_access_traits_t;
no_updates_tl_t;
template<typename Data_Type>
typedef struct tree_types
typename pb_ds::test::trie_common_types< {
pb_ds::test::basic_type, private:
Data_Type, 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;
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;
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 no_updates_tl_t min_tl_t;
};
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 tl_t min_tl_t;
};
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 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 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;
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; public:
typedef typename pb_ds::detail::typelist_append<no_order_statistics_tl_t, order_statistics_tl_t>::type tl_t;
typedef tree_types< basic_type>::min_tl_t min_tree_map_tl_t; typedef no_order_statistics_tl_t min_tl_t;
};
typedef hash_types< basic_type>::tl_t hash_map_tl_t; template<typename Data_Type>
struct trie_types
{
private:
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 hash_types< basic_type>::min_tl_t min_hash_map_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 lu_types< basic_type>::tl_t lu_map_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;
typedef lu_types< basic_type>::min_tl_t min_lu_map_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 trie_types< basic_type>::tl_t trie_map_tl_t; typedef no_updates_tl_t min_tl_t;
};
typedef trie_types< basic_type>::min_tl_t min_trie_map_tl_t; template<typename Data_Type>
struct hash_types
{
typedef typename hash_common_types<basic_type, Data_Type, hash, std::equal_to<basic_type>, alloc_type>::regression_tl tl_t;
} // namespace test typedef tl_t min_tl_t;
};
template<typename Data_Type>
struct lu_types
{
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<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 } // namespace pb_ds
#endif // #ifndef PB_DS_RAND_REGRESSION_TEST_COMMON_TYPE_HPP #endif // #ifndef PB_DS_RAND_REGRESSION_TEST_COMMON_TYPE_HPP
...@@ -52,67 +52,52 @@ ...@@ -52,67 +52,52 @@
namespace pb_ds namespace pb_ds
{ {
namespace test
{
#define PB_DS_BASE_C_DEC \
std::basic_string<char, std::char_traits<char>, dbg_ex_allocator<char> >
namespace test struct basic_type : public PB_DS_BASE_C_DEC
{ {
private:
typedef PB_DS_BASE_C_DEC base_type;
#define PB_DS_BASE_C_DEC \ public:
std::basic_string< \ enum
char, \
std::char_traits< \
char>, \
dbg_ex_allocator< \
char> >
struct basic_type : public PB_DS_BASE_C_DEC
{
public:
enum
{
distinct_chars = 4
};
public:
basic_type()
{ }
template<typename Gen>
basic_type(Gen& r_gen, size_t max)
{ {
size_t rnd = distinct_chars = 4
r_gen.get_unsigned_long(0, static_cast<unsigned long>(max)); };
while (rnd > 0) basic_type() { }
{
PB_DS_BASE_C_DEC::push_back('a' +
static_cast<char>(rnd % distinct_chars));
rnd /= distinct_chars; 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));
basic_type(const std::string other) while (rnd > 0)
{ {
std::string::const_iterator it = other.begin(); base_type::push_back('a' + static_cast<char>(rnd % distinct_chars));
rnd /= distinct_chars;
while (it != other.end()) }
{ }
PB_DS_BASE_C_DEC::push_back(*it);
++it; basic_type(const std::string other)
} {
} std::string::const_iterator it = other.begin();
while (it != other.end())
{
base_type::push_back(*it);
++it;
}
}
operator std::string() const operator std::string() const
{ { return std::string(base_type::c_str());}
return (std::string(PB_DS_BASE_C_DEC::c_str())); };
}
};
#undef PB_DS_BASE_C_DEC #undef PB_DS_BASE_C_DEC
} // namespace test } // namespace test
} // namespace pb_ds } // namespace pb_ds
#endif // #ifndef PB_DS_BASIC_TYPE_HPP #endif // #ifndef PB_DS_BASIC_TYPE_HPP
...@@ -52,27 +52,14 @@ ...@@ -52,27 +52,14 @@
namespace pb_ds namespace pb_ds
{ {
namespace test
{
typedef dbg_ex_allocator<basic_type> alloc_type;
namespace test typedef pq_common_types<basic_type, std::less<basic_type>, alloc_type>::regression_tl pq_tl_t;
{
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_tl_t min_pq_tl_t;
} // namespace test
typedef pq_tl_t min_pq_tl_t;
} // namespace test
} // namespace pb_ds } // namespace pb_ds
#endif // #ifndef PB_DS_RAND_REGRESSION_TEST_COMMON_TYPE_HPP #endif
...@@ -44,6 +44,9 @@ ...@@ -44,6 +44,9 @@
* Contains a random-operation test. * Contains a random-operation test.
*/ */
#ifndef PB_DS_ASSOC_RAND_REGRESSION_TEST_HPP
#define PB_DS_ASSOC_RAND_REGRESSION_TEST_HPP
#include <iostream> #include <iostream>
#include <vector> #include <vector>
#include <regression/rand/assoc/container_rand_regression_test.hpp> #include <regression/rand/assoc/container_rand_regression_test.hpp>
...@@ -120,12 +123,12 @@ namespace detail ...@@ -120,12 +123,12 @@ namespace detail
{ {
detail::verify_params(sd, n, m, tp, ip, ep, cp, mp, disp); 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); detail::usage(name);
return -1; return -1;
} }
catch(...) catch (...)
{ {
return -2; return -2;
}; };
...@@ -204,3 +207,4 @@ namespace detail ...@@ -204,3 +207,4 @@ namespace detail
} // namespace test } // namespace test
} // namespace pb_ds } // namespace pb_ds
#endif
...@@ -44,6 +44,9 @@ ...@@ -44,6 +44,9 @@
* Contains a random-operation test. * Contains a random-operation test.
*/ */
#ifndef PB_DS_PQ_RAND_REGRESSION_TEST_HPP
#define PB_DS_PQ_RAND_REGRESSION_TEST_HPP
#include <iostream> #include <iostream>
#include <vector> #include <vector>
#include <regression/rand/priority_queue/container_rand_regression_test.hpp> #include <regression/rand/priority_queue/container_rand_regression_test.hpp>
...@@ -208,3 +211,4 @@ namespace detail ...@@ -208,3 +211,4 @@ namespace detail
} // namespace test } // namespace test
} // namespace pb_ds } // namespace pb_ds
#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