diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 423f61c..168fb7f 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -84,3 +84,5 @@ run test_return_function.cpp return_function/14 : : : static $(che run quick.cpp ; compile issue_42.cpp ; + +run fn_eq_bind_test.cpp ; diff --git a/test/fn_eq_bind_test.cpp b/test/fn_eq_bind_test.cpp new file mode 100644 index 0000000..b6ad599 --- /dev/null +++ b/test/fn_eq_bind_test.cpp @@ -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 +#include +#include + +using namespace boost::placeholders; + +int f1() { return 1; } +int f2() { return 2; } + +int main() +{ + { + boost::function fn( boost::bind( f1 ) ); + + BOOST_TEST( fn == boost::bind( f1 ) ); + BOOST_TEST( fn != boost::bind( f2 ) ); + } + + { + boost::function fn( boost::bind( f1 ) ); + + BOOST_TEST( fn == boost::bind( f1 ) ); + BOOST_TEST( fn != boost::bind( f2 ) ); + } + + { + boost::function fn( boost::bind( f1 ) ); + + BOOST_TEST( fn == boost::bind( f1 ) ); + BOOST_TEST( fn != boost::bind( f2 ) ); + } + + { + boost::function fn( boost::bind( f1 ) ); + + BOOST_TEST( fn == boost::bind( f1 ) ); + BOOST_TEST( fn != boost::bind( f2 ) ); + } + + { + boost::function fn( boost::bind( f1 ) ); + + BOOST_TEST( fn == boost::bind( f1 ) ); + BOOST_TEST( fn != boost::bind( f2 ) ); + } + + { + boost::function fn( boost::bind( f1 ) ); + + BOOST_TEST( fn == boost::bind( f1 ) ); + BOOST_TEST( fn != boost::bind( f2 ) ); + } + + { + boost::function fn( boost::bind( f1 ) ); + + BOOST_TEST( fn == boost::bind( f1 ) ); + BOOST_TEST( fn != boost::bind( f2 ) ); + } + + { + boost::function fn( boost::bind( f1 ) ); + + BOOST_TEST( fn == boost::bind( f1 ) ); + BOOST_TEST( fn != boost::bind( f2 ) ); + } + + { + boost::function fn( boost::bind( f1 ) ); + + BOOST_TEST( fn == boost::bind( f1 ) ); + BOOST_TEST( fn != boost::bind( f2 ) ); + } + + { + boost::function fn( boost::bind( f1 ) ); + + BOOST_TEST( fn == boost::bind( f1 ) ); + BOOST_TEST( fn != boost::bind( f2 ) ); + } + + return boost::report_errors(); +}