Boost logo

Boost Users :

Subject: Re: [Boost-users] Syntax error when using BOOST_CHECK_PREDICATE
From: Andrew J. Leer (leeand00_at_[hidden])
Date: 2009-12-17 13:20:30


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<MostDerived,PrimaryId,SecondId>::dual_id_policy(void)'
1> with
1> [
1> MostDerived=boost::runtime::cla::dual_name_policy,
1> PrimaryId=boost::runtime::cla::string_name_policy,
1> SecondId=boost::runtime::cla::char_name_policy
1> ]
1> c:\program files
(x86)\boost\boost_1_40\boost\test\utils\runtime\cla\dual_name_parameter.hpp(34)
: see reference to class template instantiation
'boost::runtime::cla::dual_id_policy<MostDerived,PrimaryId,SecondId>'
being compiled
1> with
1> [
1> MostDerived=boost::runtime::cla::dual_name_policy,
1> PrimaryId=boost::runtime::cla::string_name_policy,
1> SecondId=boost::runtime::cla::char_name_policy
1> ]
1>c:\program files
(x86)\boost\boost_1_40\boost\test\test_tools.hpp(523) : error C2664:
'bool (std::list<_Ty> &)' : cannot convert parameter 1 from 'const
std::list<_Ty>' to 'std::list<_Ty> &'
1> with
1> [
1> _Ty=int
1> ]
1> Conversion loses qualifiers
1> c:\users\xetex\documents\visual studio
2005\projects\unittesttestsexample14\unittesttests\unittesttests.cpp(45)
: see reference to function template instantiation 'bool
boost::test_tools::tt_detail::check_frwd<bool(__cdecl
*)(std::list<_Ty> &),std::list<_Ty>>(Pred,const
boost::unit_test::lazy_ostream
&,boost::test_tools::const_string,size_t,boost::test_tools::tt_detail::tool_level,boost::test_tools::tt_detail::check_type,const
Arg0 &,const char *)' being compiled
1> with
1> [
1> _Ty=int,
1> Pred=bool (__cdecl *)(std::list<int> &),
1> Arg0=std::list<int>
1> ]
1>Build log was saved at "file://c:\Users\XETEX\Documents\Visual
Studio 2005\Projects\UnitTestTestsExample14\UnitTestTests\Debug\BuildLog.htm"
1>UnitTestTests - 1 error(s), 6 warning(s)
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

Thank you,
   Andrew J. Leer

On Sun, Dec 13, 2009 at 6:19 AM, Gennadiy Rozental <rogeeff_at_[hidden]> wrote:
> Andrew J. Leer <leeand00 <at> hotmail.com> 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_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net