MCPcopy Create free account
hub / github.com/OpenSees/OpenSees / main

Function main

SRC/handler/TestDataOutputFileHandler.cpp:52–212  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50
51
52int main(int argc, char **argv)
53{
54 //
55 // local variables used in test
56 //
57 int numColumns = 5;
58 char *columns[numColumns];
59 char column1[] = "col1";
60 char column2[] = "col2";
61 char column3[] = "col3";
62 char column4[] = "col4";
63 char column5[] = "col5";
64 columns[0] = column1;
65 columns[1] = column2;
66 columns[2] = column3;
67 columns[3] = column4;
68 columns[4] = column5;
69 int result, result1, result2, result3, result4;
70
71 Vector data1(numColumns);
72 Vector data2(numColumns-1);
73 for (int i=0; i<numColumns; i++)
74 data1(i) = i+1;
75 for (int i=0; i<numColumns-1; i++)
76 data2(i) = i+1;
77
78
79
80 opserr << " *******************************************************************\n";
81 opserr << " DataOutputFileHandler unit test\n";
82 opserr << " *******************************************************************\n\n";
83 opserr << " The DataOutputFile class provides implements 2 methods \n";
84 opserr << " open() - to open a connection to the o/p stream";
85 opserr << " write() - to send the contents of a vector to this stream\n\n";
86 opserr << " *******************************************************************\n";
87
88 //
89 // first test we can create DataOutputFile object to test.
90 //
91
92 opserr << "TEST: Creation of DataOutputFile object - will create 3 objects 1,2, & 3\n";
93
94 DataOutputFileHandler *theHandler1 = new DataOutputFileHandler("UnitTest1");
95 DataOutputFileHandler *theHandler2 = new DataOutputFileHandler("UnitTest2", DATA_FILE);
96 DataOutputFileHandler *theHandler3 = new DataOutputFileHandler("UnitTest3", XML_FILE, APPEND);
97 DataOutputFileHandler *theHandler4 = new DataOutputFileHandler(0);
98
99 if (theHandler1 != 0 && theHandler2 != 0 && theHandler3 != 0 && theHandler4 != 0)
100 opserr << "PASS: Creation of DataOutputFileHandler object\n\n";
101 else {
102 opserr << "FAIL: Creation of DataOutputFileHandler object\n\n";
103 exit(-1);
104 }
105
106 //
107 // test open() method
108 //
109

Callers

nothing calls this directly

Calls 3

exitFunction · 0.85
openMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected