NorMIT-nav  16.5
An IGT application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
cxtestCatchExamples.cpp File Reference
#include "catch.hpp"
#include <exception>

Go to the source code of this file.

Functions

 TEST_CASE ("TEST_CASE: Name and tags","[hide][tutorial]")
 
 TEST_CASE ("TEST_CASE: Name, description and tags","Description. [hide][tutorial]")
 
 TEST_CASE ("ASSERTIONS: Natural expressions","[hide][tutorial]")
 
 TEST_CASE ("ASSERTIONS: Exceptions","[hide][tutorial]")
 
 TEST_CASE ("ASSERTIONS: Matcher expressions: Equals","[hide][tutorial]")
 
 TEST_CASE ("ASSERTIONS: Matcher expressions: Contains","[hide][tutorial]")
 
 TEST_CASE ("ASSERTIONS: Matcher expressions: StartsWith","[hide][tutorial]")
 
 TEST_CASE ("ASSERTIONS: Matcher expressions: EndsWith","[hide][tutorial]")
 
 TEST_CASE ("Float vs double precision","[hide][tutorial]")
 
 TEST_CASE ("LOGGING: INFO","[hide][tutorial]")
 
 TEST_CASE ("LOGGING: WARN","[hide][tutorial]")
 
 TEST_CASE ("LOGGING: FAIL","[hide][tutorial]")
 
 TEST_CASE ("LOGGING: SCOPED_INFO","[hide][tutorial]")
 
 TEST_CASE ("LOGGING: CAPTURE","[hide][tutorial]")
 
 SCENARIO ("BDD scenario","Behavior-driven development scenario. [hide][tutorial][BDD]")
 

Function Documentation

SCENARIO ( "BDD scenario"  ,
"Behavior-driven development scenario. "  [hide][tutorial][BDD] 
)

This section shows how to write Behavior-driven development styled tests. http://en.wikipedia.org/wiki/Behavior-driven_development

Definition at line 206 of file cxtestCatchExamples.cpp.

TEST_CASE ( "TEST_CASE: Name and tags"  ,
""  [hide][tutorial] 
)

This file describes how to use CATCH.

ALL Catch tests should be tagged with ONE of the following tags: (See https://en.wikipedia.org/wiki/Software_testing#Testing_levels for more information.)

  • [unit] Unit test - "...tests that verify the functionality of a specific section of code (...) usually at the class level"
  • [integration] Integration test - "... individual software modules are combined and tested as a group..."
  • [system] System test - "...tests a completely integrated system..."
  • [acceptance] Acceptance test - "... a test conducted to determine if the requirements of a specification or contract are met..."

The tag [hide] is a special tag, when tagging tests with this tag they will be skipped by default.

Run catch: $ ./Catch

See options: $ ./Catch -?

See help text for specific option: $ ./Catch -t -?

Read more about commandline options: https://github.com/philsquared/Catch/wiki/Command-line

Currently updated for:

CATCH v0.9 build 33 (integration branch)

Generated: 2013-04-11 16:33:19.541792

This section shows how to write the basic test case.

Definition at line 78 of file cxtestCatchExamples.cpp.

TEST_CASE ( "TEST_CASE:  Name,
description and tags"  ,
"Description. "  [hide][tutorial] 
)

Definition at line 84 of file cxtestCatchExamples.cpp.

TEST_CASE ( "ASSERTIONS: Natural expressions"  ,
""  [hide][tutorial] 
)

This section shows what assertion macros exists.

The REQUIRE family of macros tests an expression and aborts the test case if it fails. The CHECK family are equivalent but execution continues in the same test case even if the assertion fails. This is useful if you have a series of essentially orthoginal assertions and it is useful to see all the results rather than stopping at the first failure.

Definition at line 99 of file cxtestCatchExamples.cpp.

TEST_CASE ( "ASSERTIONS: Exceptions"  ,
""  [hide][tutorial] 
)

Definition at line 114 of file cxtestCatchExamples.cpp.

TEST_CASE ( "ASSERTIONS: Matcher expressions: Equals"  ,
""  [hide][tutorial] 
)

Definition at line 129 of file cxtestCatchExamples.cpp.

TEST_CASE ( "ASSERTIONS: Matcher expressions: Contains"  ,
""  [hide][tutorial] 
)

Definition at line 134 of file cxtestCatchExamples.cpp.

TEST_CASE ( "ASSERTIONS: Matcher expressions: StartsWith"  ,
""  [hide][tutorial] 
)

Definition at line 139 of file cxtestCatchExamples.cpp.

TEST_CASE ( "ASSERTIONS: Matcher expressions: EndsWith"  ,
""  [hide][tutorial] 
)

Definition at line 144 of file cxtestCatchExamples.cpp.

TEST_CASE ( "Float vs double precision"  ,
""  [hide][tutorial] 
)

This section shows extra fucntionality

Definition at line 154 of file cxtestCatchExamples.cpp.

TEST_CASE ( "LOGGING: INFO"  ,
""  [hide][tutorial] 
)

This section shows what logging macros exists. Messages can be logged during a test case.

Definition at line 173 of file cxtestCatchExamples.cpp.

TEST_CASE ( "LOGGING: WARN"  ,
""  [hide][tutorial] 
)

Definition at line 178 of file cxtestCatchExamples.cpp.

TEST_CASE ( "LOGGING: FAIL"  ,
""  [hide][tutorial] 
)

Definition at line 183 of file cxtestCatchExamples.cpp.

TEST_CASE ( "LOGGING: SCOPED_INFO"  ,
""  [hide][tutorial] 
)

Definition at line 189 of file cxtestCatchExamples.cpp.

TEST_CASE ( "LOGGING: CAPTURE"  ,
""  [hide][tutorial] 
)

Definition at line 194 of file cxtestCatchExamples.cpp.