A set of executables and build collateral produced while learning to use boost_unit_test_framework
This repo contains a few projects produced while following instructions for
setting up boost, linking boost libraries to an executable, adding unit tests,
and rolling them all into the meson build system.
The original coding was done on OS X, so the setup steps are specific to this OS.
If you are so inclined, you may feel free to update them for your own environment.
My intent, originally, was to create some simple unit tests and just TDD
something (to be decided later) once I figured out the latest and greatest
unit test library for C++.
But C++ has no such standardization. I landed on boost, since I wanted to learn more about it, and discovered it has its own testing framework. So to write unit tests, I found myself following tutorials for getting started with boost. This resulted in a couple different binaries and a shell script that had the straight clang commands from the boost tutorial. I realized I also wanted to
know the latest and greatest make system for C++.
But C++ has no such standardization. I landed on meson because someone on the
internet said they loved it. It took some getting used to, but I like it, too,
so far.
In getting the boost libraries installed based on the getting started guide, I
realized I already had them installed via HomeBrew because of some other thing
I had installed with it. Trying to manually install boost, then overwrite it
with HomeBrew once I figured out the state of my machine, led to some problems
with my installation, so my meson files and custom build script are pointing
directly to the brew folder with boost.
/usr/local/lib/
, /usr/local/bin/
, and/usr/local/include/
are where the C/C++ magic goes to live.After forking the repository, the first thing you’ll need to do is install
dependencies. Then, you’ll need to set up the meson build directories.
For my build environment, I used the OS X terminal and Atom for editing. For
debugging, I installed the dbg
and dbg-gdb
Atom packages. I chose meson
to manage makefiles, which implies ninja as the build tool.
brew install boost
brew install meson
Run ./test.sh
from the root directory to get started. This will run meson to
create all the build directories, then run ninja to build them, then run ninja
tests. Alternatively, you can run ./setup.sh
or ./bld.sh
just to get the
directories set up, or just to get the directories set up and built.
You will probably hit errors because of the boost paths defined in the variousmeson.build
files in all the subdirectories.
When the projects are built and tests pass, running ./install.sh
will put the
bs and rit executables in your /usr/local/bin/
path.
Contains a library, unit tests, and executable that bubble-sorts signed integers.
The boost sample for compiling against boost headers. This sample is taken
directly from http://www.boost.org/doc/libs/1_63_0/more/getting_started/unix-variants.html#build-a-simple-program-using-boost.
The boost sample for linking against boost libraries. The project links against
the dynamic libraries, and is taken directly from http://www.boost.org/doc/libs/1_63_0/more/getting_started/unix-variants.html#link-your-program-to-a-boost-library
Contains a library that produces random integers.
Contains the boost sample for creating a unit test, taken directly from
http://www.boost.org/doc/libs/1_63_0/libs/test/doc/html/boost_test/intro.html
This is the boost unit test sample, dynamically-linked against boost binaries.