Skip to content

Commit

Permalink
Add fn_eq_bind_test. Refs #45.
Browse files Browse the repository at this point in the history
  • Loading branch information
pdimov committed Feb 12, 2023
1 parent 0bb1247 commit 6961c50
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 0 deletions.
2 changes: 2 additions & 0 deletions test/Jamfile.v2
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,5 @@ run test_return_function.cpp return_function/<cxxstd>14 : : : <link>static $(che
run quick.cpp ;

compile issue_42.cpp ;

run fn_eq_bind_test.cpp ;
87 changes: 87 additions & 0 deletions test/fn_eq_bind_test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
// Copyright 2023 Peter Dimov
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt

#include <boost/function.hpp>
#include <boost/bind/bind.hpp>
#include <boost/core/lightweight_test.hpp>

using namespace boost::placeholders;

int f1() { return 1; }
int f2() { return 2; }

int main()
{
{
boost::function<int()> fn( boost::bind( f1 ) );

BOOST_TEST( fn == boost::bind( f1 ) );
BOOST_TEST( fn != boost::bind( f2 ) );
}

{
boost::function<int(int)> fn( boost::bind( f1 ) );

BOOST_TEST( fn == boost::bind( f1 ) );
BOOST_TEST( fn != boost::bind( f2 ) );
}

{
boost::function<int(int, int)> fn( boost::bind( f1 ) );

BOOST_TEST( fn == boost::bind( f1 ) );
BOOST_TEST( fn != boost::bind( f2 ) );
}

{
boost::function<int(int, int, int)> fn( boost::bind( f1 ) );

BOOST_TEST( fn == boost::bind( f1 ) );
BOOST_TEST( fn != boost::bind( f2 ) );
}

{
boost::function<int(int, int, int, int)> fn( boost::bind( f1 ) );

BOOST_TEST( fn == boost::bind( f1 ) );
BOOST_TEST( fn != boost::bind( f2 ) );
}

{
boost::function<int(int, int, int, int, int)> fn( boost::bind( f1 ) );

BOOST_TEST( fn == boost::bind( f1 ) );
BOOST_TEST( fn != boost::bind( f2 ) );
}

{
boost::function<int(int, int, int, int, int, int)> fn( boost::bind( f1 ) );

BOOST_TEST( fn == boost::bind( f1 ) );
BOOST_TEST( fn != boost::bind( f2 ) );
}

{
boost::function<int(int, int, int, int, int, int, int)> fn( boost::bind( f1 ) );

BOOST_TEST( fn == boost::bind( f1 ) );
BOOST_TEST( fn != boost::bind( f2 ) );
}

{
boost::function<int(int, int, int, int, int, int, int, int)> fn( boost::bind( f1 ) );

BOOST_TEST( fn == boost::bind( f1 ) );
BOOST_TEST( fn != boost::bind( f2 ) );
}

{
boost::function<int(int, int, int, int, int, int, int, int, int)> fn( boost::bind( f1 ) );

BOOST_TEST( fn == boost::bind( f1 ) );
BOOST_TEST( fn != boost::bind( f2 ) );
}

return boost::report_errors();
}

0 comments on commit 6961c50

Please sign in to comment.