Zoltan2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Macros | Typedefs | Functions
Zoltan2_TestHelpers.hpp File Reference

common code used by tests More...

#include <Teuchos_UnitTestHarness.hpp>
#include <Zoltan2_Util.hpp>
#include <iostream>
#include <Tpetra_Map.hpp>
#include <TpetraCore_config.h>
#include <ErrorHandlingForTests.hpp>
#include <PrintData.hpp>
#include <UserInputForTests.hpp>
Include dependency graph for Zoltan2_TestHelpers.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define STR_VALUE(path)   #path
 
#define PATH_NAME(path)   STR_VALUE(path)
 
#define MEMORY_CHECK(iPrint, msg)
 
#define Z2_TEST(TEST)
 
#define Z2_TEST_THROW(code, ExceptType)   Z2_TEST(TEST_THROW(code, ExceptType))
 
#define Z2_TEST_NOTHROW(code)   Z2_TEST(TEST_NOTHROW(code))
 
#define Z2_TEST_EQUALITY(val1, val2)   Z2_TEST(TEST_EQUALITY(val1, val2))
 
#define Z2_TEST_INEQUALITY(val1, val2)   Z2_TEST(TEST_INEQUALITY(val1, val2))
 
#define Z2_TEST_ASSERT(expr)   Z2_TEST(TEST_ASSERT(expr))
 
#define Z2_TEST_EQUALITY_CONST(val1, val2)   Z2_TEST(TEST_EQUALITY_CONST(val1, val2))
 
#define Z2_TEST_INEQUALITY_CONST(val1, val2)   Z2_TEST(TEST_INEQUALITY_CONST(val1, val2))
 
#define Z2_TEST_COMPARE(val1, comp, val2)   Z2_TEST(TEST_COMPARE(val1, comp, val2))
 
#define Z2_TEST_COMPARE_ARRAYS(val1, val2)   Z2_TEST(TEST_COMPARE_ARRAYS(val1, val2))
 
#define Z2_TEST_COMPARE_FLOATING_ARRAYS(val1, val2, tol)   Z2_TEST(TEST_COMPARE_FLOATING_ARRAYS(val1, val2, tol))
 
#define Z2_TEST_FLOATING_EQUALITY(val1, val2, tol)   Z2_TEST(TEST_FLOATING_EQUALITY(val1, val2, tol))
 
#define Z2_TEST_DEVICE_HOST_VIEWS(deviceView, hostView)
 

Typedefs

typedef Tpetra::Map::node_type znode_t
 
typedef int zpart_t
 
typedef
Tpetra::Map::local_ordinal_type 
zlno_t
 
typedef
Tpetra::Map::global_ordinal_type 
zgno_t
 
typedef float zscalar_t
 

Functions

std::string testDataFilePath (".")
 
std::string zoltanTestDirectory (".")
 
void PrintFromRoot (const std::string &message)
 
template<typename DeviceType , typename HostType >
void TestDeviceHostView (const DeviceType &deviceView, const HostType &hostView)
 

Detailed Description

common code used by tests

Definition in file Zoltan2_TestHelpers.hpp.

Macro Definition Documentation

#define STR_VALUE (   path)    #path

Definition at line 61 of file Zoltan2_TestHelpers.hpp.

#define PATH_NAME (   path)    STR_VALUE(path)

Definition at line 62 of file Zoltan2_TestHelpers.hpp.

#define MEMORY_CHECK (   iPrint,
  msg 
)
Value:
if (iPrint) { \
std::cout.width(10); \
std::cout.fill('*'); \
std::cout << kb << " KB, " << msg << std::endl; \
std::cout.width(0); \
std::cout.fill(' '); \
}
long getProcessKilobytes()

Definition at line 132 of file Zoltan2_TestHelpers.hpp.

#define Z2_TEST (   TEST)
Value:
{ \
Teuchos::RCP<Teuchos::FancyOStream> fout = \
Teuchos::fancyOStream(Teuchos::rcpFromRef(std::cout)); \
auto &out = *fout; \
bool success = true; \
try { \
TEST; \
} catch (...) { \
out << "Test failed."; \
} \
if (!success) { \
throw std::runtime_error(#TEST " FAIL"); \
} \
}

Definition at line 142 of file Zoltan2_TestHelpers.hpp.

#define Z2_TEST_THROW (   code,
  ExceptType 
)    Z2_TEST(TEST_THROW(code, ExceptType))

