Changed ForwardIterator to InputIterator for test_all_eq_impl

This commit is contained in:
Bjorn Reese
2017-02-12 13:19:39 +01:00
parent fb09632580
commit db8efb4ce9
2 changed files with 130 additions and 39 deletions

View File

@@ -9,18 +9,52 @@
//
#include <vector>
#include <set>
#include <boost/core/lightweight_test.hpp>
int main()
{
int test_cases = 0;
// Array
{
int x[] = { 1 };
int y[] = { 1, 2 };
BOOST_TEST_ALL_EQ( x, x + sizeof(x)/sizeof(x[0]), y, y + sizeof(y)/sizeof(y[0]) );
++test_cases;
}
{
int x[] = { 1, 2 };
int y[] = { 1 };
BOOST_TEST_ALL_EQ( x, x + sizeof(x)/sizeof(x[0]), y, y + sizeof(y)/sizeof(y[0]) );
++test_cases;
}
{
int x[] = { 2 };
int y[] = { 1, 2 };
BOOST_TEST_ALL_EQ( x, x + sizeof(x)/sizeof(x[0]), y, y + sizeof(y)/sizeof(y[0]) );
++test_cases;
}
{
int x[] = { 1, 2, 3, 4 };
int y[] = { 1, 3, 2, 4 };
BOOST_TEST_ALL_EQ( x, x + sizeof(x)/sizeof(x[0]), y, y + sizeof(y)/sizeof(y[0]) );
++test_cases;
}
// Vector
{
std::vector<int> x, y;
x.push_back( 1 );
BOOST_TEST_ALL_EQ( x.begin(), x.end(), y.begin(), y.end() );
++test_cases;
}
{
std::vector<int> x, y;
y.push_back( 1 );
@@ -44,6 +78,48 @@ int main()
++test_cases;
}
{
std::vector<int> x, y;
x.push_back( 1 ); x.push_back( 2 ); x.push_back( 3 );
y.push_back( 1 ); y.push_back( 3 ); y.push_back( 2 ); y.push_back( 4 );
BOOST_TEST_ALL_EQ( x.begin(), x.end(), y.begin(), y.end() );
++test_cases;
}
{
std::vector<int> x, y;
x.push_back( 1 ); x.push_back( 2 ); x.push_back( 3 ); x.push_back( 4 );
y.push_back( 1 ); y.push_back( 3 ); y.push_back( 2 );;
BOOST_TEST_ALL_EQ( x.begin(), x.end(), y.begin(), y.end() );
++test_cases;
}
// Set
{
std::set<int> x, y;
x.insert(1);
y.insert(1); y.insert(3);
BOOST_TEST_ALL_EQ( x.begin(), x.end(), y.begin(), y.end() );
++test_cases;
}
{
std::set<int> x, y;
x.insert(1); x.insert(2);
y.insert(1);
BOOST_TEST_ALL_EQ( x.begin(), x.end(), y.begin(), y.end() );
++test_cases;
}
{
std::set<int> x, y;
x.insert(1); x.insert(2);
y.insert(1); y.insert(3);
BOOST_TEST_ALL_EQ( x.begin(), x.end(), y.begin(), y.end() );
++test_cases;
}
boost::report_errors();
return boost::detail::test_errors() == test_cases;