Snippets
doctest
We can clone it into our current directory.
$ git clone https://github.com/onqtam/doctest.git
doctest is very easy to setup:
- set up the path to include
/doctest/doctest #include "doctest.h"- get
doctestto create main - write the tests.
Now we can update the tdd option to setup the doctest path, and set a compiler directive called TDD :
if env['BUILD_TYPE'] == 'tdd':
print '*** TDD build'
env.Append( CPPPATH=["#/doctest/doctest"] )
env.Append( CPPDEFINES = ['TDD'] )
We add these two files to our project:
test
├── test_main.cpp
└── tests.cpp