-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from emil-e/master
Merge upstream master
- Loading branch information
Showing
17 changed files
with
108 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# Catch test integration | ||
|
||
rapidcheck comes with some basic integrations for the catch test library. | ||
|
||
## Usage | ||
|
||
This support is available throught the `extras/catch` module. You can either | ||
directly add the `extras/gtest/inclode` directory to your include path: | ||
|
||
```cmake | ||
add_subdirectory(rapidcheck) | ||
set include_directories(rapidcheck/extras/gtest/include) | ||
add_executable(MyTest main.cpp) | ||
``` | ||
|
||
Or link against the `rapidcheck_catch` cmake target: | ||
|
||
```cmake | ||
add_subdirectory(rapidcheck) | ||
add_executable(MyTest main.cpp) | ||
target_link_libraries(MyTest rapidcheck_catch) | ||
``` | ||
|
||
Once you've done one of these, you can simply: | ||
|
||
```cpp | ||
#include <catch2/catch.hpp> | ||
#include "rapidcheck.h" | ||
#include "rapidcheck/catch.h' | ||
``` | ||
## Reference | ||
### `rc::prop("My test description", []{return true;}, /*verbose=*/true)` | ||
The `rc::prop` can be used in place of `SECTION` for convenient checking of | ||
properties. The third parameter is optional and defaults to `false`. | ||
```cpp | ||
TEST_CASE("001: My first test case") | ||
{ | ||
rc::prop("My property description", | ||
[](int a, int b) | ||
{ | ||
// rapidcheck will produce the `a` and `b` | ||
return (a + b) == (b + a); // return true for passed test, false for | ||
// failed test | ||
}); | ||
// no problem mixing rapidcheck tests with regular catch assertions | ||
SECTION("Normal catch stuff") | ||
{ | ||
WHEN("Something happens") | ||
{ | ||
THEN("assert a result") | ||
{ | ||
REQUIRE(1 == 1); | ||
} | ||
} | ||
} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule googletest
updated
404 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
#include "Serialization.h" | ||
|
||
#include <cstdint> | ||
#include <limits> | ||
|
||
namespace rc { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
#pragma once | ||
|
||
#include <cstdint> | ||
#include <string> | ||
#include <tuple> | ||
#include <limits> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
#pragma once | ||
|
||
#include <cstdint> | ||
#include <string> | ||
#include <vector> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters