forked from boostorg/container
Closes #58 ("Comparing strings does not compile in gcc 7+ in C++17 mode")
This commit is contained in:
1 parent
407aabd77b
commit
2a7b5a70a5
4 files changed
+137
-14
No files matched your search
@@ -0,0 +1,58 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2017-2017. 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)
|
||||
//
|
||||
// See http://www.boost.org/libs/container for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef BOOST_CONTAINER_TEST_COMPARISON_TEST_HPP
|
||||
#define BOOST_CONTAINER_TEST_COMPARISON_TEST_HPP
|
||||
|
||||
#include <deque>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace container {
|
||||
namespace test {
|
||||
|
||||
|
||||
template<class Cont>
|
||||
bool test_container_comparisons()
|
||||
{
|
||||
typedef typename Cont::value_type value_type;
|
||||
|
||||
Cont cont;
|
||||
cont.push_back(value_type(1));
|
||||
cont.push_back(value_type(2));
|
||||
cont.push_back(value_type(3));
|
||||
|
||||
Cont cont_equal(cont);
|
||||
|
||||
Cont cont_less;
|
||||
cont_less.push_back(value_type(1));
|
||||
cont_less.push_back(value_type(2));
|
||||
cont_less.push_back(value_type(2));
|
||||
|
||||
BOOST_TEST(cont == cont_equal);
|
||||
BOOST_TEST(!(cont != cont_equal));
|
||||
BOOST_TEST(cont != cont_less);
|
||||
BOOST_TEST(cont_less < cont);
|
||||
BOOST_TEST(cont_less <= cont);
|
||||
BOOST_TEST(!(cont_less > cont));
|
||||
BOOST_TEST(!(cont_less >= cont));
|
||||
BOOST_TEST(!(cont < cont_less));
|
||||
BOOST_TEST(!(cont <= cont_less));
|
||||
BOOST_TEST(cont > cont_less);
|
||||
BOOST_TEST(cont >= cont_less);
|
||||
|
||||
return ::boost::report_errors() == 0;
|
||||
}
|
||||
|
||||
} //namespace test {
|
||||
} //namespace container {
|
||||
} //namespace boost {
|
||||
|
||||
#endif //#ifndef BOOST_CONTAINER_TEST_COMPARISON_TEST_HPP
|
||||
@@ -24,8 +24,10 @@
|
||||
#include "expand_bwd_test_template.hpp"
|
||||
#include "propagate_allocator_test.hpp"
|
||||
#include "default_init_test.hpp"
|
||||
#include "comparison_test.hpp"
|
||||
#include "../../intrusive/test/iterator_test.hpp"
|
||||
#include <boost/utility/string_view.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
|
||||
using namespace boost::container;
|
||||
|
||||
@@ -507,8 +509,10 @@ struct alloc_propagate_base<boost_container_string>
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
}}} //namespace boost::container::test
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
if(string_test<char>()){
|
||||
@@ -558,6 +562,16 @@ int main()
|
||||
boost::intrusive::test::test_iterator_random< cont_int >(a);
|
||||
}
|
||||
|
||||
////////////////////////////////////
|
||||
// Comparison testing
|
||||
////////////////////////////////////
|
||||
{
|
||||
if(!boost::container::test::test_container_comparisons<string>())
|
||||
return 1;
|
||||
if(!boost::container::test::test_container_comparisons<wstring>())
|
||||
return 1;
|
||||
}
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user