I'm not quite sure whether this is a problem with RCF or boost.test. The following simple boost.test fails unexpectedly :
Code: Select all
#include <iostream>
#include <RCF/RCF.hpp>
#define BOOST_TEST_MODULE RCFTest
#include <boost/test/unit_test.hpp>
RCF_BEGIN(I_Echo, "I_Echo")
RCF_METHOD_R1(std::string, Echo, const std::string &)
RCF_END(I_Echo)
struct EchoImpl
{
static int counter ;
std::string Echo(const std::string & s)
{
++counter ;
if( counter < 3 )
{
return s ;
}
else
{
return "123" ;
}
}
};
int EchoImpl::counter = 0 ;
BOOST_AUTO_TEST_CASE( simple_test )
{
RCF::RcfInitDeinit rcfInit;
EchoImpl echo;
RCF::RcfServer server( RCF::TcpEndpoint(50001) );
server.bind<I_Echo>(echo);
server.start();
RcfClient<I_Echo> client( RCF::TcpEndpoint(50001) );
BOOST_CHECK( std::string("ABC") == client.Echo("ABC") );
BOOST_CHECK_EQUAL( std::string("ABC"), client.Echo("ABC") );
BOOST_CHECK( std::string("ABC") == client.Echo("ABC") );
BOOST_CHECK_EQUAL( std::string("ABC"), client.Echo("ABC") );
}
Code: Select all
volker@hubuntu64:~/test/RCF-2.0.0.2678$ ./m
Running 1 test case...
main.cpp(47): error in "simple_test": check std::string("ABC") == client.Echo("ABC") failed
main.cpp(48): error in "simple_test": check std::string("ABC") == client.Echo("ABC") failed [ABC !=
unknown location(0): fatal error in "simple_test": memory access violation at address: 0x00000000: no mapping at fault address
main.cpp(48): last checkpoint
My environment : Ubuntu 12.04 x86_64, gcc 4.6.3, boost 1.52.0, RCF 2.0.0.2678.
Regards,
Volker