From 53c38d244e70a00f83cd1521c7ccf779fa3383c1 Mon Sep 17 00:00:00 2001 From: Snaipe Date: Thu, 26 Mar 2015 23:04:02 +0100 Subject: [PATCH] Added documentation on adding a custom main --- doc/index.rst | 1 + doc/internal.rst | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 doc/internal.rst diff --git a/doc/index.rst b/doc/index.rst index 21a4a6c..dd79dd7 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -9,4 +9,5 @@ Criterion starter hooks env + internal faq diff --git a/doc/internal.rst b/doc/internal.rst new file mode 100644 index 0000000..df3518d --- /dev/null +++ b/doc/internal.rst @@ -0,0 +1,41 @@ +Changing the internals +====================== + +Providing your own main +----------------------- + +If you are not satisfied with the default CLI or environment variables, you +can define your own main function. + +Configuring the test runner +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +You'd usually want to configure the test runner before calling it. +Configuration is done by setting fields in a global variable named +``criterion_options`` (include criterion/options.h). + +Here is an exhaustive list of these fields: + +=================== ================================== ============================================================== +Field Type Description +=================== ================================== ============================================================== +logging_threshold enum criterion_logging_level The logging level +------------------- ---------------------------------- -------------------------------------------------------------- +output_provider struct criterion_output_provider * The output provider (see below) +------------------- ---------------------------------- -------------------------------------------------------------- +no_early_exit bool True iff the test worker should exit early +------------------- ---------------------------------- -------------------------------------------------------------- +always_succeed bool True iff criterion_run_all_tests should always returns 1 +------------------- ---------------------------------- -------------------------------------------------------------- +use_ascii bool True iff the outputs should use the ASCII charset +------------------- ---------------------------------- -------------------------------------------------------------- +fail_fast bool True iff the test runner should abort after the first failure +------------------- ---------------------------------- -------------------------------------------------------------- +pattern const char * The pattern of the tests that should be executed +=================== ================================== ============================================================== + +Starting the test runner +~~~~~~~~~~~~~~~~~~~~~~~~ + +The test runner can be called with ``criterion_run_all_tests``. The function +returns 0 if one test or more failed, 1 otherwise.