Commit 53179144 by Benjamin Kosnik Committed by Benjamin Kosnik

PR libstdc++/21772 part 2

2009-12-16  Benjamin Kosnik  <bkoz@redhat.com>

	PR libstdc++/21772 part 2
	* doc/xml/manual/test.xml: Add documentation about testing details.
	* testsuite/util/exception/safety.h: New. Functor objects for
	testing C++0x container classes.
	* testsuite/util/testsuite_container_traits.h: Add traits.

	* testsuite/23_containers/list/requirements/exception/
	basic.cc: New.
	generation_prohibited.cc: New.
	propagation_consistent.cc: New.

From-SVN: r155306
parent ccfd7296
2009-12-16 Benjamin Kosnik <bkoz@redhat.com>
PR libstdc++/21772 part 2
* doc/xml/manual/test.xml: Add documentation about testing details.
* testsuite/util/exception/safety.h: New. Functor objects for
testing C++0x container classes.
* testsuite/util/testsuite_container_traits.h: Add traits.
* testsuite/23_containers/list/requirements/exception/
basic.cc: New.
generation_prohibited.cc: New.
propagation_consistent.cc: New.
2009-12-15 Benjamin Kosnik <bkoz@redhat.com>
PR libstdc++/21772 part 1
......
// { dg-options "-std=gnu++0x" }
// { dg-require-cstdint "" }
// 2009-11-30 Benjamin Kosnik <benjamin@redhat.com>
// Copyright (C) 2009 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <list>
#include <exception/safety.h>
void
value()
{
typedef __gnu_cxx::throw_value_limit value_type;
typedef __gnu_cxx::throw_allocator_limit<value_type> allocator_type;
typedef std::list<value_type, allocator_type> test_type;
__gnu_test::basic_safety<test_type> test;
}
// Container requirement testing, exceptional behavior
int main()
{
value();
return 0;
}
// { dg-options "-std=gnu++0x" }
// { dg-require-cstdint "" }
// 2009-09-09 Benjamin Kosnik <benjamin@redhat.com>
// Copyright (C) 2009 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <list>
#include <exception/safety.h>
// Container requirement testing, exceptional behavior
int main()
{
typedef __gnu_cxx::throw_value_random value_type;
typedef __gnu_cxx::throw_allocator_random<value_type> allocator_type;
typedef std::list<value_type, allocator_type> test_type;
__gnu_test::generation_prohibited<test_type> test;
return 0;
}
// { dg-options "-std=gnu++0x" }
// { dg-require-cstdint "" }
// 2009-09-09 Benjamin Kosnik <benjamin@redhat.com>
// Copyright (C) 2009 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <list>
#include <exception/safety.h>
// Container requirement testing, exceptional behavior
int main()
{
typedef __gnu_cxx::throw_value_limit value_type;
typedef __gnu_cxx::throw_allocator_limit<value_type> allocator_type;
typedef std::list<value_type, allocator_type> test_type;
__gnu_test::propagation_consistent<test_type> test;
return 0;
}
......@@ -24,8 +24,9 @@
#include <ext/vstring.h>
namespace __gnu_test
{
{
// Container traits.
// Base class with default false values for all traits.
struct traits_base
{
// Type, nested type, and typedef related traits.
......@@ -37,6 +38,11 @@ namespace __gnu_test
typedef std::false_type is_associative;
typedef std::false_type is_unordered;
typedef std::false_type is_mapped;
typedef std::false_type has_erase;
typedef std::false_type has_insert;
typedef std::false_type has_push_pop;
typedef std::false_type has_size_type_constructor;
};
// Primary template does nothing. Specialize on each type under
......@@ -46,40 +52,55 @@ namespace __gnu_test
// Specialize for each container.
template<typename _Tp, size_t _Np>
struct traits<std::array<_Tp, _Np> > : public traits_base
struct traits<std::array<_Tp, _Np>> : public traits_base
{
typedef std::true_type is_container;
typedef std::true_type is_reversible;
};
template<typename _Tp>
struct traits<std::deque<_Tp> > : public traits_base
template<typename _Tp1, typename _Tp2>
struct traits<std::deque<_Tp1, _Tp2>> : public traits_base
{
typedef std::true_type is_container;
typedef std::true_type is_reversible;
typedef std::true_type is_allocator_aware;
typedef std::true_type is_pointer_aware;
typedef std::true_type has_erase;
typedef std::true_type has_insert;
typedef std::true_type has_push_pop;
typedef std::true_type has_size_type_constructor;
};
template<typename _Tp>
struct traits<std::forward_list<_Tp> > : public traits_base
template<typename _Tp1, typename _Tp2>
struct traits<std::forward_list<_Tp1, _Tp2>> : public traits_base
{
typedef std::true_type is_container;
typedef std::true_type is_allocator_aware;
typedef std::true_type is_pointer_aware;
typedef std::true_type has_erase;
typedef std::true_type has_insert;
typedef std::true_type has_push_pop;
typedef std::true_type has_size_type_constructor;
};
template<typename _Tp>
struct traits<std::list<_Tp> > : public traits_base
template<typename _Tp1, typename _Tp2>
struct traits<std::list<_Tp1, _Tp2>> : public traits_base
{
typedef std::true_type is_container;
typedef std::true_type is_reversible;
typedef std::true_type is_allocator_aware;
typedef std::true_type is_pointer_aware;
typedef std::true_type has_erase;
typedef std::true_type has_insert;
typedef std::true_type has_push_pop;
typedef std::true_type has_size_type_constructor;
};
template<typename _Kp, typename _Tp>
struct traits<std::map<_Kp, _Tp> > : public traits_base
template<typename _Tp1, typename _Tp2, typename _Tp3, typename _Tp4>
struct traits<std::map<_Tp1, _Tp2, _Tp3, _Tp4>> : public traits_base
{
typedef std::true_type is_container;
typedef std::true_type is_reversible;
......@@ -87,10 +108,12 @@ namespace __gnu_test
typedef std::true_type is_pointer_aware;
typedef std::true_type is_associative;
typedef std::true_type is_mapped;
typedef std::true_type has_insert;
};
template<typename _Kp, typename _Tp>
struct traits<std::multimap<_Kp, _Tp> > : public traits_base
template<typename _Tp1, typename _Tp2, typename _Tp3, typename _Tp4>
struct traits<std::multimap<_Tp1, _Tp2, _Tp3, _Tp4>> : public traits_base
{
typedef std::true_type is_container;
typedef std::true_type is_reversible;
......@@ -100,108 +123,142 @@ namespace __gnu_test
typedef std::true_type is_mapped;
};
template<typename _Tp>
struct traits<std::multiset<_Tp> > : public traits_base
template<typename _Tp1, typename _Tp2, typename _Tp3>
struct traits<std::multiset<_Tp1, _Tp2, _Tp3>> : public traits_base
{
typedef std::true_type is_container;
typedef std::true_type is_reversible;
typedef std::true_type is_allocator_aware;
typedef std::true_type is_pointer_aware;
typedef std::true_type is_associative;
typedef std::true_type has_insert;
};
template<typename _Tp>
struct traits<std::priority_queue<_Tp> > : public traits_base
template<typename _Tp1, typename _Tp2>
struct traits<std::priority_queue<_Tp1, _Tp2>> : public traits_base
{
typedef std::true_type is_adaptor;
};
template<typename _Tp>
struct traits<std::queue<_Tp> > : public traits_base
template<typename _Tp1, typename _Tp2>
struct traits<std::queue<_Tp1, _Tp2>> : public traits_base
{
typedef std::true_type is_adaptor;
};
template<typename _Tp>
struct traits<std::set<_Tp> > : public traits_base
template<typename _Tp1, typename _Tp2, typename _Tp3>
struct traits<std::set<_Tp1, _Tp2, _Tp3>> : public traits_base
{
typedef std::true_type is_container;
typedef std::true_type is_reversible;
typedef std::true_type is_allocator_aware;
typedef std::true_type is_pointer_aware;
typedef std::true_type is_associative;
typedef std::true_type has_insert;
};
template<typename _Tp>
struct traits<std::stack<_Tp> > : public traits_base
template<typename _Tp1, typename _Tp2>
struct traits<std::stack<_Tp1, _Tp2> > : public traits_base
{
typedef std::true_type is_adaptor;
};
template<typename _Kp, typename _Tp>
struct traits<std::unordered_map<_Kp, _Tp> > : public traits_base
template<typename _Tp1, typename _Tp2, typename _Tp3,
typename _Tp4, typename _Tp5>
struct traits<std::unordered_map<_Tp1, _Tp2, _Tp3, _Tp4, _Tp5>>
: public traits_base
{
typedef std::true_type is_container;
typedef std::true_type is_allocator_aware;
typedef std::true_type is_pointer_aware;
typedef std::true_type is_unordered;
typedef std::true_type is_mapped;
typedef std::true_type has_size_type_constructor;
typedef std::true_type has_insert;
};
template<typename _Kp, typename _Tp>
struct traits<std::unordered_multimap<_Kp, _Tp> > : public traits_base
template<typename _Tp1, typename _Tp2, typename _Tp3,
typename _Tp4, typename _Tp5>
struct traits<std::unordered_multimap<_Tp1, _Tp2, _Tp3, _Tp4, _Tp5>>
: public traits_base
{
typedef std::true_type is_container;
typedef std::true_type is_allocator_aware;
typedef std::true_type is_pointer_aware;
typedef std::true_type is_unordered;
typedef std::true_type is_mapped;
typedef std::true_type has_size_type_constructor;
};
template<typename _Tp>
struct traits<std::unordered_multiset<_Tp> > : public traits_base
template<typename _Tp1, typename _Tp2, typename _Tp3, typename _Tp4>
struct traits<std::unordered_multiset<_Tp1, _Tp2, _Tp3, _Tp4>>
: public traits_base
{
typedef std::true_type is_container;
typedef std::true_type is_allocator_aware;
typedef std::true_type is_pointer_aware;
typedef std::true_type is_unordered;
typedef std::true_type has_insert;
};
template<typename _Tp>
struct traits<std::unordered_set<_Tp> > : public traits_base
template<typename _Tp1, typename _Tp2, typename _Tp3, typename _Tp4>
struct traits<std::unordered_set<_Tp1, _Tp2, _Tp3, _Tp4>>
: public traits_base
{
typedef std::true_type is_container;
typedef std::true_type is_allocator_aware;
typedef std::true_type is_pointer_aware;
typedef std::true_type is_unordered;
typedef std::true_type has_size_type_constructor;
typedef std::true_type has_insert;
};
template<typename _Tp>
struct traits<std::vector<_Tp> > : public traits_base
template<typename _Tp1, typename _Tp2>
struct traits<std::vector<_Tp1, _Tp2>> : public traits_base
{
typedef std::true_type is_container;
typedef std::true_type is_reversible;
typedef std::true_type is_allocator_aware;
typedef std::true_type is_pointer_aware;
typedef std::true_type has_erase;
typedef std::true_type has_insert;
typedef std::true_type has_size_type_constructor;
};
template<typename _Tp>
struct traits<std::basic_string<_Tp> > : public traits_base
template<typename _Tp1, typename _Tp2, typename _Tp3>
struct traits<std::basic_string<_Tp1, _Tp2, _Tp3>> : public traits_base
{
typedef std::true_type is_container;
typedef std::true_type is_reversible;
typedef std::true_type is_allocator_aware;
typedef std::true_type is_pointer_aware;
typedef std::true_type has_erase;
typedef std::true_type has_insert;
};
template<typename _Tp>
struct traits<__gnu_cxx::__versa_string<_Tp> > : public traits_base
template<typename _Tp1, typename _Tp2, typename _Tp3,
template <typename, typename, typename> class _Tp4>
struct traits<__gnu_cxx::__versa_string<_Tp1, _Tp2, _Tp3, _Tp4>>
: public traits_base
{
typedef std::true_type is_container;
typedef std::true_type is_reversible;
typedef std::true_type is_allocator_aware;
typedef std::true_type is_pointer_aware;
typedef std::true_type has_erase;
// XXX no vstring<rc>::insert
// typedef std::true_type has_insert;
};
} // namespace __gnu_test
#endif
#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