58 gnsstk::TestUtil testFramework(
"WxObsMap",
"Default Constructor", __FILE__, __LINE__);
63 failMesg =
"Was the time value set correctly?";
66 failMesg =
"Was the temperature source set correctly?";
69 failMesg =
"Was the pressure source set correctly?";
72 failMesg =
"Was the humidity source set correctly?";
76 cTime.
set(500005,6,.7);
82 failMesg =
"Was the time value set correctly?";
83 testFramework.
assert(Compare1.
t == cTime, failMesg, __LINE__);
85 failMesg =
"Was the temperature value set correctly?";
88 failMesg =
"Was the pressure value set correctly?";
91 failMesg =
"Was the humidity value set correctly?";
94 failMesg =
"Was the temperature source set correctly?";
97 failMesg =
"Was the temperature source set correctly?";
100 failMesg =
"Was the temperature source set correctly?";
105 failMesg =
"Does the isAllValid method function properly?";
110 std::string outputString, referenceString;
111 std::stringstream outputStream, referenceStream;
112 outputStream << Compare1;
113 outputString = outputStream.str();
114 referenceStream << cTime <<
", t=" << 100 <<
", p=" << 0.5 <<
", rh=" << 0.8;
115 referenceString = referenceStream.str();
117 failMesg =
"Does the << operator function properly?";
118 testFramework.
assert(referenceString == outputString, failMesg, __LINE__);
142 gnsstk::TestUtil testFramework(
"WxObsMap",
"Default Constructor", __FILE__, __LINE__);
143 std::string failMesg;
147 failMesg =
"Was the default value stored?";
150 failMesg =
"Was the default value stored?";
156 cTime.
set((
double)1000);
158 for (
int i = 0; i < 10; i++)
160 cTime.
set((
double)1000+i);
162 100+i, (50+i)*0.001, (80+i)*0.001));
166 cTime.
set((
double)1008);
168 failMesg =
"Was the WxObservation object stored in the map?";
169 testFramework.
assert(Compare.
obs.count(cTime), failMesg, __LINE__);
182 failMesg =
"Did the getMostRecent method function correctly?";
185 testFramework.
assert(obs2.
t == obs1.
t &&
191 cTime.
set((
double) 1001);
192 failMesg =
"Is the WxObservation object stored? ";
193 testFramework.
assert(Compare.
obs.count(cTime), failMesg, __LINE__);
194 cTime.
set((
double) 1002);
195 failMesg =
"Is the WxObservation object stored? ";
196 testFramework.
assert(Compare.
obs.count(cTime), failMesg, __LINE__);
198 cTime.
set((
double) 1003);
200 Compare.
flush(cTime);
202 cTime.
set((
double) 1001);
203 failMesg =
"Was the WxObservation object erased? ";
204 testFramework.
assert(!Compare.
obs.count(cTime), failMesg, __LINE__);
205 cTime.
set((
double) 1002);
206 failMesg =
"Was the WxObservation object erased? ";
207 testFramework.
assert(!Compare.
obs.count(cTime), failMesg, __LINE__);
211 failMesg =
"[testing] WxObs.getWxObservation with a non-existent object, [expected] exception gnsstk::Exception, [actual] threw no exception";
216 cTime.
set((
double)1003);
220 failMesg =
"Did the getWxObservation return the correct object when called explicitly? ";
221 testFramework.
assert(obs3.
t == obs3.
t &&
227 cTime.
set((
double)1009);
229 cTime.
set((
double)1010);
232 failMesg =
"Did the getWxObservation return the correct object when called in a range containing 1 object?";
233 testFramework.
assert(obs5.
t == obs6.
t &&
239 cTime.
set((
double)1006);
243 failMesg =
"Did the getWxObservation return the correct object when called in a range containing 2 objects?";
244 testFramework.
assert(obs7.
t == obs8.
t &&
250 cTime.
set((
long)1007, (
double)43200);
256 failMesg =
"Did the getWxObservation perform linear interpolation succesfully?";
276 int check = 0, errorCounter = 0;
279 errorCounter += check;
282 errorCounter += check;
284 std::cout <<
"Total Failures for " << __FILE__ <<
": " << errorCounter << std::endl;