]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/util/regression/trait/priority_queue/trait.hpp
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / util / regression / trait / priority_queue / trait.hpp
CommitLineData
4569a895
AT
1// -*- C++ -*-
2
a5544970 3// Copyright (C) 2005-2019 Free Software Foundation, Inc.
4569a895
AT
4//
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
748086b7 8// Foundation; either version 3, or (at your option) any later
4569a895
AT
9// version.
10
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.
15
16// You should have received a copy of the GNU General Public License
748086b7
JJ
17// along with this library; see the file COPYING3. If not see
18// <http://www.gnu.org/licenses/>.
19
4569a895
AT
20
21// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
22
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
30// warranty.
31
32/**
33 * @file trait.hpp
2e3f9c21 34 * Contains traits for a random regression test
4569a895
AT
35 * for a specific container type.
36 */
37
38#ifndef PB_DS_REGRESSION_TEST_TRAIT_HPP
39#define PB_DS_REGRESSION_TEST_TRAIT_HPP
40
41#include <regression/trait/erase_if_fn.hpp>
42
5e11f978 43namespace __gnu_pbds
4569a895 44{
4569a895
AT
45 namespace test
46 {
4569a895
AT
47 namespace detail
48 {
4569a895
AT
49 template<typename Cntnr>
50 struct regression_test_traits
51 {
4569a895 52 typedef typename Cntnr::value_type value_type;
4569a895 53 typedef typename Cntnr::const_reference const_reference;
5e11f978 54 typedef __gnu_pbds::test::native_priority_queue<std::string, true> native_type;
4569a895
AT
55 typedef typename native_type::value_type native_value_type;
56
57 template<typename T>
382a1351
BK
58 struct erase_if_fn : public regression_test_erase_if_fn<T>
59 { };
4569a895
AT
60
61 template<typename Gen>
62 static value_type
63 generate_value(Gen& r_gen, size_t max)
382a1351 64 { return basic_type(r_gen, max); }
4569a895
AT
65
66 static native_value_type
67 native_value(const_reference r_val)
382a1351 68 { return native_value_type(r_val); }
4569a895
AT
69
70 static bool
71 cmp(const_reference r_val, const native_value_type& r_native_val)
382a1351 72 { return val_to_string(r_val) == r_native_val; }
4569a895
AT
73
74 static std::string
75 val_to_string(const_reference r_val)
382a1351 76 { return std::string(r_val); }
4569a895 77 };
4569a895 78 } // namespace detail
4569a895 79 } // namespace test
5e11f978 80} // namespace __gnu_pbds
4569a895 81
f92ab29f 82#endif