Support assignment from 0, construction from 0, and comparison to zero.

[SVN r16174]
This commit is contained in:
Douglas Gregor
2002-11-09 16:02:47 +00:00
parent 4fed545468
commit 17b311cbbd
5 changed files with 126 additions and 12 deletions

View File

@ -1,6 +1,6 @@
// Boost.Function library
// Copyright (C) 2001 Doug Gregor (gregod@cs.rpi.edu)
// Copyright (C) 2001, 2002 Doug Gregor (gregod@cs.rpi.edu)
//
// Permission to copy, use, sell and distribute this software is granted
// provided this copyright notice appears in all copies.
@ -13,9 +13,7 @@
// For more information, see http://www.boost.org
#define BOOST_INCLUDE_MAIN
#define BOOST_FUNCTION_NO_DEPRECATED
#include <boost/test/test_tools.hpp>
#include <boost/test/minimal.hpp>
#include <boost/function.hpp>
#include <functional>
#include <cassert>
@ -99,7 +97,11 @@ test_zero_args()
BOOST_TEST(global_int == 5);
// clear
#ifndef BOOST_FUNCTION_NO_ENABLE_IF
v1 = 0;
#else
v1.clear();
#endif
BOOST_TEST(0 == v1);
// Assignment to an empty function from a free function
@ -492,6 +494,15 @@ test_zero_args()
v8();
BOOST_TEST(global_int == 2);
// Test construction from 0 and comparison to 0
#ifndef BOOST_FUNCTION_NO_ENABLE_IF
func_void_type v9(0);
#else
func_void_type v9; // just default construct
#endif
BOOST_TEST(v9 == 0);
BOOST_TEST(0 == v9);
// Test return values
typedef function<int ()> func_int_type;
generate_five_obj gen_five;