mirror of
https://github.com/boostorg/lambda2.git
synced 2026-01-19 04:22:07 +00:00
Add test/placeholders.cpp
This commit is contained in:
@@ -20,3 +20,4 @@ run lambda2_test.cpp ;
|
||||
run version.cpp ;
|
||||
run lookup_problem.cpp ;
|
||||
run dereference.cpp ;
|
||||
run placeholders.cpp ;
|
||||
|
||||
29
test/placeholders.cpp
Normal file
29
test/placeholders.cpp
Normal file
@@ -0,0 +1,29 @@
|
||||
// Copyright 2021 Peter Dimov
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// https://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#include <boost/lambda2.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#include <functional>
|
||||
|
||||
int f( int x )
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
using namespace boost::lambda2;
|
||||
|
||||
BOOST_TEST_EQ( std::bind(f, _1)( 1 ), 1 );
|
||||
BOOST_TEST_EQ( std::bind(f, _2)( 1, 2 ), 2 );
|
||||
BOOST_TEST_EQ( std::bind(f, _3)( 1, 2, 3 ), 3 );
|
||||
BOOST_TEST_EQ( std::bind(f, _4)( 1, 2, 3, 4 ), 4 );
|
||||
BOOST_TEST_EQ( std::bind(f, _5)( 1, 2, 3, 4, 5 ), 5 );
|
||||
BOOST_TEST_EQ( std::bind(f, _6)( 1, 2, 3, 4, 5, 6 ), 6 );
|
||||
BOOST_TEST_EQ( std::bind(f, _7)( 1, 2, 3, 4, 5, 6, 7 ), 7 );
|
||||
BOOST_TEST_EQ( std::bind(f, _8)( 1, 2, 3, 4, 5, 6, 7, 8 ), 8 );
|
||||
BOOST_TEST_EQ( std::bind(f, _9)( 1, 2, 3, 4, 5, 6, 7, 8, 9 ), 9 );
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
Reference in New Issue
Block a user