Definition at line 158 of file Zoltan2_TestHelpers.hpp.

#define Z2_TEST_NOTHROW (   code)    Z2_TEST(TEST_NOTHROW(code))

Definition at line 159 of file Zoltan2_TestHelpers.hpp.

#define Z2_TEST_EQUALITY (   val1,
  val2 
)    Z2_TEST(TEST_EQUALITY(val1, val2))

Definition at line 160 of file Zoltan2_TestHelpers.hpp.

#define Z2_TEST_INEQUALITY (   val1,
  val2 
)    Z2_TEST(TEST_INEQUALITY(val1, val2))

Definition at line 161 of file Zoltan2_TestHelpers.hpp.

#define Z2_TEST_ASSERT (   expr)    Z2_TEST(TEST_ASSERT(expr))

Definition at line 162 of file Zoltan2_TestHelpers.hpp.

#define Z2_TEST_EQUALITY_CONST (   val1,
  val2 
)    Z2_TEST(TEST_EQUALITY_CONST(val1, val2))

Definition at line 163 of file Zoltan2_TestHelpers.hpp.

#define Z2_TEST_INEQUALITY_CONST (   val1,
  val2 
)    Z2_TEST(TEST_INEQUALITY_CONST(val1, val2))

Definition at line 165 of file Zoltan2_TestHelpers.hpp.

#define Z2_TEST_COMPARE (   val1,
  comp,
  val2 
)    Z2_TEST(TEST_COMPARE(val1, comp, val2))

Definition at line 167 of file Zoltan2_TestHelpers.hpp.

#define Z2_TEST_COMPARE_ARRAYS (   val1,
  val2 
)    Z2_TEST(TEST_COMPARE_ARRAYS(val1, val2))

Definition at line 169 of file Zoltan2_TestHelpers.hpp.

#define Z2_TEST_COMPARE_FLOATING_ARRAYS (   val1,
  val2,
  tol 
)    Z2_TEST(TEST_COMPARE_FLOATING_ARRAYS(val1, val2, tol))

Definition at line 171 of file Zoltan2_TestHelpers.hpp.

#define Z2_TEST_FLOATING_EQUALITY (   val1,
  val2,
  tol 
)    Z2_TEST(TEST_FLOATING_EQUALITY(val1, val2, tol))

Definition at line 173 of file Zoltan2_TestHelpers.hpp.

#define Z2_TEST_DEVICE_HOST_VIEWS (   deviceView,
  hostView 
)
Value:
\
{ \
for (int dim = 0; dim <= 2; ++dim) { \
Z2_TEST_EQUALITY(deviceView.extent(dim), hostView.extent(dim)); \
} \
\
const auto mirrorDevice = Kokkos::create_mirror_view(deviceView); \
Kokkos::deep_copy(mirrorDevice, deviceView); \
Z2_TEST_COMPARE_ARRAYS(hostView, mirrorDevice); \
}
#define Z2_TEST_COMPARE_ARRAYS(val1, val2)
#define Z2_TEST_EQUALITY(val1, val2)

Definition at line 197 of file Zoltan2_TestHelpers.hpp.

Typedef Documentation

typedef Tpetra::Map ::node_type znode_t

Definition at line 57 of file Zoltan2_TestHelpers.hpp.

typedef int zpart_t

Definition at line 105 of file Zoltan2_TestHelpers.hpp.

typedef Tpetra::Map ::local_ordinal_type zlno_t

Definition at line 107 of file Zoltan2_TestHelpers.hpp.

typedef Tpetra::Map ::global_ordinal_type zgno_t

Definition at line 108 of file Zoltan2_TestHelpers.hpp.

typedef float zscalar_t

Definition at line 116 of file Zoltan2_TestHelpers.hpp.

Function Documentation

std::string testDataFilePath ( "."  )
std::string zoltanTestDirectory ( "."  )
void PrintFromRoot ( const std::string &  message)
inline

Definition at line 176 of file Zoltan2_TestHelpers.hpp.

template<typename DeviceType , typename HostType >
void TestDeviceHostView ( const DeviceType &  deviceView,
const HostType &  hostView 
)

Definition at line 183 of file Zoltan2_TestHelpers.hpp.