Creating a Test Double for rlog

We don’t have to stub everything that rlog defines, only the things our test executable requires. We start by commenting out the line in the makefile that links rlog into the test executable. Here’s our update to CMakeLists.txt (we’re using CMake):

wav/7/CMakeLists.txt
 
project(SnippetPublisher)
 
cmake_minimum_required(VERSION 2.6)
 
 
include_directories($ENV{BOOST_ROOT}/ $ENV{RLOG_HOME} $ENV{CPPUTEST_HOME}/include)
 
link_directories($ENV{RLOG_HOME}/rlog/.libs $ENV{CPPUTEST_HOME}/lib)
 
set(Boost_USE_STATIC_LIBS ON)
 
 
add_definitions(-std=c++0x)
 
 
set(CMAKE_CXX_FLAGS "${CMAXE_CXX_FLAGS} -DRLOG_COMPONENT=debug -Wall")
 
set(sources WavReader.cpp WavDescriptor.cpp)
 
set(testSources WavReaderTest.cpp)
 
add_executable(utest ...

Get Modern C++ Programming with Test-Driven Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.