-
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.
- Loading branch information
Showing
6 changed files
with
74 additions
and
0 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,22 @@ | ||
#pragma once | ||
|
||
#include <string> | ||
#include <iostream> | ||
|
||
namespace rc { | ||
namespace detail { | ||
|
||
/// Describes a property. | ||
struct TestMetadata { | ||
/// A unique identifier for the test. | ||
std::string id; | ||
/// A description of the test. | ||
std::string description; | ||
}; | ||
|
||
std::ostream &operator<<(std::ostream &os, const TestMetadata &info); | ||
bool operator==(const TestMetadata &lhs, const TestMetadata &rhs); | ||
bool operator!=(const TestMetadata &lhs, const TestMetadata &rhs); | ||
|
||
} // namespace detail | ||
} // 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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#include "rapidcheck/detail/TestMetadata.h" | ||
|
||
namespace rc { | ||
namespace detail { | ||
|
||
std::ostream &operator<<(std::ostream &os, const TestMetadata &info) { | ||
os << "id='" << info.id << "', description='" << info.description << "'"; | ||
return os; | ||
} | ||
|
||
bool operator==(const TestMetadata &lhs, const TestMetadata &rhs) { | ||
return (lhs.id == rhs.id) && (lhs.description == rhs.description); | ||
} | ||
|
||
bool operator!=(const TestMetadata &lhs, const TestMetadata &rhs) { | ||
return !(lhs == rhs); | ||
} | ||
|
||
} // namespace detail | ||
} // 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
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,20 @@ | ||
#include <catch.hpp> | ||
#include <rapidcheck/catch.h> | ||
|
||
#include "rapidcheck/detail/TestMetadata.h" | ||
|
||
#include "util/TemplateProps.h" | ||
#include "util/Generators.h" | ||
|
||
using namespace rc; | ||
using namespace rc::detail; | ||
|
||
TEST_CASE("TestMetadata") { | ||
SECTION("operator==/operator!=") { | ||
propConformsToEquals<TestMetadata>(); | ||
PROP_REPLACE_MEMBER_INEQUAL(TestMetadata, id); | ||
PROP_REPLACE_MEMBER_INEQUAL(TestMetadata, description); | ||
} | ||
|
||
SECTION("operator<<") { propConformsToOutputOperator<TestMetadata>(); } | ||
} |
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