]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | The headers in this directory provide facilities for automatic unit testing. |
2 | Basically, each header defines unit tests for an algorithm or a set of related | |
3 | algorithms. To get the tests for these algorithms, simply include the header | |
4 | at global scope. However, before including the header, you must define the | |
5 | following macros: | |
6 | ||
7 | `MAKE_TUPLE(...)` | |
8 | Must expand to a sequence holding `__VA_ARGS__`. A valid definition | |
9 | would be `hana::make_tuple(__VA_ARGS__)`. | |
10 | ||
11 | `TUPLE_TYPE(...)` | |
12 | Must expand to the type of a sequence holding objects of type `__VA_ARGS__`. | |
13 | A valid definition would be `hana::tuple<__VA_ARGS__>`. | |
14 | ||
15 | `TUPLE_TAG` | |
16 | Must expand to the tag of the sequence. A valid definition would | |
17 | be `hana::tuple_tag`. | |
18 | ||
19 | ||
20 | The following macros may or may not be defined: | |
21 | ||
22 | `MAKE_TUPLE_NO_CONSTEXPR` | |
23 | Must be defined if the `MAKE_TUPLE` macro can't be used inside a | |
24 | constant expression. Otherwise, `MAKE_TUPLE` is assumed to be able | |
25 | to construct a `constexpr` container. | |
b32b8144 FG |
26 | |
27 | The following directories contain automatic unit tests, and the following is | |
28 | sufficient when adding a new automatic unit test (in a file `${FILE}`): | |
29 | ||
30 | ```sh | |
11fdf7f2 | 31 | DIRECTORIES=$(find test -type d -name auto | grep -v test/_include/auto) |
b32b8144 FG |
32 | for d in ${DIRECTORIES}; do |
33 | cat > ${d}/${FILE}.cpp <<EOF | |
34 | // Copyright Louis Dionne 2013-2017 | |
35 | // Distributed under the Boost Software License, Version 1.0. | |
36 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) | |
37 | ||
38 | #include "_specs.hpp" | |
39 | #include <auto/${FILE}.hpp> | |
40 | ||
41 | int main() { } | |
42 | EOF | |
43 | done | |
44 | ``` |