Commit Graph

32 Commits

Author SHA1 Message Date
Martin Hořeňovský 8d50f04419
Move around matcher macro implementation 2020-04-26 21:33:55 +02:00
Martin Hořeňovský 0470794a68
Split TEMPLATE_TEST* macros into their own set of files
These files are not included by the default
`#include <catch2/catch_test_macros.hpp>` path, so that users do
not have to pay for them if they do not use them. Follow up is to
split out the small part of `catch_preprocessor.hpp` used by the
default test macros (AFAIK, it is just `INTERNAL_CATCH_REMOVE_PARENS`
macro), so that it is not included by the default path either.

Also fixes #1892 by providing the missing macros.
2020-04-26 16:25:43 +02:00
Martin Hořeňovský 5150fa4476
Rename catch_capture.hpp to more descriptive catch_test_macro_impl.hpp 2020-04-26 13:32:17 +02:00
Martin Hořeňovský 517839fb3f
Small cleanup of fatal condition handler 2020-04-25 14:07:50 +02:00
Martin Hořeňovský c5ec936a72
Inline TagAlias constructor
It is trivial enough that the function call is not worth it, and
lets us remove one TU from compilation.
2020-04-24 21:09:10 +02:00
Martin Hořeňovský 7c97554565
Remove Obj-C(++) support 2020-04-24 20:42:52 +02:00
Martin Hořeňovský e1e6872c4c
Standardize header names and file locations
This is both a really big and a really small commit. It is small in
that it only contains renaming, moving and modification of include
directives caused by this.

It is really big in the obvious way of touching something like 200
files.

The new rules for naming files is simple: headers use the `.hpp`
extension. The rules for physical file layout is still kinda in
progress, but the basics are also simple:
 * Significant parts of functionality get their own subfolder
   * Benchmarking is in `catch2/benchmark`
   * Matchers are in `catch2/matchers`
   * Generators are in `catch2/generators`
   * Reporters are in `catch2/reporters`
   * Baseline testing facilities are in `catch2/`
 * Various top level folders also contain `internal` subfolder,
   with files that users probably do not want to include directly,
   at least not until they have to write something like their own
   reporter.
    * The exact files in these subfolders is likely to change later
      on

Note that while some includes were cleaned up in this commit, it
is only the low hanging fruit and further cleanup using automatic
tooling will happen later.

Also note that various include guards, copyright notices and file
headers will also be standardized later, rather than in this commit.
2020-04-24 18:58:44 +02:00
Martin Hořeňovský 3836aa9ceb
Remove catch_user_interfaces
It used to be a file that would collect interfaces we always wanted
to provide to users, so that the single header stitching script
would place them in the common part of the single header version.

As v3 is moving to separate headers model, the file is no longer
useful.
2020-04-24 15:34:12 +02:00
Martin Hořeňovský 3f2ada03d5
Remove unused catch_impl.hpp header
It became useless when we moved away from the single-header model,
because it was used an entry point for stitching CPP into the single
header file.
2020-04-24 14:25:33 +02:00
Martin Hořeňovský 7892954c99
Remove global warning manipulation headers
They were unused except for one test file anyway.
2020-04-05 19:14:16 +02:00
Martin Hořeňovský 54a7eb1aed
Rename reporters to use .hpp suffix
I want to standardize _all_ of Catch2 headers on the `.hpp` suffix.
2020-04-05 19:10:57 +02:00
Martin Hořeňovský 151dccbd31
Remove catch.hpp
This was an old "include all" header, that we no longer want to be
usable, to make the include differences in new versions explicit.

