| 
									
										
										
										
											2006-05-21 17:14:11 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-03-09 20:56:23 +00:00
										 |  |  | // Copyright 2006-2009 Daniel James.
 | 
					
						
							| 
									
										
										
										
											2006-07-01 22:31:26 +00:00
										 |  |  | // Distributed under the Boost Software License, Version 1.0. (See accompanying
 | 
					
						
							|  |  |  | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 | 
					
						
							| 
									
										
										
										
											2006-05-21 17:14:11 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | #include "./containers.hpp"
 | 
					
						
							| 
									
										
										
										
											2017-02-19 13:05:17 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-05-21 17:14:11 +00:00
										 |  |  | #include "../helpers/helpers.hpp"
 | 
					
						
							| 
									
										
										
										
											2017-02-19 13:05:17 +00:00
										 |  |  | #include "../helpers/invariants.hpp"
 | 
					
						
							|  |  |  | #include "../helpers/random_values.hpp"
 | 
					
						
							| 
									
										
										
										
											2006-05-21 17:14:11 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-07 10:57:35 +00:00
										 |  |  | test::seed_t initialize_seed(835193); | 
					
						
							| 
									
										
										
										
											2007-12-06 11:42:28 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-19 13:05:17 +00:00
										 |  |  | template <class T> struct erase_test_base : public test::exception_base | 
					
						
							| 
									
										
										
										
											2006-05-21 17:14:11 +00:00
										 |  |  | { | 
					
						
							|  |  |  |     test::random_values<T> values; | 
					
						
							|  |  |  |     erase_test_base(unsigned int count = 5) : values(count) {} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     typedef T data_type; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-19 13:05:17 +00:00
										 |  |  |     data_type init() const { return T(values.begin(), values.end()); } | 
					
						
							| 
									
										
										
										
											2006-05-21 17:14:11 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-19 13:05:17 +00:00
										 |  |  |     void check BOOST_PREVENT_MACRO_SUBSTITUTION(T const& x) const | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2006-08-06 20:42:45 +00:00
										 |  |  |         std::string scope(test::scope); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-05-27 17:44:09 +00:00
										 |  |  |         BOOST_TEST(scope.find("hash::") != std::string::npos || | 
					
						
							| 
									
										
										
										
											2017-02-19 13:05:17 +00:00
										 |  |  |                    scope.find("equal_to::") != std::string::npos || | 
					
						
							|  |  |  |                    scope == "operator==(object, object)"); | 
					
						
							| 
									
										
										
										
											2006-08-06 20:42:45 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-05-21 17:14:11 +00:00
										 |  |  |         test::check_equivalent_keys(x); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-19 13:05:17 +00:00
										 |  |  | template <class T> struct erase_by_key_test1 : public erase_test_base<T> | 
					
						
							| 
									
										
										
										
											2006-05-21 17:14:11 +00:00
										 |  |  | { | 
					
						
							|  |  |  |     void run(T& x) const | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2017-02-19 13:05:17 +00:00
										 |  |  |         typedef BOOST_DEDUCED_TYPENAME test::random_values<T>::const_iterator | 
					
						
							|  |  |  |             iterator; | 
					
						
							| 
									
										
										
										
											2006-05-21 17:14:11 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-19 13:05:17 +00:00
										 |  |  |         for (iterator it = this->values.begin(), end = this->values.end(); | 
					
						
							|  |  |  |              it != end; ++it) { | 
					
						
							| 
									
										
										
										
											2006-05-21 17:14:11 +00:00
										 |  |  |             x.erase(test::get_key<T>(*it)); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-19 13:05:17 +00:00
										 |  |  | EXCEPTION_TESTS((erase_by_key_test1), CONTAINER_SEQ) | 
					
						
							| 
									
										
										
										
											2012-12-07 17:05:36 +00:00
										 |  |  | RUN_TESTS() |