Syntax error when using BOOST_CHECK_PREDICATE

Reading this article:
http://www.ibm.com/developerworks/aix/library/au-ctools1_boost/?S_TACT=105AGY20&S_CMP=HP
I'm using Boost 1.40.0 and Visual Studio 2005 with Visual C++ 8.0.
I've entered Listing 14 with a few additional lines of logging code:
#include "stdafx.h"
#define BOOST_TEST_MODULE example
#include

Andrew J. Leer
BOOST_AUTO_TEST_CASE( test ) { std::list<int>& list1 = user_defined_func(); BOOST_CHECK_PREDICATE( validate_list, list1 );
I believe this should be BOOST_CHECK_PREDICATE( validate_list, (list1) ); Gennadiy

Gennadiy, I tried changing what you stated
BOOST_AUTO_TEST_CASE( test ) { std::list<int>& list1 = user_defined_func(); BOOST_CHECK_PREDICATE( validate_list, list1 );
I believe this should be BOOST_CHECK_PREDICATE( validate_list, (list1) );
However upon doing that I get another error (something to do with templates)
1>------ Rebuild All started: Project: UnitTestTests, Configuration:
Debug Win32 ------
1>Deleting intermediate and output files for project 'UnitTestTests',
configuration 'Debug|Win32'
1>Compiling...
1>stdafx.cpp
1>Compiling...
1>UnitTestTests.cpp
1>c:\program files
(x86)\boost\boost_1_40\boost\test\impl\execution_monitor.ipp(904) :
warning C4535: calling _set_se_translator() requires /EHa
1>c:\program files
(x86)\boost\boost_1_40\boost\test\utils\runtime\config.hpp(90) :
warning C4996: 'putenv': The POSIX name for this item is deprecated.
Instead, use the ISO C++ conformant name: _putenv. See online help for
details.
1> c:\program files (x86)\microsoft visual studio
8\vc\include\stdlib.h(900) : see declaration of 'putenv'
1>c:\program files
(x86)\boost\boost_1_40\boost\test\utils\runtime\cla\char_parameter.ipp(36)
: warning C4244: 'argument' : conversion from 'boost::rtti::id_t' to
'const int', possible loss of data
1>c:\program files
(x86)\boost\boost_1_40\boost\test\utils\runtime\cla\named_parameter.ipp(41)
: warning C4244: 'argument' : conversion from 'boost::rtti::id_t' to
'const int', possible loss of data
1>c:\program files
(x86)\boost\boost_1_40\boost\test\utils\runtime\env\environment.ipp(82)
: warning C4996: 'getenv': This function or variable may be unsafe.
Consider using _dupenv_s instead. To disable deprecation, use
_CRT_SECURE_NO_WARNINGS. See online help for details.
1> c:\program files (x86)\microsoft visual studio
8\vc\include\stdlib.h(483) : see declaration of 'getenv'
1>c:\program files
(x86)\boost\boost_1_40\boost\test\utils\runtime\cla\id_policy.hpp(88)
: warning C4244: 'argument' : conversion from 'boost::rtti::id_t' to
'const int', possible loss of data
1> c:\program files
(x86)\boost\boost_1_40\boost\test\utils\runtime\cla\id_policy.hpp(84)
: while compiling class template member function
'boost::runtime::cla::dual_id_policy
Andrew J. Leer
writes: BOOST_AUTO_TEST_CASE( test ) { std::list<int>& list1 = user_defined_func(); BOOST_CHECK_PREDICATE( validate_list, list1 );
I believe this should be BOOST_CHECK_PREDICATE( validate_list, (list1) );
Gennadiy
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

Andrew J. Leer wrote:
Gennadiy, I tried changing what you stated
BOOST_AUTO_TEST_CASE( test ) { std::list<int>& list1 = user_defined_func(); BOOST_CHECK_PREDICATE( validate_list, list1 );
I believe this should be BOOST_CHECK_PREDICATE( validate_list, (list1) );
However upon doing that I get another error (something to do with templates)
Please post small example illustrating the problem. Gennadiy

Here is my example:
#include "stdafx.h"
#define BOOST_TEST_MODULE example
#include
Andrew J. Leer wrote:
Gennadiy, I tried changing what you stated
BOOST_AUTO_TEST_CASE( test ) { std::list<int>& list1 = user_defined_func(); BOOST_CHECK_PREDICATE( validate_list, list1 );
I believe this should be BOOST_CHECK_PREDICATE( validate_list, (list1) );
However upon doing that I get another error (something to do with templates)
Please post small example illustrating the problem.
Gennadiy
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

Andrew J. Leer
bool validate_list(std::list<int> &L1) ...
BOOST_AUTO_TEST_SUITE( test ) BOOST_AUTO_TEST_CASE( test ) { std::list<int>* list1 = user_defined_func(); BOOST_CHECK_PREDICATE( validate_list, (list1) ); } BOOST_AUTO_TEST_SUITE_END()
No surprises here: can't pass pointer to the function expecting reference. Gennadiy

Okay here's the new source, thanks Gennadiy for your time on this.
#include "stdafx.h"
#define BOOST_TEST_MODULE example
#include
Andrew J. Leer
writes: bool validate_list(std::list<int> &L1) ...
BOOST_AUTO_TEST_SUITE( test ) BOOST_AUTO_TEST_CASE( test ) { std::list<int>* list1 = user_defined_func(); BOOST_CHECK_PREDICATE( validate_list, (list1) ); } BOOST_AUTO_TEST_SUITE_END()
No surprises here: can't pass pointer to the function expecting reference.
Gennadiy
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
Andrew J. Leer
-
Gennadiy Rozental