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

Function main

SRC/handler/TestDataOutputDatabaseHandler.cpp:51–238  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 4

exitFunction · 0.85
openMethod · 0.45
setDatabaseMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected