Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost.Test : Project setting in Visual 2010
From: Richard (legalize+jeeves_at_[hidden])
Date: 2013-04-05 14:36:47


[Please do not mail me a copy of your followup]

boost-users_at_[hidden] spake the secret code
<1522520332.33141712.1365147196271.JavaMail.root_at_[hidden]> thusly:

>Actually, I am doing this tutorial :
>
>http://legalizeadulthood.wordpress.com/2009/07/04/c-unit-tests-with-boost-test-part-1/
>http://legalizeadulthood.wordpress.com/2009/07/05/c-unit-tests-with-boost-test-part-2/
>
>And at the end of the page 2, I get "test tree is empty" : the
>OneHasNoFactors is not seen.

If you look more closely at my tutorial, the static library contains
the system under test.

The unit tests are *not* in the library containing the system under
test.

In the section "First Failing Test: Going Red", I wrote:

        "Add a new source file to the Test project called
        TestPrimeFactors.cpp and enter this code:"

You don't want to mix production code and test code into the same
source files, or the same project. If you start to mix them together,
it's too easy for production code to somehow start depending on test
code, or production code having data in it that is only used for
testing and so-on.

If you keep the production code and test code separate, then it is
harder for test code to accidentally sneak into production code.

In these tutorials, I do this by keeping all the unit tests in the
project that builds the test executable and all the production code in
a static library that is a link input to the test executable.

-- 
"The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline>
     The Computer Graphics Museum <http://computergraphicsmuseum.org>
         The Terminals Wiki <http://terminals.classiccmp.org>
  Legalize Adulthood! (my blog) <http://legalizeadulthood.wordpress.com>

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