Slicer  4.8
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
Classes | Macros
vtkTestingOutputWindow.h File Reference
#include "vtkAddon.h"
#include "vtkObject.h"
#include "vtkOutputWindow.h"
#include "vtkLoggingMacros.h"
Include dependency graph for vtkTestingOutputWindow.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  vtkTestingOutputWindow
 VTK message output window class for automated testing. More...
 

Macros

#define TESTING_OUTPUT_ASSERT_ERRORS(expectedNumberOfMessages)
 Exits with failure if the number of logged error messages is not equal to the specified number. More...
 
#define TESTING_OUTPUT_ASSERT_ERRORS_BEGIN()
 Asserts that no warnings or errors has been logged so far and prepares for receiving error(s) More...
 
#define TESTING_OUTPUT_ASSERT_ERRORS_END()
 Asserts that error(s) are logged (warnings ignored), and clears the counters. More...
 
#define TESTING_OUTPUT_ASSERT_ERRORS_MINIMUM(expectedNumberOfMessages)
 Exits with failure if the number of logged error messages is equal or more than the specified number. More...
 
#define TESTING_OUTPUT_ASSERT_MESSAGES(expectedNumberOfMessages)
 Exits with failure if the number of logged messages is not equal to the specified number. More...
 
#define TESTING_OUTPUT_ASSERT_WARNINGS(expectedNumberOfMessages)
 Exits with failure if the number of logged warning messages is not equal to the specified number. More...
 
#define TESTING_OUTPUT_ASSERT_WARNINGS_BEGIN()
 Asserts that no warnings or errors has been logged so far and prepares for receiving warning(s) More...
 
#define TESTING_OUTPUT_ASSERT_WARNINGS_END()
 Asserts that warning(s) are logged but not errors, and clears the counters. More...
 
#define TESTING_OUTPUT_ASSERT_WARNINGS_ERRORS(expectedNumberOfMessages)
 Exits with failure if the number of logged error or warning messages is not equal to the specified number. More...
 
#define TESTING_OUTPUT_ASSERT_WARNINGS_MINIMUM(expectedNumberOfMessages)
 Exits with failure if the number of logged warning messages is equal or more than the specified number. More...
 
#define TESTING_OUTPUT_IGNORE_WARNINGS_ERRORS_BEGIN()
 Asserts that no warnings or errors has been logged so far and prepares for receiving error(s) More...
 
#define TESTING_OUTPUT_IGNORE_WARNINGS_ERRORS_END()
 Asserts that error(s) are logged (warnings ignored), and clears the counters. More...
 
#define TESTING_OUTPUT_INIT()   vtkTestingOutputWindow::GetInstance();
 Initializes logging to the tesing window. More...
 
#define TESTING_OUTPUT_RESET()   vtkTestingOutputWindow::GetInstance()->ResetNumberOfLoggedMessages();
 Resets all message counters to 0. More...
 

Macro Definition Documentation

◆ TESTING_OUTPUT_ASSERT_ERRORS

#define TESTING_OUTPUT_ASSERT_ERRORS (   expectedNumberOfMessages)
Value:
{ \
if (actualNumberOfMessages != expectedNumberOfMessages) \
{ \
std::cerr << "Assertion failed in " << __FILE__ << ":" << __LINE__ << " - expected " << expectedNumberOfMessages \
<< " error messages, got " << actualNumberOfMessages << std::endl; \
exit(EXIT_FAILURE); \
} \
};
virtual int GetNumberOfLoggedErrorMessages()
static vtkTestingOutputWindow * GetInstance()

Exits with failure if the number of logged error messages is not equal to the specified number.

Definition at line 129 of file vtkTestingOutputWindow.h.

◆ TESTING_OUTPUT_ASSERT_ERRORS_BEGIN

#define TESTING_OUTPUT_ASSERT_ERRORS_BEGIN ( )
Value:
{ \
/* Make sure there were no errors or warnings so far */ \
TESTING_OUTPUT_ASSERT_WARNINGS_ERRORS(0); \
vtkInfoWithoutObjectMacro("Expecting warning or error message(s)..."); \
}

Asserts that no warnings or errors has been logged so far and prepares for receiving error(s)

Definition at line 194 of file vtkTestingOutputWindow.h.

◆ TESTING_OUTPUT_ASSERT_ERRORS_END

#define TESTING_OUTPUT_ASSERT_ERRORS_END ( )
Value:
{ \
TESTING_OUTPUT_ASSERT_ERRORS_MINIMUM(1); \
vtkInfoWithoutObjectMacro("Expected error message(s) successfully received"); \
TESTING_OUTPUT_RESET(); \
}

Asserts that error(s) are logged (warnings ignored), and clears the counters.

Definition at line 202 of file vtkTestingOutputWindow.h.

◆ TESTING_OUTPUT_ASSERT_ERRORS_MINIMUM

#define TESTING_OUTPUT_ASSERT_ERRORS_MINIMUM (   expectedNumberOfMessages)
Value:
{ \
if (actualNumberOfMessages < expectedNumberOfMessages) \
{ \
std::cerr << "Assertion failed in " << __FILE__ << ":" << __LINE__ << " - expected minimum " << expectedNumberOfMessages \
<< " error messages, got " << actualNumberOfMessages << std::endl; \
exit(EXIT_FAILURE); \
} \
};
virtual int GetNumberOfLoggedErrorMessages()
static vtkTestingOutputWindow * GetInstance()

Exits with failure if the number of logged error messages is equal or more than the specified number.

Definition at line 165 of file vtkTestingOutputWindow.h.

◆ TESTING_OUTPUT_ASSERT_MESSAGES

