JUCE
Classes | Macros
juce_UnitTest.h File Reference

Classes

class  UnitTest
 This is a base class for classes that perform a unit test. More...
 
class  UnitTestRunner
 Runs a set of unit tests. More...
 
struct  UnitTestRunner::TestResult
 Contains the results of a test. More...
 

Macros

#define expectDoesNotThrow(expr)
 Checks that the result of an expression does not throw an exception. More...
 
#define expectThrows(expr)
 Checks that the result of an expression throws an exception. More...
 
#define expectThrowsType(expr, type)
 Checks that the result of an expression throws an exception of a certain type. More...
 

Macro Definition Documentation

#define expectDoesNotThrow (   expr)
Value:
try \
{ \
(expr); \
expect (true); \
} \
catch (...) \
{ \
expect (false, "Expected: does not throw an exception, Actual: throws."); \
}

Checks that the result of an expression does not throw an exception.

#define expectThrows (   expr)
Value:
try \
{ \
(expr); \
expect (false, "Expected: throws an exception, Actual: does not throw."); \
} \
catch (...) \
{ \
expect (true); \
}

Checks that the result of an expression throws an exception.

#define expectThrowsType (   expr,
  type 
)
Value:
try \
{ \
(expr); \
expect (false, "Expected: throws an exception of type " #type ", Actual: does not throw."); \
} \
catch (type&) \
{ \
expect (true); \
} \
catch (...) \
{ \
expect (false, "Expected: throws an exception of type " #type ", Actual: throws another type."); \
}

Checks that the result of an expression throws an exception of a certain type.