mirror of
https://github.com/ETLCPP/etl.git
synced 2026-06-28 13:28:43 +08:00
Merge remote-tracking branch 'origin/feature/make_tests_c++17_compatible' into development
This commit is contained in:
commit
4d94e2dd34
@ -40,7 +40,7 @@ SOFTWARE.
|
||||
#define ETL_COMPILER_MICROSOFT
|
||||
#define ETL_CPP11_SUPPORTED (_MSC_VER >= 1600)
|
||||
#define ETL_CPP14_SUPPORTED (_MSC_VER >= 1900)
|
||||
#define ETL_CPP17_SUPPORTED 0
|
||||
#define ETL_CPP17_SUPPORTED (_MSC_VER >= 1914)
|
||||
#define ETL_NO_NULLPTR_SUPPORT !ETL_CPP11_SUPPORTED
|
||||
#define ETL_NO_LARGE_CHAR_SUPPORT !ETL_CPP11_SUPPORTED
|
||||
#define ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED ETL_CPP14_SUPPORTED
|
||||
|
||||
@ -61,7 +61,7 @@
|
||||
template <typename TArgumentType, typename TResultType>
|
||||
struct unary_function
|
||||
{
|
||||
typedef TArgumentType aurgument_type;
|
||||
typedef TArgumentType argument_type;
|
||||
typedef TResultType result_type;
|
||||
};
|
||||
|
||||
@ -70,15 +70,15 @@
|
||||
template <typename TFirstArgumentType, typename TSecondArgumentType, typename TResultType>
|
||||
struct binary_function
|
||||
{
|
||||
typedef TFirstArgumentType first_aurgument_type;
|
||||
typedef TSecondArgumentType second_aurgument_type;
|
||||
typedef TFirstArgumentType first_argument_type;
|
||||
typedef TSecondArgumentType second_argument_type;
|
||||
typedef TResultType result_type;
|
||||
};
|
||||
|
||||
//***************************************************************************
|
||||
|
||||
template <typename TFunction>
|
||||
class binder1st : public ETLSTD::unary_function<typename TFunction::second_argument_type, typename TFunction::result_type>
|
||||
class binder1st : public ETLSTD::unary_function<typename TFunction::second_argument_type, typename TFunction::result_type>
|
||||
{
|
||||
protected:
|
||||
|
||||
@ -112,7 +112,7 @@
|
||||
//***************************************************************************
|
||||
|
||||
template <typename TFunction >
|
||||
class binder2nd : public ETLSTD::unary_function<typename TFunction::first_argument_type, typename TFunction::result_type>
|
||||
class binder2nd : public ETLSTD::unary_function<typename TFunction::first_argument_type, typename TFunction::result_type>
|
||||
{
|
||||
protected:
|
||||
TFunction operation;
|
||||
|
||||
@ -36,6 +36,7 @@ set(TEST_SOURCE_FILES
|
||||
test_callback_timer.cpp
|
||||
test_checksum.cpp
|
||||
test_compare.cpp
|
||||
test_compiler_settings.cpp
|
||||
test_constant.cpp
|
||||
test_container.cpp
|
||||
test_crc.cpp
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
<Option type="1" />
|
||||
<Option compiler="gcc" />
|
||||
<Compiler>
|
||||
<Add option="-std=c++11" />
|
||||
<Add option="-std=c++17" />
|
||||
<Add option="-m32" />
|
||||
<Add option="-g" />
|
||||
<Add option="-D_DEBUG" />
|
||||
@ -66,6 +66,8 @@
|
||||
<Add option="-Wshadow" />
|
||||
<Add option="-Wundef" />
|
||||
<Add option="-Wall" />
|
||||
<Add option="-std=c++14" />
|
||||
<Add option="-std=c++17" />
|
||||
<Add option="-std=c++11" />
|
||||
<Add option="-fexceptions" />
|
||||
<Add directory="../../../unittest-cpp/UnitTest++/" />
|
||||
@ -357,6 +359,7 @@
|
||||
<Unit filename="../test_callback_timer.cpp" />
|
||||
<Unit filename="../test_checksum.cpp" />
|
||||
<Unit filename="../test_compare.cpp" />
|
||||
<Unit filename="../test_compiler_settings.cpp" />
|
||||
<Unit filename="../test_constant.cpp" />
|
||||
<Unit filename="../test_container.cpp" />
|
||||
<Unit filename="../test_crc.cpp" />
|
||||
|
||||
@ -36,9 +36,13 @@ SOFTWARE.
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <numeric>
|
||||
#include <random>
|
||||
|
||||
namespace
|
||||
{
|
||||
std::random_device rng;
|
||||
std::mt19937 urng(rng());
|
||||
|
||||
typedef std::vector<int> Data;
|
||||
Data data = { 2, 1, 4, 3, 6, 5, 8, 7, 10, 9 };
|
||||
|
||||
@ -367,8 +371,8 @@ namespace
|
||||
int data3[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
|
||||
// Copy everything less than 5.
|
||||
std::copy_if(std::begin(data1), std::end(data1), std::begin(data2), std::bind2nd(std::less<int>(), 5));
|
||||
etl::copy_if(std::begin(data1), std::end(data1), std::begin(data3), std::bind2nd(std::less<int>(), 5));
|
||||
std::copy_if(std::begin(data1), std::end(data1), std::begin(data2), std::bind(std::less<int>(), std::placeholders::_1, 5));
|
||||
etl::copy_if(std::begin(data1), std::end(data1), std::begin(data3), std::bind(std::less<int>(), std::placeholders::_1, 5));
|
||||
|
||||
bool is_same = std::equal(std::begin(data2), std::end(data2), std::begin(data3));
|
||||
CHECK(is_same);
|
||||
@ -390,7 +394,7 @@ namespace
|
||||
*pout++ = *pin;
|
||||
}
|
||||
}
|
||||
etl::copy_n_if(std::begin(data1), 6, std::begin(data3), std::bind2nd(std::less<int>(), 5));
|
||||
etl::copy_n_if(std::begin(data1), 6, std::begin(data3), std::bind(std::less<int>(), std::placeholders::_1, 5));
|
||||
|
||||
bool is_same = std::equal(std::begin(data2), std::end(data2), std::begin(data3));
|
||||
CHECK(is_same);
|
||||
@ -413,21 +417,21 @@ namespace
|
||||
|
||||
// Exact size.
|
||||
std::fill(std::begin(out1), std::end(out1), 0);
|
||||
result = etl::copy_if(std::begin(data1), std::end(data1), std::begin(out1), std::end(out1), std::bind2nd(std::less<int>(), 5));
|
||||
result = etl::copy_if(std::begin(data1), std::end(data1), std::begin(out1), std::end(out1), std::bind(std::less<int>(), std::placeholders::_1, 5));
|
||||
CHECK_EQUAL(std::end(out1), result);
|
||||
bool is_same = std::equal(std::begin(out1), std::end(out1), std::begin(check1));
|
||||
CHECK(is_same);
|
||||
|
||||
// Destination smaller.
|
||||
std::fill(std::begin(out2), std::end(out2), 0);
|
||||
result = etl::copy_if(std::begin(data1), std::end(data1), std::begin(out2), std::end(out2), std::bind2nd(std::less<int>(), 5));
|
||||
result = etl::copy_if(std::begin(data1), std::end(data1), std::begin(out2), std::end(out2), std::bind(std::less<int>(), std::placeholders::_1, 5));
|
||||
CHECK_EQUAL(std::end(out2), result);
|
||||
is_same = std::equal(std::begin(out2), std::end(out2), std::begin(check2));
|
||||
CHECK(is_same);
|
||||
|
||||
// Destination larger.
|
||||
std::fill(std::begin(out3), std::end(out3), 0);
|
||||
result = etl::copy_if(std::begin(data1), std::end(data1), std::begin(out3), std::end(out3), std::bind2nd(std::less<int>(), 5));
|
||||
result = etl::copy_if(std::begin(data1), std::end(data1), std::begin(out3), std::end(out3), std::bind(std::less<int>(), std::placeholders::_1, 5));
|
||||
CHECK_EQUAL(std::begin(out3) + 4, result);
|
||||
is_same = std::equal(std::begin(out3), std::end(out3), std::begin(check3));
|
||||
CHECK(is_same);
|
||||
@ -438,12 +442,12 @@ namespace
|
||||
{
|
||||
int data1[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
|
||||
|
||||
bool expected = std::any_of(std::begin(data1), std::end(data1), std::bind2nd(std::greater<int>(), 4));
|
||||
bool result = etl::any_of(std::begin(data1), std::end(data1), std::bind2nd(std::greater<int>(), 4));
|
||||
bool expected = std::any_of(std::begin(data1), std::end(data1), std::bind(std::greater<int>(), std::placeholders::_1, 4));
|
||||
bool result = etl::any_of(std::begin(data1), std::end(data1), std::bind(std::greater<int>(), std::placeholders::_1, 4));
|
||||
CHECK_EQUAL(expected, result);
|
||||
|
||||
expected = std::any_of(std::begin(data1), std::end(data1), std::bind2nd(std::greater<int>(), 0));
|
||||
result = etl::any_of(std::begin(data1), std::end(data1), std::bind2nd(std::greater<int>(), 0));
|
||||
expected = std::any_of(std::begin(data1), std::end(data1), std::bind(std::greater<int>(), std::placeholders::_1, 0));
|
||||
result = etl::any_of(std::begin(data1), std::end(data1), std::bind(std::greater<int>(), std::placeholders::_1, 0));
|
||||
CHECK_EQUAL(expected, result);
|
||||
}
|
||||
|
||||
@ -452,12 +456,12 @@ namespace
|
||||
{
|
||||
int data1[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
|
||||
|
||||
bool expected = std::all_of(std::begin(data1), std::end(data1), std::bind2nd(std::greater<int>(), 0));
|
||||
bool result = etl::all_of(std::begin(data1), std::end(data1), std::bind2nd(std::greater<int>(), 0));
|
||||
bool expected = std::all_of(std::begin(data1), std::end(data1), std::bind(std::greater<int>(), std::placeholders::_1, 0));
|
||||
bool result = etl::all_of(std::begin(data1), std::end(data1), std::bind(std::greater<int>(), std::placeholders::_1, 0));
|
||||
CHECK_EQUAL(expected, result);
|
||||
|
||||
expected = std::all_of(std::begin(data1), std::end(data1), std::bind2nd(std::greater<int>(), 4));
|
||||
result = etl::all_of(std::begin(data1), std::end(data1), std::bind2nd(std::greater<int>(), 4));
|
||||
expected = std::all_of(std::begin(data1), std::end(data1), std::bind(std::greater<int>(), std::placeholders::_1, 4));
|
||||
result = etl::all_of(std::begin(data1), std::end(data1), std::bind(std::greater<int>(), std::placeholders::_1, 4));
|
||||
CHECK_EQUAL(expected, result);
|
||||
}
|
||||
|
||||
@ -466,16 +470,16 @@ namespace
|
||||
{
|
||||
int data1[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
|
||||
|
||||
bool expected = std::none_of(std::begin(data1), std::end(data1), std::bind2nd(std::greater<int>(), 8));
|
||||
bool result = etl::none_of(std::begin(data1), std::end(data1), std::bind2nd(std::greater<int>(), 8));
|
||||
bool expected = std::none_of(std::begin(data1), std::end(data1), std::bind(std::greater<int>(), std::placeholders::_1, 8));
|
||||
bool result = etl::none_of(std::begin(data1), std::end(data1), std::bind(std::greater<int>(), std::placeholders::_1, 8));
|
||||
CHECK_EQUAL(expected, result);
|
||||
|
||||
expected = std::none_of(std::begin(data1), std::end(data1), std::bind2nd(std::greater<int>(), 4));
|
||||
result = etl::none_of(std::begin(data1), std::end(data1), std::bind2nd(std::greater<int>(), 4));
|
||||
expected = std::none_of(std::begin(data1), std::end(data1), std::bind(std::greater<int>(), std::placeholders::_1, 4));
|
||||
result = etl::none_of(std::begin(data1), std::end(data1), std::bind(std::greater<int>(), std::placeholders::_1, 4));
|
||||
CHECK_EQUAL(expected, result);
|
||||
}
|
||||
|
||||
struct Compare : public std::binary_function < int, int, bool >
|
||||
struct Compare
|
||||
{
|
||||
bool operator()(int a, int b) const
|
||||
{
|
||||
@ -520,14 +524,14 @@ namespace
|
||||
{
|
||||
int data1[] = { 1, 2, 3, 4, 5, 6, 7, 8 };
|
||||
|
||||
bool expected = std::is_partitioned(std::begin(data1), std::end(data1), std::bind2nd(std::greater<int>(), 4));
|
||||
bool result = etl::is_partitioned(std::begin(data1), std::end(data1), std::bind2nd(std::greater<int>(), 4));
|
||||
bool expected = std::is_partitioned(std::begin(data1), std::end(data1), std::bind(std::greater<int>(), std::placeholders::_1, 4));
|
||||
bool result = etl::is_partitioned(std::begin(data1), std::end(data1), std::bind(std::greater<int>(), std::placeholders::_1, 4));
|
||||
CHECK_EQUAL(expected, result);
|
||||
|
||||
std::partition(std::begin(data1), std::end(data1), std::bind2nd(std::greater<int>(), 4));
|
||||
std::partition(std::begin(data1), std::end(data1), std::bind(std::greater<int>(), std::placeholders::_1, 4));
|
||||
|
||||
expected = std::is_partitioned(std::begin(data1), std::end(data1), std::bind2nd(std::greater<int>(), 4));
|
||||
result = etl::is_partitioned(std::begin(data1), std::end(data1), std::bind2nd(std::greater<int>(), 4));
|
||||
expected = std::is_partitioned(std::begin(data1), std::end(data1), std::bind(std::greater<int>(), std::placeholders::_1, 4));
|
||||
result = etl::is_partitioned(std::begin(data1), std::end(data1), std::bind(std::greater<int>(), std::placeholders::_1, 4));
|
||||
CHECK_EQUAL(expected, result);
|
||||
}
|
||||
|
||||
@ -536,16 +540,16 @@ namespace
|
||||
{
|
||||
int data1[] = { 1, 2, 3, 4, 5, 6, 7, 8 };
|
||||
|
||||
std::partition(std::begin(data1), std::end(data1), std::bind2nd(std::greater<int>(), 4));
|
||||
std::partition(std::begin(data1), std::end(data1), std::bind(std::greater<int>(), std::placeholders::_1, 4));
|
||||
|
||||
int* partition1 = std::partition_point(std::begin(data1), std::end(data1), std::bind2nd(std::greater<int>(), 4));
|
||||
int* partition2 = etl::partition_point(std::begin(data1), std::end(data1), std::bind2nd(std::greater<int>(), 4));
|
||||
int* partition1 = std::partition_point(std::begin(data1), std::end(data1), std::bind(std::greater<int>(), std::placeholders::_1, 4));
|
||||
int* partition2 = etl::partition_point(std::begin(data1), std::end(data1), std::bind(std::greater<int>(), std::placeholders::_1, 4));
|
||||
CHECK_EQUAL(std::distance(std::begin(data1), partition1), std::distance(std::begin(data1), partition2));
|
||||
|
||||
std::partition(std::begin(data1), std::end(data1), std::bind2nd(std::greater<int>(), 8));
|
||||
std::partition(std::begin(data1), std::end(data1), std::bind(std::greater<int>(), std::placeholders::_1, 8));
|
||||
|
||||
partition1 = std::partition_point(std::begin(data1), std::end(data1), std::bind2nd(std::greater<int>(), 0));
|
||||
partition2 = etl::partition_point(std::begin(data1), std::end(data1), std::bind2nd(std::greater<int>(), 0));
|
||||
partition1 = std::partition_point(std::begin(data1), std::end(data1), std::bind(std::greater<int>(), std::placeholders::_1, 0));
|
||||
partition2 = etl::partition_point(std::begin(data1), std::end(data1), std::bind(std::greater<int>(), std::placeholders::_1, 0));
|
||||
CHECK_EQUAL(std::distance(std::begin(data1), partition1), std::distance(std::begin(data1), partition2));
|
||||
}
|
||||
|
||||
@ -558,8 +562,8 @@ namespace
|
||||
int data4[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
int data5[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
|
||||
std::partition_copy(std::begin(data1), std::end(data1), std::begin(data2), std::begin(data3), std::bind2nd(std::greater<int>(), 4));
|
||||
etl::partition_copy(std::begin(data1), std::end(data1), std::begin(data4), std::begin(data5), std::bind2nd(std::greater<int>(), 4));
|
||||
std::partition_copy(std::begin(data1), std::end(data1), std::begin(data2), std::begin(data3), std::bind(std::greater<int>(), std::placeholders::_1, 4));
|
||||
etl::partition_copy(std::begin(data1), std::end(data1), std::begin(data4), std::begin(data5), std::bind(std::greater<int>(), std::placeholders::_1, 4));
|
||||
|
||||
bool are_equal;
|
||||
|
||||
@ -576,7 +580,7 @@ namespace
|
||||
int data1[] = { 1, 2, 3, 5, 6, 7, 8 };
|
||||
|
||||
// Find the element not less than 4.
|
||||
int* p = etl::find_if_not(std::begin(data1), std::end(data1), std::bind2nd(std::less<int>(), 4));
|
||||
int* p = etl::find_if_not(std::begin(data1), std::end(data1), std::bind(std::less<int>(), std::placeholders::_1, 4));
|
||||
CHECK_EQUAL(5, *p);
|
||||
}
|
||||
|
||||
@ -633,7 +637,7 @@ namespace
|
||||
accumulator = etl::for_each_if(std::begin(data1),
|
||||
std::end(data1),
|
||||
accumulator,
|
||||
std::bind2nd(std::less<int>(), 5));
|
||||
std::bind(std::less<int>(), std::placeholders::_1, 5));
|
||||
|
||||
CHECK_EQUAL(10, accumulator.sum);
|
||||
}
|
||||
@ -672,7 +676,7 @@ namespace
|
||||
}
|
||||
} multiplier;
|
||||
|
||||
etl::for_each_n_if(std::begin(data1), 5, multiplier, std::bind2nd(std::less<int>(), 5));
|
||||
etl::for_each_n_if(std::begin(data1), 5, multiplier, std::bind(std::less<int>(), std::placeholders::_1, 5));
|
||||
|
||||
bool are_equal = std::equal(std::begin(data1), std::end(data1), std::begin(data2));
|
||||
CHECK(are_equal);
|
||||
@ -690,7 +694,7 @@ namespace
|
||||
std::end(input),
|
||||
std::begin(output),
|
||||
std::begin(output) + (etl::size(output) / 2),
|
||||
std::bind2nd(std::multiplies<int>(), 2));
|
||||
std::bind(std::multiplies<int>(), std::placeholders::_1, 2));
|
||||
|
||||
bool is_same = std::equal(std::begin(output), std::end(output), std::begin(compare));
|
||||
CHECK(is_same);
|
||||
@ -701,7 +705,7 @@ namespace
|
||||
std::begin(input) + (etl::size(input) / 2),
|
||||
std::begin(output),
|
||||
std::end(output),
|
||||
std::bind2nd(std::multiplies<int>(), 2));
|
||||
std::bind(std::multiplies<int>(), std::placeholders::_1, 2));
|
||||
|
||||
is_same = std::equal(std::begin(output), std::end(output), std::begin(compare));
|
||||
CHECK(is_same);
|
||||
@ -717,7 +721,7 @@ namespace
|
||||
etl::transform_n(std::begin(input),
|
||||
7,
|
||||
std::begin(output),
|
||||
std::bind2nd(std::multiplies<int>(), 2));
|
||||
std::bind(std::multiplies<int>(), std::placeholders::_1, 2));
|
||||
|
||||
bool is_same = std::equal(std::begin(output), std::end(output), std::begin(compare));
|
||||
CHECK(is_same);
|
||||
@ -733,7 +737,7 @@ namespace
|
||||
etl::transform_n(std::begin(input),
|
||||
7,
|
||||
std::begin(output),
|
||||
std::bind2nd(std::multiplies<int>(), 2));
|
||||
std::bind(std::multiplies<int>(), std::placeholders::_1, 2));
|
||||
|
||||
bool is_same = std::equal(std::begin(output), std::end(output), std::begin(compare));
|
||||
CHECK(is_same);
|
||||
@ -750,8 +754,8 @@ namespace
|
||||
etl::transform_if(std::begin(input),
|
||||
std::end(input),
|
||||
std::begin(output),
|
||||
std::bind2nd(std::multiplies<int>(), 2),
|
||||
std::bind2nd(std::less<int>(), 5));
|
||||
std::bind(std::multiplies<int>(), std::placeholders::_1, 2),
|
||||
std::bind(std::less<int>(), std::placeholders::_1, 5));
|
||||
|
||||
bool is_same = std::equal(std::begin(output), std::end(output), std::begin(compare));
|
||||
CHECK(is_same);
|
||||
@ -788,8 +792,8 @@ namespace
|
||||
etl::transform_n_if(std::begin(input),
|
||||
5,
|
||||
std::begin(output),
|
||||
std::bind2nd(std::multiplies<int>(), 2),
|
||||
std::bind2nd(std::less<int>(), 5));
|
||||
std::bind(std::multiplies<int>(), std::placeholders::_1, 2),
|
||||
std::bind(std::less<int>(), std::placeholders::_1, 5));
|
||||
|
||||
bool is_same = std::equal(std::begin(output), std::end(output), std::begin(compare));
|
||||
CHECK(is_same);
|
||||
@ -830,9 +834,9 @@ namespace
|
||||
std::end(input),
|
||||
std::begin(output_true),
|
||||
std::begin(output_false),
|
||||
std::bind2nd(std::multiplies<int>(), 2),
|
||||
std::bind2nd(std::multiplies<int>(), -2),
|
||||
std::bind2nd(std::less<int>(), 5));
|
||||
std::bind(std::multiplies<int>(), std::placeholders::_1, 2),
|
||||
std::bind(std::multiplies<int>(), std::placeholders::_1, -2),
|
||||
std::bind(std::less<int>(), std::placeholders::_1, 5));
|
||||
|
||||
bool is_same = std::equal(std::begin(output_true), std::end(output_true), std::begin(compare_true));
|
||||
CHECK(is_same);
|
||||
@ -876,7 +880,7 @@ namespace
|
||||
|
||||
for (int i = 0; i < 100; ++i)
|
||||
{
|
||||
std::random_shuffle(data.begin(), data.end());
|
||||
std::shuffle(data.begin(), data.end(), urng);
|
||||
|
||||
std::vector<int> data1 = data;
|
||||
std::vector<int> data2 = data;
|
||||
@ -897,7 +901,7 @@ namespace
|
||||
|
||||
for (int i = 0; i < 100; ++i)
|
||||
{
|
||||
std::random_shuffle(data.begin(), data.end());
|
||||
std::shuffle(data.begin(), data.end(), urng);
|
||||
|
||||
std::vector<int> data1 = data;
|
||||
std::vector<int> data2 = data;
|
||||
|
||||
48
test/test_compiler_settings.cpp
Normal file
48
test/test_compiler_settings.cpp
Normal file
@ -0,0 +1,48 @@
|
||||
/******************************************************************************
|
||||
The MIT License(MIT)
|
||||
|
||||
Embedded Template Library.
|
||||
https://github.com/ETLCPP/etl
|
||||
https://www.etlcpp.com
|
||||
|
||||
Copyright(c) 2019 jwellbelove
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files(the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions :
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#include "UnitTest++.h"
|
||||
|
||||
#include "etl/platform.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
const bool cpp11_supported = ETL_CPP11_SUPPORTED;
|
||||
const bool cpp14_supported = ETL_CPP14_SUPPORTED;
|
||||
const bool cpp17_supported = ETL_CPP17_SUPPORTED;
|
||||
|
||||
SUITE(test_compiler_settings)
|
||||
{
|
||||
TEST(test_cpp)
|
||||
{
|
||||
CHECK(cpp11_supported);
|
||||
CHECK(cpp14_supported);
|
||||
CHECK(cpp17_supported);
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -1008,8 +1008,8 @@ namespace
|
||||
CompareDataNDC compare_data(sorted_data.begin(), sorted_data.end());
|
||||
DataNDC data(sorted_data.begin(), sorted_data.end());
|
||||
|
||||
compare_data.remove_if(std::bind2nd(std::equal_to<ItemNDC>(), ItemNDC("7")));
|
||||
data.remove_if(std::bind2nd(std::equal_to<ItemNDC>(), ItemNDC("7")));
|
||||
compare_data.remove_if(std::bind(std::equal_to<ItemNDC>(), std::placeholders::_1, ItemNDC("7")));
|
||||
data.remove_if(std::bind(std::equal_to<ItemNDC>(), std::placeholders::_1, ItemNDC("7")));
|
||||
|
||||
CHECK_EQUAL(size_t(std::distance(compare_data.begin(), compare_data.end())), data.size());
|
||||
|
||||
|
||||
@ -1281,9 +1281,9 @@ namespace
|
||||
DataNDC data1(sorted_data.begin(), sorted_data.end(), pool);
|
||||
DataNDC data2(sorted_data.begin(), sorted_data.end(), pool);
|
||||
|
||||
compare_data.remove_if(std::bind2nd(std::equal_to<ItemNDC>(), ItemNDC("7")));
|
||||
data1.remove_if(std::bind2nd(std::equal_to<ItemNDC>(), ItemNDC("7")));
|
||||
data2.remove_if(std::bind2nd(std::equal_to<ItemNDC>(), ItemNDC("7")));
|
||||
compare_data.remove_if(std::bind(std::equal_to<ItemNDC>(), std::placeholders::_1, ItemNDC("7")));
|
||||
data1.remove_if(std::bind(std::equal_to<ItemNDC>(), std::placeholders::_1, ItemNDC("7")));
|
||||
data2.remove_if(std::bind(std::equal_to<ItemNDC>(), std::placeholders::_1, ItemNDC("7")));
|
||||
|
||||
CHECK_EQUAL(size_t(std::distance(compare_data.begin(), compare_data.end())), data1.size());
|
||||
CHECK_EQUAL(size_t(std::distance(compare_data.begin(), compare_data.end())), data2.size());
|
||||
|
||||
@ -697,8 +697,8 @@ namespace
|
||||
DataNDC0 data0(sorted_data.begin(), sorted_data.end());
|
||||
DataNDC1 data1(sorted_data.begin(), sorted_data.end());
|
||||
|
||||
compare_data.remove_if(std::bind2nd(std::equal_to<ItemNDCNode>(), ItemNDCNode("7")));
|
||||
data0.remove_if(std::bind2nd(std::equal_to<ItemNDCNode>(), ItemNDCNode("7")));
|
||||
compare_data.remove_if(std::bind(std::equal_to<ItemNDCNode>(), std::placeholders::_1, ItemNDCNode("7")));
|
||||
data0.remove_if(std::bind(std::equal_to<ItemNDCNode>(), std::placeholders::_1, ItemNDCNode("7")));
|
||||
|
||||
are_equal = std::equal(data0.begin(), data0.end(), compare_data.begin());
|
||||
|
||||
|
||||
@ -738,7 +738,7 @@ namespace
|
||||
|
||||
std::vector<ItemNDCNode>::iterator i_item = std::find(compare_data.begin(), compare_data.end(), ItemNDCNode("7"));
|
||||
compare_data.erase(i_item);
|
||||
data0.remove_if(std::bind2nd(std::equal_to<ItemNDCNode>(), ItemNDCNode("7")));
|
||||
data0.remove_if(std::bind(std::equal_to<ItemNDCNode>(), std::placeholders::_1, ItemNDCNode("7")));
|
||||
|
||||
are_equal = std::equal(data0.begin(), data0.end(), compare_data.begin());
|
||||
|
||||
|
||||
@ -1188,8 +1188,8 @@ namespace
|
||||
CompareData compare_data(sorted_data.begin(), sorted_data.end());
|
||||
DataNDC data(sorted_data.begin(), sorted_data.end());
|
||||
|
||||
compare_data.remove_if(std::bind2nd(std::equal_to<ItemNDC>(), ItemNDC("7")));
|
||||
data.remove_if(std::bind2nd(std::equal_to<ItemNDC>(), ItemNDC("7")));
|
||||
compare_data.remove_if(std::bind(std::equal_to<ItemNDC>(), std::placeholders::_1, ItemNDC("7")));
|
||||
data.remove_if(std::bind(std::equal_to<ItemNDC>(), std::placeholders::_1, ItemNDC("7")));
|
||||
|
||||
CHECK_EQUAL(compare_data.size(), data.size());
|
||||
|
||||
|
||||
@ -1324,9 +1324,9 @@ namespace
|
||||
DataNDC data1(sorted_data.begin(), sorted_data.end(), pool);
|
||||
DataNDC data2(sorted_data.begin(), sorted_data.end(), pool);
|
||||
|
||||
compare_data.remove_if(std::bind2nd(std::equal_to<ItemNDC>(), ItemNDC("7")));
|
||||
data1.remove_if(std::bind2nd(std::equal_to<ItemNDC>(), ItemNDC("7")));
|
||||
data2.remove_if(std::bind2nd(std::equal_to<ItemNDC>(), ItemNDC("7")));
|
||||
compare_data.remove_if(std::bind(std::equal_to<ItemNDC>(), std::placeholders::_1, ItemNDC("7")));
|
||||
data1.remove_if(std::bind(std::equal_to<ItemNDC>(), std::placeholders::_1, ItemNDC("7")));
|
||||
data2.remove_if(std::bind(std::equal_to<ItemNDC>(), std::placeholders::_1, ItemNDC("7")));
|
||||
|
||||
CHECK_EQUAL(compare_data.size(), data1.size());
|
||||
CHECK_EQUAL(compare_data.size(), data2.size());
|
||||
|
||||
@ -110,7 +110,7 @@ namespace
|
||||
// return os;
|
||||
// }
|
||||
|
||||
struct Greater : public std::binary_function<int, int, bool>
|
||||
struct Greater : public etlstd::binary_function<int, int, bool>
|
||||
{
|
||||
bool operator()(int a, int b) const
|
||||
{
|
||||
|
||||
@ -40,8 +40,8 @@ namespace
|
||||
{
|
||||
return TCompare()(a, b);
|
||||
}
|
||||
|
||||
struct test : std::binary_function<int, int, bool>
|
||||
|
||||
struct test : etlstd::binary_function<int, int, bool>
|
||||
{
|
||||
bool operator()(int a, int b) const
|
||||
{
|
||||
|
||||
@ -200,7 +200,7 @@
|
||||
<UndefinePreprocessorDefinitions>
|
||||
</UndefinePreprocessorDefinitions>
|
||||
<MultiProcessorCompilation>false</MultiProcessorCompilation>
|
||||
<LanguageStandard>stdcpp14</LanguageStandard>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
@ -659,6 +659,7 @@
|
||||
<ClCompile Include="..\test_algorithm.cpp" />
|
||||
<ClCompile Include="..\test_alignment.cpp" />
|
||||
<ClCompile Include="..\test_callback_service.cpp" />
|
||||
<ClCompile Include="..\test_compiler_settings.cpp" />
|
||||
<ClCompile Include="..\test_cumulative_moving_average.cpp" />
|
||||
<ClCompile Include="..\test_delegate.cpp" />
|
||||
<ClCompile Include="..\test_delegate_service.cpp" />
|
||||
|
||||
@ -1220,6 +1220,9 @@
|
||||
<ClCompile Include="..\test_delegate_service.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\test_compiler_settings.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\library.properties">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user