#define TESTING_OUTPUT_ASSERT_MESSAGES (   expectedNumberOfMessages)
Value:
{ \
if (actualNumberOfMessages != expectedNumberOfMessages) \
{ \
std::cerr << "Assertion failed in " << __FILE__ << ":" << __LINE__ << " - expected " << expectedNumberOfMessages \
<< " messages, got " << actualNumberOfMessages << std::endl; \
exit(EXIT_FAILURE); \
} \
};
static vtkTestingOutputWindow * GetInstance()
virtual int GetNumberOfLoggedMessages()

Exits with failure if the number of logged messages is not equal to the specified number.

Definition at line 105 of file vtkTestingOutputWindow.h.

◆ TESTING_OUTPUT_ASSERT_WARNINGS

#define TESTING_OUTPUT_ASSERT_WARNINGS (   expectedNumberOfMessages)
Value:
{ \
if (actualNumberOfMessages != expectedNumberOfMessages) \
{ \
std::cerr << "Assertion failed in " << __FILE__ << ":" << __LINE__ << " - expected " << expectedNumberOfMessages \
<< " warnings messages, got " << actualNumberOfMessages << std::endl; \
exit(EXIT_FAILURE); \
} \
};
static vtkTestingOutputWindow * GetInstance()
virtual int GetNumberOfLoggedWarningMessages()

Exits with failure if the number of logged warning messages is not equal to the specified number.

Definition at line 117 of file vtkTestingOutputWindow.h.

◆ TESTING_OUTPUT_ASSERT_WARNINGS_BEGIN

#define TESTING_OUTPUT_ASSERT_WARNINGS_BEGIN ( )
Value:
{ \
/* Make sure there were no errors or warnings so far */ \
TESTING_OUTPUT_ASSERT_WARNINGS_ERRORS(0); \
vtkInfoWithoutObjectMacro("Expecting warning message(s)..."); \
}

Asserts that no warnings or errors has been logged so far and prepares for receiving warning(s)

Definition at line 177 of file vtkTestingOutputWindow.h.

◆ TESTING_OUTPUT_ASSERT_WARNINGS_END

#define TESTING_OUTPUT_ASSERT_WARNINGS_END ( )
Value:
{ \
TESTING_OUTPUT_ASSERT_WARNINGS_MINIMUM(1); \
vtkInfoWithoutObjectMacro("Expected warning message(s) successfully received"); \
TESTING_OUTPUT_ASSERT_ERRORS(0); \
TESTING_OUTPUT_RESET(); \
}

Asserts that warning(s) are logged but not errors, and clears the counters.

Definition at line 185 of file vtkTestingOutputWindow.h.

◆ TESTING_OUTPUT_ASSERT_WARNINGS_ERRORS

#define TESTING_OUTPUT_ASSERT_WARNINGS_ERRORS (   expectedNumberOfMessages)
Value:
{ \
if (actualNumberOfMessages != expectedNumberOfMessages) \
{ \
std::cerr << "Assertion failed in " << __FILE__ << ":" << __LINE__ << " - expected " << expectedNumberOfMessages \
<< " error or warning messages, got " << actualNumberOfMessages << std::endl; \
exit(EXIT_FAILURE); \
} \
};
int GetNumberOfLoggedWarningErrorMessages()
static vtkTestingOutputWindow * GetInstance()

Exits with failure if the number of logged error or warning messages is not equal to the specified number.

Definition at line 141 of file vtkTestingOutputWindow.h.

◆ TESTING_OUTPUT_ASSERT_WARNINGS_MINIMUM

#define TESTING_OUTPUT_ASSERT_WARNINGS_MINIMUM (   expectedNumberOfMessages)
Value:
{ \
if (actualNumberOfMessages < expectedNumberOfMessages) \
{ \
std::cerr << "Assertion failed in " << __FILE__ << ":" << __LINE__ << " - expected minimum " << expectedNumberOfMessages \
<< " warning messages, got " << actualNumberOfMessages << std::endl; \
exit(EXIT_FAILURE); \
} \
};
static vtkTestingOutputWindow * GetInstance()
virtual int GetNumberOfLoggedWarningMessages()

Exits with failure if the number of logged warning messages is equal or more than the specified number.

Definition at line 153 of file vtkTestingOutputWindow.h.

◆ TESTING_OUTPUT_IGNORE_WARNINGS_ERRORS_BEGIN

#define TESTING_OUTPUT_IGNORE_WARNINGS_ERRORS_BEGIN ( )
Value:
{ \
/* Make sure there were no errors or warnings so far */ \
TESTING_OUTPUT_ASSERT_WARNINGS_ERRORS(0); \
vtkInfoWithoutObjectMacro("Ignoring expected warning or error message(s)..."); \
}

Asserts that no warnings or errors has been logged so far and prepares for receiving error(s)

Definition at line 210 of file vtkTestingOutputWindow.h.

◆ TESTING_OUTPUT_IGNORE_WARNINGS_ERRORS_END

#define TESTING_OUTPUT_IGNORE_WARNINGS_ERRORS_END ( )
Value:
{ \
vtkInfoWithoutObjectMacro("Finished ignoring warning or error message"); \
TESTING_OUTPUT_RESET(); \
}

Asserts that error(s) are logged (warnings ignored), and clears the counters.

Definition at line 218 of file vtkTestingOutputWindow.h.

◆ TESTING_OUTPUT_INIT

#define TESTING_OUTPUT_INIT ( )    vtkTestingOutputWindow::GetInstance();

Initializes logging to the tesing window.

Definition at line 99 of file vtkTestingOutputWindow.h.

◆ TESTING_OUTPUT_RESET

#define TESTING_OUTPUT_RESET ( )    vtkTestingOutputWindow::GetInstance()->ResetNumberOfLoggedMessages();

Resets all message counters to 0.

Definition at line 102 of file vtkTestingOutputWindow.h.