preCICE v3.1.2
Loading...
Searching...
No Matches
Namespaces | Classes | Typedefs | Enumerations | Functions
precice::testing Namespace Reference

contains the testing framework. More...

Namespaces

namespace  com
 
namespace  inject
 

Classes

struct  ConnectionOptions
 
class  DataContextFixture
 
struct  ParallelCouplingSchemeFixture
 
struct  ParticipantState
 Represents a ParticipantState in a test. More...
 
struct  Ranks
 
struct  SerialCouplingSchemeFixture
 
class  TestContext
 
class  WaveformFixture
 
struct  WhiteboxAccessor
 struct giving access to the impl of a befriended class or struct More...
 

Typedefs

using Par = utils::Parallel
 

Enumerations

enum class  Require { PETSc , Events }
 
enum struct  ConnectionType { GatherScatter , PointToPoint }
 

Functions

cplscheme::PtrCouplingData makeCouplingData (mesh::PtrData data, mesh::PtrMesh mesh, bool exchangeSubsteps)
 
cplscheme::PtrCouplingData makeCouplingData (mesh::PtrData data, mesh::PtrMesh mesh)
 
boost::unit_test::log_level getBoostTestLogLevel ()
 Boost test Initialization function.
 
std::string filterFromLogLevel (boost::unit_test::log_level logLevel)
 
void setupTestLogging ()
 
constexpr Ranks operator""_ranks (unsigned long long value)
 
constexpr Ranks operator""_rank (unsigned long long value)
 
ParticipantState operator""_on (const char *name, std::size_t)
 User-defined literal allowing to create a serial ParticipantState from a given string.
 
DataID operator""_dataID (unsigned long long n)
 
std::string getPathToRepository ()
 Returns the base path of the repo.
 
std::string getPathToSources ()
 Returns the base path to the sources.
 
std::string getPathToTests ()
 Returns the base path to the integration tests.
 
std::string getTestPath ()
 Returns the full path to the file containing the current test.
 
std::string getTestName ()
 Returns the name of the current test.
 
int nextMeshID ()
 
boost::test_tools::predicate_result equals (const std::vector< float > &VectorA, const std::vector< float > &VectorB, float tolerance)
 equals to be used in tests. Compares two std::vectors using a given tolerance. Prints both operands on failure
 
boost::test_tools::predicate_result equals (const std::vector< double > &VectorA, const std::vector< double > &VectorB, double tolerance)
 
boost::test_tools::predicate_result equals (float a, float b, float tolerance=math::NUMERICAL_ZERO_DIFFERENCE)
 equals to be used in tests. Compares two scalar numbers using a given tolerance. Prints both operands on failure
 
boost::test_tools::predicate_result equals (double a, double b, double tolerance)
 
template<class DerivedA , class DerivedB >
boost::test_tools::predicate_result equals (const Eigen::MatrixBase< DerivedA > &A, const Eigen::MatrixBase< DerivedB > &B, double tolerance=math::NUMERICAL_ZERO_DIFFERENCE)
 equals to be used in tests. Compares two matrices using a given tolerance. Prints both operands on failure.
 

Detailed Description

contains the testing framework.

Typedef Documentation

◆ Par

Definition at line 31 of file TestContext.cpp.

Enumeration Type Documentation

◆ ConnectionType

A type of distributed connection

See also
ConnectionOptions
Enumerator
GatherScatter 
PointToPoint 

Definition at line 110 of file TestContext.hpp.

◆ Require

enum class precice::testing::Require
strong

Defines requirements for a test setup

Note
These are used for unit-tests. Integration tests calling the Participant initialize required components themselves.
Enumerator
PETSc 

Require to initialize PETSc. This implies the initialization of Events.

Events 

Require to initialize Event.

Definition at line 99 of file TestContext.hpp.

Function Documentation

◆ equals() [1/5]

template<class DerivedA , class DerivedB >
boost::test_tools::predicate_result precice::testing::equals ( const Eigen::MatrixBase< DerivedA > & A,
const Eigen::MatrixBase< DerivedB > & B,
double tolerance = math::NUMERICAL_ZERO_DIFFERENCE )

equals to be used in tests. Compares two matrices using a given tolerance. Prints both operands on failure.

Definition at line 55 of file Testing.hpp.

Here is the call graph for this function:

◆ equals() [2/5]

boost::test_tools::predicate_result precice::testing::equals ( const std::vector< double > & VectorA,
const std::vector< double > & VectorB,
double tolerance )

Definition at line 77 of file Testing.cpp.

Here is the call graph for this function:

◆ equals() [3/5]

