3 // Copyright (C) 2005-2023 Free Software Foundation, Inc.
5 // This file is part of the GNU ISO C++ Library. This library is free
6 // software; you can redistribute it and/or modify it under the terms
7 // of the GNU General Public License as published by the Free Software
8 // Foundation; either version 3, or (at your option) any later
11 // This library is distributed in the hope that it will be useful, but
12 // WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this library; see the file COPYING3. If not see
18 // <http://www.gnu.org/licenses/>.
21 // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
23 // Permission to use, copy, modify, sell, and distribute this software
24 // is hereby granted without fee, provided that the above copyright
25 // notice appears in all copies, and that both that copyright notice
26 // and this permission notice appear in supporting documentation. None
27 // of the above authors, nor IBM Haifa Research Laboratories, make any
28 // representation about the suitability of this software for any
29 // purpose. It is provided "as is" without express or implied
34 * Contains traits for a random regression test
35 * for a specific container type.
38 #ifndef PB_DS_REGRESSION_TEST_TRAIT_HPP
39 #define PB_DS_REGRESSION_TEST_TRAIT_HPP
41 #include <regression/trait/erase_if_fn.hpp>
49 template<typename Cntnr>
50 struct regression_test_traits
52 typedef typename Cntnr::value_type value_type;
53 typedef typename Cntnr::const_reference const_reference;
54 typedef __gnu_pbds::test::native_priority_queue<std::string, true> native_type;
55 typedef typename native_type::value_type native_value_type;
58 struct erase_if_fn : public regression_test_erase_if_fn<T>
61 template<typename Gen>
63 generate_value(Gen& r_gen, size_t max)
64 { return basic_type(r_gen, max); }
66 static native_value_type
67 native_value(const_reference r_val)
68 { return native_value_type(r_val); }
71 cmp(const_reference r_val, const native_value_type& r_native_val)
72 { return val_to_string(r_val) == r_native_val; }
75 val_to_string(const_reference r_val)
76 { return std::string(r_val); }
80 } // namespace __gnu_pbds