51 gnsstk::TestUtil testFramework(
"Vector",
"initializationTest",__FILE__,__LINE__);
61 std::valarray<double> valarray1(10.0, 250);
66 for(i=0; i<v1.
size(); i++)
68 failMesg =
"Were the array values set to expectation?";
69 if (1.0 != v1[i]) {badCount++;}
70 if (1.0 != v1(i)) {badCount++;}
72 testFramework.
assert(badCount==0, failMesg, __LINE__);
75 failMesg =
"Was the size set to expectation?";
76 testFramework.
assert(i == v1.
size(), failMesg, __LINE__);
78 for(i=0; i<v2.
size(); i++)
80 failMesg =
"Were the array values set to expectation?";
81 if (5.0 != v2[i]) {badCount++;}
82 if (5.0 != v2(i)) {badCount++;}
84 testFramework.
assert(badCount==0, failMesg, __LINE__);
87 failMesg =
"Was the size set to expectation?";
88 testFramework.
assert(i == v2.
size(), failMesg, __LINE__);
90 failMesg =
"Was the size set to expectation?";
91 testFramework.
assert(250 == st.
size(), failMesg, __LINE__);
93 for(i=0; i<Compare.
size(); i++)
95 failMesg =
"Were the array values set to expectation?";
96 if (1.0 != Compare[i]) {badCount++;}
97 if (1.0 != Compare(i)) {badCount++;}
99 testFramework.
assert(badCount==0, failMesg, __LINE__);
102 failMesg =
"Was the size set to expectation?";
103 testFramework.
assert(i == Compare.
size(), failMesg, __LINE__);
105 for(i=0; i<val.
size(); i++)
107 failMesg =
"Were the array values set to expectation?";
108 if (10.0 != val[i]) {badCount++;}
109 if (10.0 != val(i)) {badCount++;}
111 testFramework.
assert(badCount==0, failMesg, __LINE__);
114 failMesg =
"Was the size set to expectation?";
115 testFramework.
assert(i == val.
size(), failMesg, __LINE__);
127 gnsstk::TestUtil testFramework(
"Vector",
"== Operator", __FILE__, __LINE__);
128 std::string failMesg;
137 for(
int i = 0; i < v2.
size(); i++)
139 failMesg =
"Are equivalent objects equivalent?";
140 if (v2[i] != v3[i]) {badCount++;}
142 testFramework.
assert(badCount==0, failMesg, __LINE__);
144 for(
int i = 0; i < v1.
size(); i++)
146 failMesg =
"Are equivalent objects equivalent?";
147 if (-v1[i] != v4[i]) {badCount++;}
149 testFramework.
assert(badCount==0, failMesg, __LINE__);
155 for(
int i = 0; i < v2.
size(); i++)
157 failMesg =
"Were the previous addition operators successful?";
158 if (8. != v2[i]) {badCount++;}
160 testFramework.
assert(badCount==0, failMesg, __LINE__);
166 for(
int i = 0; i < v1.
size(); i++)
168 failMesg =
"Were the previous subtraction operators successful?";
169 if (v1[i] != v2[i]) {badCount++;}
171 testFramework.
assert(badCount==0, failMesg, __LINE__);
177 failMesg =
"Was the previous && operators successful in joining similar vectors?";
178 testFramework.
assert((
size_t)15==v1.
size(), failMesg, __LINE__);
182 failMesg =
"Was the previous && operators successful in joining different vectors?";
183 testFramework.
assert((
size_t)27==v1.
size(), failMesg, __LINE__);
191 int check, errorCounter = 0;
195 errorCounter += check;
199 std::cout <<
"Total Failures for " << __FILE__ <<
": " << errorCounter << std::endl;