Upstream unit tests for libbits
===============================

These files are the unit tests from upstream (test/common.hpp and
test/test_*.cpp).  They use the doctest framework, which is provided by the
doctest-dev package.

The tests are written for the upstream source tree, where the library headers
live in include/ relative to the test directory.  To compile them against the
installed headers, copy them to a writable directory and create an include
symlink first:

    mkdir ~/bits-tests
    cp -a /usr/share/doc/libbits-dev/examples/* ~/bits-tests/
    cd ~/bits-tests
    ln -s /usr/include/libbits include

Then compile and run any test file, for example:

    c++ -std=c++17 -O2 -I. $(pkg-config --cflags bits) \
        test_bit_vector.cpp -o test_bit_vector
    ./test_bit_vector

Every test_*.cpp file is a separate program.  To build and run them all:

    for t in test_*.cpp; do
        c++ -std=c++17 -O2 -I. $(pkg-config --cflags bits) \
            "$t" -o "${t%.cpp}" && "./${t%.cpp}"
    done

The same commands are used by the autopkgtest (debian/tests/run-unit-test in
the source package).
