Here is my example:
#include "stdafx.h"
#define BOOST_TEST_MODULE example
#include
std::list<int>* user_defined_func( ) {
std::cout << "BEGIN: user_defined_func" << std::endl;
std::list<int>* l = new std::list<int>;
l->push_back(8);
l->push_back(0);
std::cout << "END: user_defined_func" << std::endl;
return l;
}
bool validate_list(std::list<int> &L1)
{
std::cout << "BEGIN: validate_list" << std::endl;
std::list<int>::iterator it1 = L1.begin();
for(; it1 != L1.end(); ++it1)
{
if(*it1<= 1){
std::cout << "Validation failed because an item in the list was
less than or equal to 1." << std::endl;
std::cout << "END: validate_list" << std::endl;
return false;
}
}
std::cout << "Test passed because all of the items in the list were
greater than or equal to 1" << std::endl;
std::cout << "END: validate_list" << std::endl;
return true;
}
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()
Thank you,
Andrew J. Leer
On Sun, Jan 3, 2010 at 8:00 PM, Gennadiy Rozental wrote:
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