
Hi there!
I have been having some trouble unit testing const variables/types in my
code. The problem I had was basically:
The compiler stops the compilation with an error if you try to change a
const variable/type. Still you want to write a unit test that checks
that the variable cannot be changed. So to check that the variable/type
cannot be changed we can just check if the variable/type is const or
not. By doing so we indirectly check that the variable/type cannot be
changed.
So the suggestion for the Boost.Test library is to create a
BOOST_CHECK_IS_CONST that works something like the code below but with
the BOOST_CHECK_EQUAL syntax:
------
#include <iostream>
#include