boost::test_tools::predicate_result precice::testing::equals ( const std::vector< float > & VectorA,
const std::vector< float > & VectorB,
float tolerance )

equals to be used in tests. Compares two std::vectors using a given tolerance. Prints both operands on failure

Definition at line 65 of file Testing.cpp.

Here is the call graph for this function:

◆ equals() [4/5]

boost::test_tools::predicate_result precice::testing::equals ( double a,
double b,
double tolerance )

Definition at line 99 of file Testing.cpp.

Here is the call graph for this function:

◆ equals() [5/5]

boost::test_tools::predicate_result precice::testing::equals ( float a,
float b,
float tolerance )

equals to be used in tests. Compares two scalar numbers using a given tolerance. Prints both operands on failure

Definition at line 89 of file Testing.cpp.

Here is the call graph for this function:

◆ filterFromLogLevel()

std::string precice::testing::filterFromLogLevel ( boost::unit_test::log_level logLevel)

Definition at line 45 of file GlobalFixtures.cpp.

◆ getBoostTestLogLevel()

boost::unit_test::log_level precice::testing::getBoostTestLogLevel ( )

Boost test Initialization function.

Boost Test Log Levels and corresponding command line arguments to –log_level as of Boost 1.68:

type = enum boost::unit_test::log_level : int {
boost::unit_test::invalid_log_level = -1,
boost::unit_test::log_successful_tests = 0, all
boost::unit_test::log_test_units = 1, unit_scope, test_suite
boost::unit_test::log_messages = 2, message
boost::unit_test::log_warnings = 3, warning
boost::unit_test::log_all_errors = 4, error (default log level)
boost::unit_test::log_cpp_exception_errors = 5, cpp_exception
boost::unit_test::log_system_errors = 6, system_error
boost::unit_test::log_fatal_errors, fatal_error
boost::unit_test::log_nothing, nothing
}

Definition at line 34 of file GlobalFixtures.cpp.

◆ getPathToRepository()

std::string precice::testing::getPathToRepository ( )

Returns the base path of the repo.

Definition at line 25 of file Testing.cpp.

◆ getPathToSources()

std::string precice::testing::getPathToSources ( )

Returns the base path to the sources.

Definition at line 31 of file Testing.cpp.

Here is the call graph for this function:

◆ getPathToTests()

std::string precice::testing::getPathToTests ( )

Returns the base path to the integration tests.

Definition at line 36 of file Testing.cpp.

Here is the call graph for this function:

◆ getTestName()

std::string precice::testing::getTestName ( )

Returns the name of the current test.

Definition at line 47 of file Testing.cpp.

◆ getTestPath()

std::string precice::testing::getTestPath ( )

Returns the full path to the file containing the current test.

Definition at line 41 of file Testing.cpp.

Here is the call graph for this function:

◆ makeCouplingData() [1/2]

cplscheme::PtrCouplingData precice::testing::makeCouplingData ( mesh::PtrData data,
mesh::PtrMesh mesh )
inline

Definition at line 10 of file helper.hpp.

◆ makeCouplingData() [2/2]

cplscheme::PtrCouplingData precice::testing::makeCouplingData ( mesh::PtrData data,
mesh::PtrMesh mesh,
bool exchangeSubsteps )
inline

Definition at line 10 of file helper.hpp.

◆ nextMeshID()

int precice::testing::nextMeshID ( )

Generates a new mesh id for use in tests.

Returns
a new unique mesh ID

Definition at line 58 of file Testing.cpp.

Here is the call graph for this function:

◆ operator""_dataID()

DataID precice::testing::operator""_dataID ( unsigned long long n)

Definition at line 19 of file Testing.cpp.

◆ operator""_on()

ParticipantState precice::testing::operator""_on ( const char * name,
std::size_t  )
inline

User-defined literal allowing to create a serial ParticipantState from a given string.

Definition at line 86 of file TestContext.hpp.

◆ operator""_rank()

constexpr Ranks precice::testing::operator""_rank ( unsigned long long value)
inlineconstexpr

User-defined literal for expressively defining a single rank

Parameters
[in]valuethe amount of ranks which has to be 1
Returns
a strong typed count of 1 rank

Definition at line 40 of file TestContext.hpp.

◆ operator""_ranks()

constexpr Ranks precice::testing::operator""_ranks ( unsigned long long value)
inlineconstexpr

User-defined literal for expressively defining multiple ranks

Parameters
[in]valuethe amount of ranks <= 1
Returns
a strong typed count of ranks

Definition at line 29 of file TestContext.hpp.

◆ setupTestLogging()

void precice::testing::setupTestLogging ( )

Definition at line 62 of file GlobalFixtures.cpp.

Here is the call graph for this function: