Search code examples
c++unit-testingboostturtle-mock

Turtle (mock framework) compilation errors


I'm trying to compile a simple example in Turtle (with boost unit test framework) and am getting compilation errors from within Turtle.

I'm assuming that Turtle doesn't really have errors and it's something that I'm doing wrong or have incompatible.

Any help would be appreciated.


The example:

#define BOOST_TEST_MAIN
#define BOOST_TEST_DYN_LINK

#include <boost/test/unit_test.hpp>
#include <turtle/mock.hpp>

BOOST_AUTO_TEST_CASE(trutletest){
     BOOST_CHECK(1 == 4);
}

** I've distilled it so it doesn't even uses any Turtle features, just including it causes errors.

The errors I get:

In file included from ../turtle/include/turtle/detail/../matcher.hpp:14,
                 from ../turtle/include/turtle/detail/function.hpp:16,
                 from ../turtle/include/turtle/detail/functor.hpp:12,
                 from ../turtle/include/turtle/reset.hpp:14,
                 from ../turtle/include/turtle/mock.hpp:14,
                 from test.cpp:5:
../turtle/include/turtle/detail/../detail/is_functor.hpp:22: error: expected constructor, destructor, or type conversion before ‘(’ token
In file included from ../turtle/include/turtle/detail/function.hpp:16,
                 from ../turtle/include/turtle/detail/functor.hpp:12,
                 from ../turtle/include/turtle/reset.hpp:14,
                 from ../turtle/include/turtle/mock.hpp:14,
                 from test.cpp:5:
../turtle/include/turtle/detail/../matcher.hpp:87: error: ‘is_functor’ is not a member of ‘mock::detail’
../turtle/include/turtle/detail/../matcher.hpp:87: error: ‘is_functor’ is not a member of ‘mock::detail’
../turtle/include/turtle/detail/../matcher.hpp:87: error: template argument 1 is invalid
../turtle/include/turtle/detail/../matcher.hpp:88: error: template argument 3 is invalid
../turtle/include/turtle/detail/../matcher.hpp:89: error: expected unqualified-id before ‘>’ token

The compilation line: g++ test.cpp -o test -I ../turtle/include/ -lboost_unit_test_framework

I'm using: g++ (GCC) 4.4.6 20120305 (Red Hat 4.4.6-4) Turtle 1.2.4


Solution

  • As cv_and_he commented, the problem was using an old boost version.
    Updating to the latest boost (1.54.0) fixed the problem.