00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #include "Epetra_SerialComm.h"
00030 #include "Newp_Hello.h"
00031 #include <sstream>
00032
00033 #ifdef HAVE_MPI
00034 #include "mpi.h"
00035 #endif
00036
00037 int main(int argc, char *argv[]){
00038
00039 #ifdef HAVE_MPI
00040 MPI_Init(&argc, &argv);
00041 #endif
00042
00043 using namespace std;
00044
00045
00046 Epetra_SerialComm epetra_serial_comm;
00047 Epetra_Comm * epetra_comm;
00048 epetra_comm = dynamic_cast<Epetra_Comm*>(&epetra_serial_comm);
00049
00050
00051 stringbuf string_buf;
00052 streambuf * stream_buf;
00053 stream_buf = dynamic_cast<streambuf*>(&string_buf);
00054 iostream io_stream(stream_buf);
00055 ostream * o_stream;
00056 o_stream = dynamic_cast<ostream*>(&io_stream);
00057
00058
00059 Newp_Hello new_package_hello(*epetra_comm);
00060 new_package_hello.Print(*o_stream);
00061
00062
00063 char temp[83];
00064 io_stream.getline(temp, 83, 0);
00065
00066 char * expected = "This will print out one line for each of the 1 processes \n\nHello. I am process 0\n";
00067
00068 if(strcmp(temp, expected) != 0){
00069 cout << "Test Failed!" << endl << " Got::" << strlen(temp) << "::" << temp << "::" << endl << "Expected::" << strlen(expected) << "::" << expected << "::" << endl;
00070 return 1;
00071 }
00072 cout << "Test passed!" << endl;
00073 #ifdef EPETRA_MPI
00074 MPI_Finalize();
00075 #endif
00076 return 0;
00077 }