forked from boostorg/algorithm
use boost::algorithm::iota in the tests instead of std::iota, which requires C++11
This commit is contained in:
@ -13,6 +13,7 @@
|
||||
#include <algorithm>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/algorithm/cxx11/iota.hpp>
|
||||
#include <boost/algorithm/cxx17/exclusive_scan.hpp>
|
||||
|
||||
#include "iterator_test.hpp"
|
||||
@ -36,7 +37,7 @@ void basic_tests_init()
|
||||
|
||||
{
|
||||
std::vector<int> v(10);
|
||||
std::iota(v.begin(), v.end(), 0);
|
||||
ba::iota(v.begin(), v.end(), 0);
|
||||
ba::exclusive_scan(v.begin(), v.end(), v.begin(), 30);
|
||||
for (size_t i = 0; i < v.size(); ++i)
|
||||
BOOST_CHECK(v[i] == 30 + triangle(i-1));
|
||||
@ -44,7 +45,7 @@ void basic_tests_init()
|
||||
|
||||
{
|
||||
std::vector<int> v(10);
|
||||
std::iota(v.begin(), v.end(), 1);
|
||||
ba::iota(v.begin(), v.end(), 1);
|
||||
ba::exclusive_scan(v.begin(), v.end(), v.begin(), 40);
|
||||
for (size_t i = 0; i < v.size(); ++i)
|
||||
BOOST_CHECK(v[i] == 40 + triangle(i));
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include <algorithm>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/algorithm/cxx11/iota.hpp>
|
||||
#include <boost/algorithm/cxx17/inclusive_scan.hpp>
|
||||
|
||||
#include "iterator_test.hpp"
|
||||
@ -36,7 +37,7 @@ void basic_tests_op()
|
||||
|
||||
{
|
||||
std::vector<int> v(10);
|
||||
std::iota(v.begin(), v.end(), 0);
|
||||
ba::iota(v.begin(), v.end(), 0);
|
||||
ba::inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<int>());
|
||||
for (size_t i = 0; i < v.size(); ++i)
|
||||
assert(v[i] == triangle(i));
|
||||
@ -44,7 +45,7 @@ void basic_tests_op()
|
||||
|
||||
{
|
||||
std::vector<int> v(10);
|
||||
std::iota(v.begin(), v.end(), 1);
|
||||
ba::iota(v.begin(), v.end(), 1);
|
||||
ba::inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<int>());
|
||||
for (size_t i = 0; i < v.size(); ++i)
|
||||
assert(v[i] == triangle(i + 1));
|
||||
@ -75,7 +76,7 @@ void basic_tests_init()
|
||||
|
||||
{
|
||||
std::vector<int> v(10);
|
||||
std::iota(v.begin(), v.end(), 0);
|
||||
ba::iota(v.begin(), v.end(), 0);
|
||||
ba::inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<int>(), 40);
|
||||
for (size_t i = 0; i < v.size(); ++i)
|
||||
assert(v[i] == 40 + triangle(i));
|
||||
@ -83,7 +84,7 @@ void basic_tests_init()
|
||||
|
||||
{
|
||||
std::vector<int> v(10);
|
||||
std::iota(v.begin(), v.end(), 1);
|
||||
ba::iota(v.begin(), v.end(), 1);
|
||||
ba::inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<int>(), 30);
|
||||
for (size_t i = 0; i < v.size(); ++i)
|
||||
assert(v[i] == 30 + triangle(i + 1));
|
||||
@ -115,7 +116,7 @@ void basic_tests_op_init()
|
||||
|
||||
{
|
||||
std::vector<int> v(10);
|
||||
std::iota(v.begin(), v.end(), 0);
|
||||
ba::iota(v.begin(), v.end(), 0);
|
||||
ba::inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<int>(), 40);
|
||||
for (size_t i = 0; i < v.size(); ++i)
|
||||
BOOST_CHECK(v[i] == 40 + triangle(i));
|
||||
@ -123,7 +124,7 @@ void basic_tests_op_init()
|
||||
|
||||
{
|
||||
std::vector<int> v(10);
|
||||
std::iota(v.begin(), v.end(), 1);
|
||||
ba::iota(v.begin(), v.end(), 1);
|
||||
ba::inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<int>(), 30);
|
||||
for (size_t i = 0; i < v.size(); ++i)
|
||||
BOOST_CHECK(v[i] == 30 + triangle(i + 1));
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include <numeric>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/algorithm/cxx11/iota.hpp>
|
||||
#include <boost/algorithm/cxx17/transform_exclusive_scan.hpp>
|
||||
|
||||
#include "iterator_test.hpp"
|
||||
@ -96,7 +97,7 @@ void basic_tests()
|
||||
|
||||
{
|
||||
std::vector<int> v(10);
|
||||
std::iota(v.begin(), v.end(), 0);
|
||||
ba::iota(v.begin(), v.end(), 0);
|
||||
ba::transform_exclusive_scan(v.begin(), v.end(), v.begin(), 30, std::plus<int>(), identity<int>());
|
||||
for (size_t i = 0; i < v.size(); ++i)
|
||||
BOOST_CHECK(v[i] == 30 + triangle(i-1));
|
||||
@ -104,7 +105,7 @@ void basic_tests()
|
||||
|
||||
{
|
||||
std::vector<int> v(10);
|
||||
std::iota(v.begin(), v.end(), 1);
|
||||
ba::iota(v.begin(), v.end(), 1);
|
||||
ba::transform_exclusive_scan(v.begin(), v.end(), v.begin(), 40, std::plus<int>(), identity<int>());
|
||||
for (size_t i = 0; i < v.size(); ++i)
|
||||
BOOST_CHECK(v[i] == 40 + triangle(i));
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include <numeric>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/algorithm/cxx11/iota.hpp>
|
||||
#include <boost/algorithm/cxx17/transform_inclusive_scan.hpp>
|
||||
|
||||
#include "iterator_test.hpp"
|
||||
@ -86,7 +87,7 @@ void basic_transform_inclusive_scan_tests()
|
||||
|
||||
{
|
||||
std::vector<int> v(10);
|
||||
std::iota(v.begin(), v.end(), 0);
|
||||
ba::iota(v.begin(), v.end(), 0);
|
||||
ba::transform_inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<int>(), identity<int>());
|
||||
for (size_t i = 0; i < v.size(); ++i)
|
||||
BOOST_CHECK(v[i] == triangle(i));
|
||||
@ -94,7 +95,7 @@ void basic_transform_inclusive_scan_tests()
|
||||
|
||||
{
|
||||
std::vector<int> v(10);
|
||||
std::iota(v.begin(), v.end(), 1);
|
||||
ba::iota(v.begin(), v.end(), 1);
|
||||
ba::transform_inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<int>(), identity<int>());
|
||||
for (size_t i = 0; i < v.size(); ++i)
|
||||
BOOST_CHECK(v[i] == triangle(i + 1));
|
||||
@ -189,7 +190,7 @@ void basic_transform_inclusive_scan_init_tests()
|
||||
|
||||
{
|
||||
std::vector<int> v(10);
|
||||
std::iota(v.begin(), v.end(), 0);
|
||||
ba::iota(v.begin(), v.end(), 0);
|
||||
ba::transform_inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<int>(), identity<int>(), 30);
|
||||
for (size_t i = 0; i < v.size(); ++i)
|
||||
BOOST_CHECK(v[i] == 30 + triangle(i));
|
||||
@ -197,7 +198,7 @@ void basic_transform_inclusive_scan_init_tests()
|
||||
|
||||
{
|
||||
std::vector<int> v(10);
|
||||
std::iota(v.begin(), v.end(), 1);
|
||||
ba::iota(v.begin(), v.end(), 1);
|
||||
ba::transform_inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<int>(), identity<int>(), 40);
|
||||
for (size_t i = 0; i < v.size(); ++i)
|
||||
BOOST_CHECK(v[i] == 40 + triangle(i + 1));
|
||||
|
Reference in New Issue
Block a user