Peano 4
Loading...
Searching...
No Matches
StringTest.cpp
Go to the documentation of this file.
1#include "StringTest.h"
2#include "../StringMessage.h"
3#include "../Rank.h"
4
5
6tarch::logging::Log tarch::mpi::tests::StringTest::_log( "tarch::mpi::tests::StringTest" );
7
8
10 TestCase( "tarch::mpi::tests::StringTest" ) {
11}
12
13
15 testMethod (testSendReceive);
16}
17
18
20 #ifdef Parallel
21 const std::string testString = "unittest";
22 if (
23 tarch::mpi::Rank::getInstance().getNumberOfRanks()>1
24 and
26 ) {
27 StringMessage message;
28 message.setData( testString );
29 StringMessage::send( message, 1, 0, tarch::mpi::Rank::getInstance().getCommunicator() );
30 }
31
32 if (
33 tarch::mpi::Rank::getInstance().getNumberOfRanks()>1
34 and
36 ) {
37 StringMessage message;
38 StringMessage::receive( message, 0, 0, tarch::mpi::Rank::getInstance().getCommunicator() );
39 validateEqualsWithParams2( message.getData(), testString, message.toString(), testString );
40 }
41 #endif
42}
#define testMethod(name)
Run a test method and check for errors.
Definition TestMacros.h:24
#define validateEqualsWithParams2(actualValue, validValue, param0, param1)
Definition TestMacros.h:328
Log Device.
Definition Log.h:516
static Rank & getInstance()
This operation returns the singleton instance.
Definition Rank.cpp:538
static tarch::logging::Log _log
Definition StringTest.h:24
void testSendReceive()
Tests constructors.
virtual void run() override
This routine is triggered by the TestCaseCollection.
The string message looks like the other messages which I generate through DaStGen 2,...
static void send(const tarch::mpi::StringMessage &buffer, int destination, int tag, MPI_Comm communicator)
In DaStGen (the first version), I had a non-static version of the send as well as the receive.
void setData(const std::string &value)
static void receive(tarch::mpi::StringMessage &buffer, int source, int tag, MPI_Comm communicator)
std::string toString() const
std::string getData() const