Zoltan2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Macros | Functions
ErrorHandlingForTests.hpp File Reference
#include <Zoltan2_config.h>
#include <iostream>
#include <string>
#include <exception>
#include <Teuchos_RCP.hpp>
#include <Teuchos_Comm.hpp>
#include <Teuchos_CommHelpers.hpp>
Include dependency graph for ErrorHandlingForTests.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define TEST_FAIL_AND_THROW(comm, ok, s)
 
#define TEST_FAIL_AND_EXIT(comm, ok, s, code)
 
#define TEST_FAIL_AND_RETURN(comm, ok, s)
 
#define TEST_FAIL_AND_RETURN_VALUE(comm, ok, s, rc)
 

Functions

int globalFail (const Comm< int > &comm, int fail)
 
void printFailureCode (const Comm< int > &comm, int fail)
 

Macro Definition Documentation

#define TEST_FAIL_AND_THROW (   comm,
  ok,
 
)
Value:
{ \
int gval, lval=( (ok) ? 0 : 1); \
reduceAll<int,int>(comm, Teuchos::REDUCE_SUM, 1, &lval, &gval);\
if (gval){ \
throw std::runtime_error(std::string(s)); \
} \
}

Definition at line 62 of file ErrorHandlingForTests.hpp.

#define TEST_FAIL_AND_EXIT (   comm,
  ok,
  s,
  code 
)
Value:
{ \
int gval, lval=( (ok) ? 0 : 1); \
reduceAll<int,int>(comm, Teuchos::REDUCE_SUM, 1, &lval, &gval);\
if (gval){ \
if ((comm).getRank() == 0){\
std::cerr << "Error: " << s << std::endl;\
std::cout << "Error: " << s << std::endl;\
std::cout << "FAIL" << std::endl;\
} \
exit(code);\
} \
}

Definition at line 70 of file ErrorHandlingForTests.hpp.

#define TEST_FAIL_AND_RETURN (   comm,
  ok,
 
)
Value:
{ \
int gval, lval=( (ok) ? 0 : 1); \
reduceAll<int,int>(comm, Teuchos::REDUCE_SUM, 1, &lval, &gval);\
if (gval){ \
if ((comm).getRank() == 0){\
std::cerr << "Error: " << s << std::endl;\
std::cout << "Error: " << s << std::endl;\
std::cout << "FAIL" << std::endl;\
} \
return; \
} \
}

Definition at line 83 of file ErrorHandlingForTests.hpp.

#define TEST_FAIL_AND_RETURN_VALUE (   comm,
  ok,
  s,
  rc 
)
Value:
{ \
int gval, lval=( (ok) ? 0 : 1); \
reduceAll<int,int>(comm, Teuchos::REDUCE_SUM, 1, &lval, &gval);\
if (gval){ \
if ((comm).getRank() == 0){\
std::cerr << "Error: " << s << std::endl;\
std::cout << "Error: " << s << std::endl;\
std::cout << "FAIL" << std::endl;\
} \
return (rc); \
} \
}

Definition at line 96 of file ErrorHandlingForTests.hpp.

Function Documentation

int globalFail ( const Comm< int > &  comm,
int  fail 
)

Definition at line 109 of file ErrorHandlingForTests.hpp.

void printFailureCode ( const Comm< int > &  comm,
int  fail 
)

Definition at line 116 of file ErrorHandlingForTests.hpp.