Boost logo

Boost Users :

From: Yann Golanski (yann_at_[hidden])
Date: 2007-08-14 04:44:53


Quoth Gennadiy Rozental on Tue, Aug 14, 2007 at 00:38:02 -0400
> Please read docs at:
>
> http://www.patmedia.net/~rogeeff/html/utf/compilation.html
>
> and let me know if you still not able to build your test modules
> successfully.

Many thanks indeed.

I have managed to make a test module from the old documentation -- after
way too much effort. The new one is a massive improvement. However,
there are sections that are not filled in and some spelling mistakes in
the text and sometimes more importantly in the options.

For example:
http://www.patmedia.net/~rogeeff/html/utf/user-guide/runtime-config/reference.html
In "report_level", the levels are indicated as no, confirm, short and
detaled -- the latter should be details.

I am still unclear about the compile flags. I somehow cannot get ride
of main in my test code. What would be really useful is an example of
use with Makefile/bjam file/Studio files. I can help if you wanted on
the *nix side.

Here is the code, with Makefile following...

==== c++ code: working ====

#define BOOST_TEST_DYN_LINK
//#define BOOST_TEST_MAIN

#include <boost/test/unit_test.hpp>
#include <boost/bind.hpp>
using namespace boost::unit_test;

//! Test assertion, will always return true.
void free_test_function( int i, int j )
{
  BOOST_CHECK( true );
}

//! Main test case.
bool init_function( )
{
  framework::master_test_suite().p_name.value = "unit test";
  framework::master_test_suite().add(BOOST_TEST_CASE(boost::bind(&free_test_function,
1, 1 )));
  return true;
}

// TODO: How do I get ride of main???...
int main( int argc, char* argv[] )
{
    return ::boost::unit_test::unit_test_main( &init_function, argc,
argv );
}

==== Makefile ====
FILES=$(shell find -maxdepth 1 -name '*.cc' -or -name '*.cpp' -or -name
'*.h')
SRCS=$(shell find -maxdepth 1 -name '*.cc' -or -name '*.cpp') \
OBJS=$(SRCS:.cc=.o)
EXE=unit_test
CXX=g++
SYSFLAG=
INCLUDES=-I/usr/local/include/boost -I/usr/local/include
CXXFLAGS=$(SYSFLAG) $(INCLUDES) -Wall -ansi
BOOSTFLAGS=-L/usr/local/lib -lboost_unit_test_framework-gcc34-mt-d
LDFLAGS=$(BOOSTFLAGS) -llog4cplus
all : main

main: buildfiles.d $(OBJS)
  $(CXX) -o $(EXE) $(LDFLAGS) $(CXXFLAGS) $(OBJS)

buildfiles.d: $(SRCS)
  gcc -MM $(SRCS) > buildfiles.d

-include buildfiles.d

-- 
yann_at_[hidden]             -= H+ =-             www.kierun.org
   PGP:   009D 7287 C4A7 FD4F 1680  06E4 F751 7006 9DE2 6318



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