diff --git a/Makefile.am b/Makefile.am index 43f9619..6e6d91e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -29,6 +29,7 @@ subdirinclude_HEADERS = \ include/criterion/event.h \ include/criterion/hooks.h \ include/criterion/logging.h \ + include/criterion/types.h \ include/criterion/options.h \ include/criterion/ordered-set.h \ include/criterion/stats.h diff --git a/include/criterion/assert.h b/include/criterion/assert.h index 9f2e7cd..f17de27 100644 --- a/include/criterion/assert.h +++ b/include/criterion/assert.h @@ -27,7 +27,7 @@ # include # include # include -# include "criterion.h" +# include "types.h" # include "stats.h" # include "hooks.h" # include "event.h" diff --git a/include/criterion/criterion.h b/include/criterion/criterion.h index 6f159ab..1fae07a 100644 --- a/include/criterion/criterion.h +++ b/include/criterion/criterion.h @@ -1,59 +1,9 @@ -/* - * The MIT License (MIT) - * - * Copyright © 2015 Franklin "Snaipe" Mathieu - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ #ifndef CRITERION_H_ # define CRITERION_H_ -# include -# include # include "common.h" # include "assert.h" - -struct criterion_test_extra_data { - int sentinel_; - const char *const file_; - const unsigned line_; - void (*init)(void); - void (*fini)(void); - int signal; - bool disabled; - void *data; -}; - -struct criterion_test { - const char *name; - const char *category; - void (*test)(void); - struct criterion_test_extra_data *const data; -}; - -struct criterion_suite { - const char *name; - struct criterion_test_extra_data *const data; -#if 1 - void *pad[2]; -#endif -}; +# include "types.h" # define IDENTIFIER_(Category, Name, Suffix) \ Category ## _ ## Name ## _ ## Suffix diff --git a/include/criterion/logging.h b/include/criterion/logging.h index 25f389a..abc1399 100644 --- a/include/criterion/logging.h +++ b/include/criterion/logging.h @@ -27,6 +27,7 @@ # include # include "common.h" # include "ordered-set.h" +# include "stats.h" enum criterion_logging_level { CRITERION_INFO = 1, diff --git a/include/criterion/ordered-set.h b/include/criterion/ordered-set.h index e585422..960b57e 100644 --- a/include/criterion/ordered-set.h +++ b/include/criterion/ordered-set.h @@ -24,8 +24,7 @@ #ifndef CRITERION_ORDERED_SET_H_ # define CRITERION_ORDERED_SET_H_ -# include -# include "criterion.h" +# include "types.h" struct criterion_ordered_set { struct criterion_ordered_set_node *first; diff --git a/include/criterion/stats.h b/include/criterion/stats.h index 2225896..cfd4ea2 100644 --- a/include/criterion/stats.h +++ b/include/criterion/stats.h @@ -24,9 +24,7 @@ #ifndef CRITERION_STATS_H_ # define CRITERION_STATS_H_ -# include -# include -# include "criterion.h" +# include "types.h" struct criterion_assert_stats { int kind; diff --git a/include/criterion/types.h b/include/criterion/types.h new file mode 100644 index 0000000..5cca302 --- /dev/null +++ b/include/criterion/types.h @@ -0,0 +1,56 @@ +/* + * The MIT License (MIT) + * + * Copyright © 2015 Franklin "Snaipe" Mathieu + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +#ifndef CRITERION_TYPES_H_ +# define CRITERION_TYPES_H_ + +# include +# include + +struct criterion_test_extra_data { + int sentinel_; + const char *const file_; + const unsigned line_; + void (*init)(void); + void (*fini)(void); + int signal; + bool disabled; + void *data; +}; + +struct criterion_test { + const char *name; + const char *category; + void (*test)(void); + struct criterion_test_extra_data *const data; +}; + +struct criterion_suite { + const char *name; + struct criterion_test_extra_data *const data; +#if 1 + void *pad[2]; +#endif +}; + +#endif /* !CRITERION_TYPES_H_ */ diff --git a/src/log/tap.c b/src/log/tap.c index f4bac6d..1e823b2 100644 --- a/src/log/tap.c +++ b/src/log/tap.c @@ -22,6 +22,8 @@ * THE SOFTWARE. */ #include +#include +#include #include "criterion/stats.h" #include "criterion/logging.h" #include "criterion/options.h" diff --git a/src/process.c b/src/process.c index 1a3c788..0d5689c 100644 --- a/src/process.c +++ b/src/process.c @@ -27,7 +27,7 @@ #include #include -#include "criterion/criterion.h" +#include "criterion/types.h" #include "criterion/options.h" #include "process.h" #include "event.h" diff --git a/src/report.c b/src/report.c index af6a61f..1783018 100644 --- a/src/report.c +++ b/src/report.c @@ -23,8 +23,9 @@ */ #define _GNU_SOURCE #include +#include #include -#include "criterion/criterion.h" +#include "criterion/types.h" #include "criterion/stats.h" #include "criterion/logging.h" #include "criterion/options.h" diff --git a/src/runner.c b/src/runner.c index 85b4238..d772cfe 100644 --- a/src/runner.c +++ b/src/runner.c @@ -25,6 +25,7 @@ #include #include #include +#include "criterion/criterion.h" #include "criterion/options.h" #include "criterion/ordered-set.h" #include "stats.h" diff --git a/src/runner.h b/src/runner.h index 64cc668..9cb4156 100644 --- a/src/runner.h +++ b/src/runner.h @@ -24,7 +24,7 @@ #ifndef CRITERION_RUNNER_H_ # define CRITERION_RUNNER_H_ -# include "criterion/criterion.h" +# include "criterion/types.h" DECL_SECTION_LIMITS(struct criterion_test, criterion_tests); DECL_SECTION_LIMITS(struct criterion_suite, crit_suites);