Skip to content

Releases: snitch-org/snitch

v1.2.5

09 May 11:16
86d18cb
Compare
Choose a tag to compare

Small changes and bug fixes:

  • Fixed #158: Add option to disable multi-threading support for embedded use.
  • Fixed #158: Compilation would fail if SNITCH_MAX_MESSAGE_LENGTH and SNITCH_MAX_EXPR_LENGTH were not the same.
  • Fixed #158 and #18: Use std::to_chars to avoid using std::snprintf which is not always fully implemented. If std::to_chars isn't available, fallback to our own (slower but portable) implementation.
  • Fixed #164: Escaped characters could sometimes be truncated incorrectly if hitting the max message length.

v1.2.4

16 Jan 21:13
2f62308
Compare
Choose a tag to compare

Small changes and bug fixes:

  • Fixed #143: Extraneous failures were reported for REQUIRE_THROWS_* macros in case no exception is thrown.
  • Fixed #145: CONSTEVAL_* macros were evaluating their expressions at runtime if the expression was not decomposable.
  • Fixed #147: color codes were used in the console output in some cases even when --color never was specified.
  • Fixed #149: following sections were sometimes executed after an uncaught exception.
  • [Reporter] When an exception is thrown unexpectedly in the test code, the resulting assertion now reports the file/line of the CHECK* or REQUIRE* call that triggered the exception. If the exception is not triggered inside a check macro, then the file/line of the enclosing SECTION is used instead. If no section is used, then the assertion reverts to the previous behavior (file/line of the test case). See #141.
  • [Build] Meson scripts now properly set the default symbol visibility with GCC/clang (thanks @topazus)
  • [Internal] Renamed small_function into function_ref (thanks @tocic)

v1.2.3

05 Oct 07:27
c0a910c
Compare
Choose a tag to compare

Small changes and bug fixes:

  • Fixed #129: harmless narrowing cast warning reported in MSVC 17.8.0.

v1.2.2

05 Sep 20:51
87260ed
Compare
Choose a tag to compare

Small changes and bug fixes:

  • [Build] Fixed header-only build not working with CMake 3.14.
  • [Build] Added Dockerfile for locally testing Conan builds.
  • [CI] Added CMake 3.14 CI runs to test the full build + install + consume process.

v1.2.1

03 Sep 10:37
4e8842a
Compare
Choose a tag to compare

Small changes and bug fixes:

  • [Build] Reverted the change to the CMake target name for the header-only build. It is now back to snitch::snitch-header-only.
  • [Build] Lowered the minimum CMake version to what is strictly needed (3.14 instead of 3.19).
  • [Build] Fixed #120: CMake error when enabling --warn-uninitialized -Werror=dev.

v1.2.0

01 Sep 15:30
8542d48
Compare
Choose a tag to compare