We will introduce new "include all" headers later, in the form of
`catch_all.hpp`, `catch_matchers_all.hpp` and so on...
2020-03-29 21:32:13 +02:00
Martin Hořeňovský ab0ca2f566
Rename some matcher-related files
The two changes are
`catch_matchers_templates` -> `catch_matchers_templated` and
`catch_matchers_generic` -> `catch_matchers_predicate`. The former
is mostly cosmetic, but the second was previously significantly
misleading, and as the library is now to be consumed by including
specific headers, this needed to be fixed.
2020-03-27 10:24:08 +01:00
Martin Hořeňovský 3a3efebd16
Add IsEmpty and SizeIs matchers for ranges/containers
`SizeIs` can accept both `size_t` and a matcher. In the first case,
it checks whether the size of the range is equal to specified size.
In the second case, it checks whether the provided matcher accepts
the size of the range.
2020-03-27 10:24:08 +01:00
Martin Hořeňovský 007efc173a
Add generic Contains matcher
It matches a range iff the range contains a specific element,
or an element in the range matches the provided matcher.
2020-03-27 10:22:25 +01:00
Martin Hořeňovský c2daf468bb
Standardize matcher headers to use .hpp suffix 2020-03-27 10:22:25 +01:00
Martin Hořeňovský 6e270958a2
Add development build option to CMake and enable it on CI
Development build enables warnings and and `Werror` or equivalent.
2020-02-26 16:07:26 +01:00
Martin Hořeňovský c3013a6251
Move matcher implementation to their own subfolder
In the future we can expect many more matchers, so let's give them
a place to live.

Also moved matcher-related internal files to `internal` subfolder.
Ideally we should sort out all of our source code, but that will
have to come later.
2020-02-20 17:42:11 +01:00
melak47 17c4b2d093
Feature: generic matchers (#1843)
This commit extends the Matchers feature with the ability to have type-independent (e.g. templated) matchers. This is done by adding a new base type that Matchers can extend, `MatcherGenericBase`, and overloads of operators `!`, `&&` and `||` that handle matchers extending `MatcherGenericBase` in a special manner.

These new matchers can also take their arguments as values and non-const references.

Closes #1307 
Closes #1553 
Closes #1554 

Co-authored-by: Martin Hořeňovský <martin.horenovsky@gmail.com>
2020-02-16 11:19:10 +01:00
Martin Hořeňovský db1a0465dc
Outline GeneratorException from generators header 2020-02-14 16:15:47 +01:00
Martin Hořeňovský 21b24e8326
Remove catch_external_interfaces.h
Its intent was to show which headers are expected to be useable by
Catch2's users, and to enforce their inclusion in the single header
distribution at the right place.

Given the new library model, the second use case is not needed and
the first one is better served with documentation and physical file
layout.
2020-02-12 16:57:15 +01:00
Martin Hořeňovský cd7d7a1c67
Remove CATCH_CONFIG_ENABLE_BENCHMARKING compilation toggle
Now that Catch2 is a proper library, we can always build the full
library (comparatively minor slowdown) and the user can avoid
including benchmarking headers to avoid the compilation slowdown.
2020-02-06 11:36:46 +01:00
Martin Hořeňovský c381b49c60
Split the test macros into their own file 2020-01-19 16:01:50 +01:00
Martin Hořeňovský acf975cab1
Separate version macros to its own header 2020-01-19 15:39:11 +01:00
Martin Hořeňovský 4005d87460
Use proper linkage between Catch2Main and Catch2 2019-12-18 20:14:34 +01:00
Martin Hořeňovský 1cc05122d7
Add Catch2Main CMake target that contains test main 2019-12-18 17:25:04 +01:00
Martin Hořeňovský add7068f21
Fixup installation 2019-12-16 22:33:56 +01:00
Martin Hořeňovský 5fbf04cd59
Redo how the separate compilation tests are handled 2019-12-15 20:33:39 +01:00
Martin Hořeňovský 29b441949c
Port the last example 2019-12-08 20:58:52 +01:00
Martin Hořeňovský 248f922465
Cleanup impl and main from the main header 2019-12-08 11:31:47 +01:00
Martin Hořeňovský fef4f217b1
Unit tests build and run (todo: projects, includes, extras) 2019-11-30 20:45:34 +01:00
Martin Hořeňovský e341b11467
WIP: CMake changes to build static lib + tests separately 2019-11-30 17:41:41 +01:00