Zoltan2
Loading...
Searching...
No Matches
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:

Go to the source code of this file.

Macros

#define STR_VALUE(path)
#define PATH_NAME(path)
#define MEMORY_CHECK(iPrint, msg)
#define Z2_TEST(TEST)
#define Z2_TEST_THROW(code, ExceptType)
#define Z2_TEST_NOTHROW(code)
#define Z2_TEST_EQUALITY(val1, val2)
#define Z2_TEST_INEQUALITY(val1, val2)
#define Z2_TEST_ASSERT(expr)
#define Z2_TEST_EQUALITY_CONST(val1, val2)
#define Z2_TEST_INEQUALITY_CONST(val1, val2)
#define Z2_TEST_COMPARE(val1, comp, val2)
#define Z2_TEST_COMPARE_ARRAYS(val1, val2)
#define Z2_TEST_COMPARE_FLOATING_ARRAYS(val1, val2, tol)
#define Z2_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

◆ STR_VALUE

#define STR_VALUE ( path)
Value:
#path

Definition at line 25 of file Zoltan2_TestHelpers.hpp.

◆ PATH_NAME

#define PATH_NAME ( path)
Value:
STR_VALUE(path)
#define STR_VALUE(path)

Definition at line 26 of file Zoltan2_TestHelpers.hpp.

◆ MEMORY_CHECK

#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 96 of file Zoltan2_TestHelpers.hpp.

◆ Z2_TEST

#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 106 of file Zoltan2_TestHelpers.hpp.

◆ Z2_TEST_THROW

#define Z2_TEST_THROW ( code,
ExceptType )
Value:
Z2_TEST(TEST_THROW(code, ExceptType))
#define Z2_TEST(TEST)

Definition at line 122 of file Zoltan2_TestHelpers.hpp.

◆ Z2_TEST_NOTHROW

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

Definition at line 123 of file Zoltan2_TestHelpers.hpp.

◆ Z2_TEST_EQUALITY

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

Definition at line 124 of file Zoltan2_TestHelpers.hpp.

◆ Z2_TEST_INEQUALITY

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

Definition at line 125 of file Zoltan2_TestHelpers.hpp.

◆ Z2_TEST_ASSERT

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

Definition at line 126 of file Zoltan2_TestHelpers.hpp.

◆ Z2_TEST_EQUALITY_CONST

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

Definition at line 127 of file Zoltan2_TestHelpers.hpp.

◆ Z2_TEST_INEQUALITY_CONST

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

Definition at line 129 of file Zoltan2_TestHelpers.hpp.

◆ Z2_TEST_COMPARE

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

Definition at line 131 of file Zoltan2_TestHelpers.hpp.

◆ Z2_TEST_COMPARE_ARRAYS

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

Definition at line 133 of file Zoltan2_TestHelpers.hpp.

◆ Z2_TEST_COMPARE_FLOATING_ARRAYS

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

Definition at line 135 of file Zoltan2_TestHelpers.hpp.

◆ Z2_TEST_FLOATING_EQUALITY

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

Definition at line 137 of file Zoltan2_TestHelpers.hpp.

◆ Z2_TEST_DEVICE_HOST_VIEWS

#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); \
}

Definition at line 161 of file Zoltan2_TestHelpers.hpp.

Typedef Documentation

◆ znode_t

typedef Tpetra::Map ::node_type znode_t

Definition at line 21 of file Zoltan2_TestHelpers.hpp.

◆ zpart_t

typedef int zpart_t

Definition at line 69 of file Zoltan2_TestHelpers.hpp.

◆ zlno_t

typedef Tpetra::Map ::local_ordinal_type zlno_t

Definition at line 71 of file Zoltan2_TestHelpers.hpp.

◆ zgno_t

typedef Tpetra::Map ::global_ordinal_type zgno_t

Definition at line 72 of file Zoltan2_TestHelpers.hpp.

◆ zscalar_t

typedef float zscalar_t

Definition at line 80 of file Zoltan2_TestHelpers.hpp.

Function Documentation

◆ testDataFilePath()

std::string testDataFilePath ( "." )

◆ zoltanTestDirectory()

std::string zoltanTestDirectory ( "." )

◆ PrintFromRoot()

void PrintFromRoot ( const std::string & message)
inline

Definition at line 140 of file Zoltan2_TestHelpers.hpp.

◆ TestDeviceHostView()

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

Definition at line 147 of file Zoltan2_TestHelpers.hpp.