1
0
forked from boostorg/bind

Test <functional> objects which had their result_types removed in C++20

This commit is contained in:
Peter Dimov
2020-06-30 03:07:18 +03:00
parent cd32792f0e
commit 5340508c16
2 changed files with 38 additions and 0 deletions

View File

@@ -74,3 +74,4 @@ run bind_noexcept_test.cpp ;
run bind_noexcept_mf_test.cpp ;
run global_placeholders.cpp ;
run mem_fn_noexcept_test.cpp ;
run bind_cpp20_test.cpp ;

37
test/bind_cpp20_test.cpp Normal file
View File

@@ -0,0 +1,37 @@
// Copyright 2020 Peter Dimov
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt)
#include <boost/bind/bind.hpp>
#include <boost/core/lightweight_test.hpp>
#include <functional>
//
int main()
{
BOOST_TEST_EQ( boost::bind( std::plus<int>(), 1, 2 )(), 3 );
BOOST_TEST_EQ( boost::bind( std::minus<int>(), 1, 2 )(), -1 );
BOOST_TEST_EQ( boost::bind( std::multiplies<int>(), 1, 2 )(), 2 );
BOOST_TEST_EQ( boost::bind( std::divides<int>(), 1, 2 )(), 0 );
BOOST_TEST_EQ( boost::bind( std::modulus<int>(), 1, 2 )(), 1 );
BOOST_TEST_EQ( boost::bind( std::negate<int>(), 1 )(), -1 );
BOOST_TEST_EQ( boost::bind( std::equal_to<int>(), 1, 2 )(), false );
BOOST_TEST_EQ( boost::bind( std::not_equal_to<int>(), 1, 2 )(), true );
BOOST_TEST_EQ( boost::bind( std::greater<int>(), 1, 2 )(), false );
BOOST_TEST_EQ( boost::bind( std::less<int>(), 1, 2 )(), true );
BOOST_TEST_EQ( boost::bind( std::greater_equal<int>(), 1, 2 )(), false );
BOOST_TEST_EQ( boost::bind( std::less_equal<int>(), 1, 2 )(), true );
BOOST_TEST_EQ( boost::bind( std::logical_and<int>(), 1, 2 )(), true );
BOOST_TEST_EQ( boost::bind( std::logical_or<int>(), 1, 2 )(), true );
BOOST_TEST_EQ( boost::bind( std::logical_not<int>(), 1 )(), false );
BOOST_TEST_EQ( boost::bind( std::bit_and<int>(), 1, 2 )(), 0 );
BOOST_TEST_EQ( boost::bind( std::bit_or<int>(), 1, 2 )(), 3 );
BOOST_TEST_EQ( boost::bind( std::bit_xor<int>(), 1, 2 )(), 3 );
BOOST_TEST_EQ( boost::bind( std::bit_not<int>(), 1 )(), ~1 );
return boost::report_errors();
}