47 TUDEF(
"Matrix",
"Constant Constructor");
48 unsigned badCount = 0;
56 for(
unsigned i = 0; i < a.
rows(); i++)
58 for(
unsigned j = 0; j < a.
cols(); j++)
69 for(
unsigned i = 0; i < b.
rows(); i++)
71 for(
unsigned j = 0; j < b.
cols(); j++)
82 for(
unsigned i = 0; i < c.
rows(); i++)
84 for(
unsigned j = 0; j < c.
cols(); j++)
95 for(
unsigned i = 0; i < d.
rows(); i++)
97 for(
unsigned j = 0; j < d.
cols(); j++)
108 return testFramework.countFails();
115 TUDEF(
"Matrix",
"Vector Constructor");
116 unsigned badCount = 0;
120 for(
unsigned i = 0; i < 16; i++)
123 for(
unsigned i = 0; i < 16; i++)
126 for(
unsigned i = 0; i < 4; i++)
129 for(
unsigned i = 0; i < 4; i++)
142 for(
unsigned i = 0; i < e.
rows(); i++)
144 for(
unsigned j = 0; j < e.
cols(); j++)
146 if (v1(i*e.
cols()+j) != e(i,j))
152 failDescriptionStream <<
"Check to see if gnsstk::Matrix set the gnsstk::Vector of values properly into a 8x2 matrix. " << badCount <<
" of them are set improperly.";
153 failDescriptionString = failDescriptionStream.str();
154 failDescriptionStream.str(
"");
155 testFramework.assert(badCount==0, failDescriptionString, __LINE__);
158 for(
unsigned i = 0; i < f.
rows(); i++)
160 for(
unsigned j = 0; j < f.
cols(); j++)
162 if (v2(i*f.
cols()+j) != f(i,j))
168 failDescriptionStream <<
"Check to see if gnsstk::Matrix set the gnsstk::Vector of values properly into a 4x4 matrix. " << badCount <<
" of them are set improperly.";
169 failDescriptionString = failDescriptionStream.str(); failDescriptionStream.str(
"");
170 testFramework.assert(badCount==0, failDescriptionString, __LINE__);
173 for(
unsigned i = 0; i < g.
rows(); i++)
175 for(
unsigned j = 0; j < g.
cols(); j++)
177 if (v3(i*g.
cols()+j) != g(i,j))
183 failDescriptionStream <<
"Check to see if gnsstk::Matrix set the gnsstk::Vector of values properly into a 2x2 matrix. " << badCount <<
" of them are set improperly.";
184 failDescriptionString = failDescriptionStream.str(); failDescriptionStream.str(
"");
185 testFramework.assert(badCount==0, failDescriptionString, __LINE__);
188 for(
unsigned i = 0; i < h.
rows(); i++)
190 for(
unsigned j = 0; j < h.
cols(); j++)
192 if (v4(i*h.
cols()+j) != h(i,j))
198 failDescriptionStream <<
"Check to see if gnsstk::Matrix set the gnsstk::Vector of values properly into a 4x2 matrix. " << badCount <<
" of them are set improperly.";
199 failDescriptionString = failDescriptionStream.str(); failDescriptionStream.str(
"");
200 testFramework.assert(badCount==0, failDescriptionString, __LINE__);
203 return testFramework.countFails();
209 TUDEF(
"Matrix",
"Array Constructor");
211 static const double Aarr[] =
220 for (
unsigned row = 0; row < 5; row++)
222 for (
unsigned col = 0; col < 3; col++)
224 ostringstream failMsgStrm;
225 failMsgStrm <<
"(" << row <<
"," << col <<
") expected "
226 << Aarr[arrIdx] <<
", got " << A(row,col);
228 testFramework.assert_equals(Aarr[arrIdx++], A(row,col), __LINE__,
233 return testFramework.countFails();
239 unsigned errorTotal = 0;
246 cout <<
"Total Failures for " << __FILE__ <<
": " << errorTotal << endl;