57 TEST_CASE(
"TEST_CASE: Name and tags",
"[hide][tutorial]" ) {
63 TEST_CASE(
"TEST_CASE: Name, description and tags",
"Description. [hide][tutorial]" ) {
78 TEST_CASE(
"ASSERTIONS: Natural expressions",
"[hide][tutorial]" ) {
82 int a = 1, b = a, c = 2;
93 TEST_CASE(
"ASSERTIONS: Exceptions",
"[hide][tutorial]" ) {
108 TEST_CASE(
"ASSERTIONS: Matcher expressions: Equals",
"[hide][tutorial]" ) {
113 TEST_CASE(
"ASSERTIONS: Matcher expressions: Contains",
"[hide][tutorial]" ) {
118 TEST_CASE(
"ASSERTIONS: Matcher expressions: StartsWith",
"[hide][tutorial]" ) {
123 TEST_CASE(
"ASSERTIONS: Matcher expressions: EndsWith",
"[hide][tutorial]" ) {
133 TEST_CASE (
"Float vs double precision",
"[hide][tutorial]") {
139 float f_number = 0.1;
140 double d_number = 0.1;
153 std::string info =
" logged.";
154 INFO(
"The info is " << info);
158 std::string warning =
" not important at all.";
159 WARN(
"The warning is " << warning);
164 std::string failure =
" not a failure at all, it is supposed to fail.";
165 FAIL(
"The failure is " << failure);
168 TEST_CASE(
"LOGGING: SCOPED_INFO",
"[hide][tutorial]" ) {
169 std::string scoped_info =
" will only be logged if a test fails in the current scope.";
185 SCENARIO(
"BDD scenario",
"Behavior-driven development scenario. [hide][tutorial][BDD]"){
186 GIVEN(
"we create a new std::vector"){
187 std::vector<int> vector;
189 WHEN(
"we add a int to the vector"){
191 THEN(
"we can require that the vectors lenght is 1"){
194 AND_WHEN(
"we add another int to the vector"){
196 THEN(
"we can require that the vectors lenght is 2"){
200 THEN(
"we can require that the vectors lenght is still 1"){
204 THEN(
"we can require that the vector is empty"){
#define CHECK_THROWS_AS(expr, exceptionType)
SCENARIO("BDD scenario","Behavior-driven development scenario. [hide][tutorial][BDD]")
#define REQUIRE_FALSE(expr)
#define CHECK_THAT(arg, matcher)
#define REQUIRE_THROWS_AS(expr, exceptionType)
#define CHECK_NOTHROW(expr)
Impl::StdString::Equals Equals(std::string const &str)
Impl::StdString::Contains Contains(std::string const &substr)
Impl::StdString::StartsWith StartsWith(std::string const &substr)
#define REQUIRE_THROWS(expr)
TEST_CASE("TEST_CASE: Name and tags","[hide][tutorial]")
#define REQUIRE_NOTHROW(expr)
#define REQUIRE_THAT(arg, matcher)
Approx & epsilon(double newEpsilon)
Impl::StdString::EndsWith EndsWith(std::string const &substr)
#define CHECK_THROWS(expr)
#define CHECK_FALSE(expr)