Main changes:

  • [API] Added REQUIRE_NOTHROW(EXPR) and CHECK_NOTHROW(EXPR).
  • [API] Added SUCCEED(MESSAGE).
  • [API] Added REGISTER_REPORTER(...) (from Catch2) for registering multiple reporters that can be selected from the command line.
  • [CLI] Added support for --out to save test report to a file.
  • [CLI] Added support for filtering the output of --list-tests (#114).
  • [Reporter] Added the Catch2 XML reporter (#100).
  • [Reporter] Added file/line information for test cases and sections.
  • [Reporter] Added fixture class name information for test cases ("method" test cases only).
  • [Reporter] Added test filtering criteria to the test_run_started event.
  • [Reporter] Expression data is no longer concatenated into a single message when sent to the reporter.
  • [Reporter] Added events for listing tests (listing started, ended, and test case listed).

As a result, the following Catch2 IDE integrations now work with snitch:

  • Visual Studio Code & C++ TestMate
  • Visual Studio 2022 & Catch2 Test Adapter
  • CLion Catch2 configuration

Small changes and bug fixes:

  • [API] Fixed #105: small_function copy construction from a non-const object was ambiguous.
  • [API] Fixed #107: crash when evaluating a check containing a const char* equal to nullptr.
  • [Reporter] Fixed: the Teamcity reporter was reporting failures in [!mayfail] and [!shouldfail] as actual failures.
  • [Reporter] Fixed: long outputs in registry::print and all reporters was too easily truncated; the risk of this is now largely reduced.
  • [CLI] Fixed: unsupported Catch2 command line parameters were not parsed correctly.
  • [CLI] Fixed #110: the output of --list-tests did not contain the full test name.
  • [CLI] Fixed #113: the test filtering algorithm did not match Catch2 v3.
  • [Build] snitch can now build as a shared library.
  • [Build] The CMake scripts will now build either a compiled library or a header-only library, but not both.
  • [Docs] Fixed #108: clarify how to write your own append() function for serialisation
  • [Internal] Fixed: small_vector_span<const T> was unsafe when not initialized with a valid backing small_vector.
  • [Internal] Fixed: small_function compilation error when assigning a member function (or stateful lambda) when the function parameters contain l-value references.
  • [Internal] Added file_writer.
  • [Tests] Added approval tests for all reporters.
  • [Tests] Reduced memory usage of mock_framework in tests by ~x3.
  • [Tests] Reduced stack usage in tests by allocating large data on the heap (reduce risk of stack overflow).
  • [Tests] Fixed stack size for tests not set correctly on Windows.

v1.1.1

02 May 15:57
5ad2fff
Compare
Choose a tag to compare

Small changes and bug fixes:

  • Fixed #90: missing snitch_registry.hpp header in the installed package.
  • Fixed #92: unable to build with CMake or Meson when building from source tarball (no git repo).

Thanks @tocic for the swift bug reports!

v1.1.0

01 May 10:52
d040b89
Compare
Choose a tag to compare

Main changes:

  • Added CONSTEVAL_* and CONSTEXPR_* macros for compile-time (or combined compile- and run-time) testing.
  • Added test event reporting for successful assertions (available only with verbosity "full").
  • Added SKIP_CHECK() to mark a test case as skipped without aborting (useful only if exceptions are turned off).
  • Previously, verbosity only controlled the output of the default reporter. This was not documented. Now, verbosity selects which tests events are sent to the reporter interface. This will speed things up, however you may have to increase the verbosity level if your custom reporter requires events that aren't emitted at the default verbosity (e.g., test case start/end events require verbosity "high").
  • Fixed major bug #83: the last section at any level is only ever entered once, even if it has multiple child sections.

Small changes and bug fixes:

  • Fixed #61: support expressions containing commas in REQUIRE, CHECK, REQUIRE_FALSE, and CHECK_FALSE
  • Fixed #62: do not include absolute path to build directory in uncaught exception messages
  • Fixed #66: incorrect static assert in implementation (internal only; does not affect user code)
  • Fixed #67: REQUIRE_THAT and CHECK_THAT would not compile
  • Fixed #68: preserve matcher state in REQUIRE_THROWS_MATCHES and CHECK_THROWS_MATCHES
  • Fixed #74: incorrect formatting for uncaught std::exception
  • Fixed #77: extra semicolon warning with -Wpedantic
  • Fixed #82: corrupted terminal output if assertion message exceeds SNITCH_MAX_MESSAGE_LENGTH.
  • (build) Added support for meson.
  • (utilities) Refactored snitch::small_function to have stronger invariants (always contains a function to call).
  • (internal) Split the code into multiple files. This is fully backward-compatible, just makes maintenance a bit easier.
  • (internal) Refactored the default reporter to use the standard reporter interface, rather than receiving special treatment.
  • (internal) Fixed the snitch_all target being sometimes out of date when building tests.
  • (internal) Fixed WebAssembly tests not configured with as much stack space as other platforms.
  • (internal) Fixed tests not compiling/failing when exceptions are forcefully disabled in the compiler settings.
  • (internal) Replaced several calls to std::terminate with a customizable assertion handler. This terminates by default, so behavior is unchanged, but can be made to throw instead for testing.
  • (internal) Applied the Lakos Rule for noexcept to the whole code. This led to a minor but measurable performance degradation of compilation time.
  • (internal) Added missing tests for exception checking macros.
  • (internal) Reduced code duplication between check macros. This improved compilation time slightly.

v1.0.0

16 Jan 09:00
ea200a0
Compare
Choose a tag to compare

Summary of main changes:

  • Renamed to snitch.
  • Switched license from MIT to BSL.
  • New features:
    • Custom reporters and more control on default report output.
    • Advanced test filtering (wildcards, exclusions, multiple filters, ...).
    • Support for test fixtures.
    • SECTION().
    • CAPTURE() and INFO().
    • TEMPLATE_TEST_CASE().
    • REQUIRE_THAT() and CHECK_THAT().
    • REQUIRE_FALSE() and CHECK_FALSE().
    • Special tags from Catch2 ([.]/[!mayfail]/[!shouldfail])
    • New option to disable colors in default report output.
    • Header-only version of the library: snitch_all.hpp.
    • Configuration header snitch_config.hpp, containing build-time configuration (useful when not using CMake).
  • Notable improvements:
    • CHECK() and REQUIRE() to evaluate their operands only once.
    • CHECK() and REQUIRE() to support expressions that cannot be decomposed.
    • TEST_CASE*() macros to no longer require a trailing semicolon after the test body.
    • TEST_CASE() no longer requires tags to be provided (matches Catch2).
    • All check macros can now be called in other functions (a test case must still be running on the current thread).
    • Matchers can now also be used as REQUIRE(obj == matcher) and REQUIRE(obj != matcher).
    • TEMPLATE_LIST_TEST_CASE() no longer requires std::tuple (any type list will do).
    • Added unit tests for snitch, using both doctest and snitch as testing frameworks.
    • Despite all the improvements and new features, compilation time has not increased significantly.

Detailed changelog.

Fixes #6:

  • Promoted registry::verbose from a boolean to an enum similar to Catch2. Custom reports may be affected by this variable if they choose to use it.
  • Added snitch::event namespace, events, and the data type to hold all possible events.
  • Added registry::print_callback to customize the function that prints output messages (default it to use standard output).
  • Added registry::report_callback to customize the function that formats test messages (default or if null, use snitch format).
  • Measure the time taken by each test, will be reported only if verbosity is high by default.
  • Added an example reporter callback for Teamcity.

Fixes #7:

  • Add SECTION() to nest test code and share set-up/tear-down logic, as in Catch2.

Fixes #8:

  • Add a new member to registry, with_color, which is true if color should be used in messages and false otherwise.
  • Add a new command line parameter --color, to enable/disable color in messages.
  • Add a new configuration pre-processor variable SNITCH_DEFAULT_WITH_COLOR to change the default behavior of snitch regarding whether color codes are used in the standard output. Custom reporters may be affected by this variable if they choose to use registry::with_color.

Fixes #9.

  • Added CAPTURE() and INFO().

Fixes #13:

  • CHECK() and REQUIRE() will only evaluate operands once instead of twice.

Fixes #17:

  • small_string and small_vector are now zero-initialised. This has a small runtime cost, but prevents any UB, which allows these classes to be used in constexpr context.

Fixes #25:

  • snitch no longer refers to std::tuple explicitly, and instead just asks for a template type list of any kind. This allows not including <tuple> and instantiating std::tuple<...> machinery, for faster compilation.

Fixes #28:

  • Catch2 has REQUIRE_FALSE() and CHECK_FALSE(), which make sense and are useful. Now we have them too.

Fixes #29:

  • Catch2 defines special tags, [.], [!mayfail], [!shouldfail]. This brings a lot of power to the tag system, so now we have this too.

Fixes #31:

  • snitch check macros used to rely on a hidden local test function parameter, which prevented using these macros outside of a test body. Now we use thread-local state, which can be queried from anywhere with little measured overhead, so check macros can be called deep inside nested utility check functions.

Fixes #42:

  • Catch2 supports TEST_CASE("test name") without specifying tags, for conciseness when tags aren't necessary. Now we support this too.

Fixes #43:

  • Some types are weird, and cannot be decomposed inside a REQUIRE() or CHECK() macro because of special rules, or reliance on specific chains of implicit conversions. Now snitch will support these types, and simply will skip decomposing the expression when it is unable to do it.

Other bug fixes:

  • Fixed REQUIRE() and CHECK() not able to use custom append() function if the function is not declared in the snitch:: namespace.
  • Fixed REQUIRE() and CHECK() unable to compare function pointers.
  • Fixed assertion count only incremented in REQUIRE() and CHECK() and not in other check macros.
  • Fixed const-correctness of CLI parsing API.
  • Fixed remaining warnings on -Wall -Wextra and /W4.
  • Fixed registry::configure and registry::run_tests calling member functions from the global snitch::tests registry rather than from this, or console_print rather than registry::print.
  • Fixed registry::list_all_tests and registry::list_tests_with_tag missing the newline character for non-typed-tests.
  • (utilities) Fixed append() adding null-terminating character after appending numbers.

Other miscellaneous changes:

  • snitch.hpp now includes snitch_config.hpp to reduce the risk of mismatched configuration with implementation.
  • Brought the main command-line interface functions to the snitch::cli namespace for public use.
  • Refactored testing macros to speed up compilation and reduce code duplication.
  • Refactored test name, type, and tags into test_id for public use.
  • Renamed SNITCH_MAX_MATCHER_MSG_LENGTH to SNITCH_MAX_MESSAGE_LENGTH, and expand its impact to all messages that get written to a temporary buffer for printing.
  • Do not include <exception> when exceptions are disabled.
  • REQUIRE*() and FAIL() macros now call std::terminate() when exceptions are disabled.
  • Added SNITCH_WITH_TIMINGS to enable/disable test timing (enabled by default).
  • Added is_any_of to builtin matchers.
  • Added SNITCH_VERSION, SNITCH_FULL_VERSION, SNITCH_VERSION_MAJOR, SNITCH_VERSION_MINOR, SNITCH_VERSION_PATCH.
  • The default reporter will print the snitch version number when beginning tests.
  • Added snitch::cli::get_option() an snitch::cli::get_positional_argument() to the public API.
  • Added snitch::cli::console_print to customize the default (no registry) print location.
  • (utilities) Added pop_back() to small_vector.
  • (utilities) Moved all small_* types and related helper functions to the snitch namespace for public use.
  • (utilities) Added small_function to store user callbacks.
  • (utilities) Added replace_all to replace all occurrences in a small string.
  • (utilities) Added immutable small_vector_span<const T> and small_string_view.
  • (utilities) Added append_or_truncate().
  • (utilities) Added operator[] to small_string.
  • (docs) Added benchmark against Boost UT.
  • (docs) Clarify the way in which custom types can be made serializable, and added documentation to README.
  • (docs) Added example CMake usage instructions.
  • (docs) Clarified what happens when a test with sections is aborted.
  • (docs) Added information on recommended clang-format set up.
  • (internal) Moved all test state into a new struct test_run, instantiated when a test is run, rather than in the persistent test_case. This reduces binary size, results in minor speed up, simplifies the code a bit, and reduces reliance on global registry.
  • (internal) Added unit tests to test the testing framework :) This is using doctest, in case snitch breaks and fails to report it to itself, but the tests are also run using snitch to test snitch, just because we can.
  • (internal) Updated clang-format to version 15.
  • (CI) Added coverage check to CI.
  • (CI) Added tests runs.
  • (CI) Added builds with timings and exceptions disabled.

v0.1.3

18 Oct 19:47
f313bcc
Compare
Choose a tag to compare

Small changes and bug fixes:

  • Added CMake .config and find module.
  • Updated benchmark in readme to include a comparison to doctest.
  • (internal) Removed last leftover reference to cxxopts.