132 uint16_t int_length = 0;
133 uint16_t int_width = 0;
134 uint16_t int_base = 0;
135 uint16_t int_height = 0;
136 uint16_t int_expected = 0;
137 uint16_t int_area = 0;
139 float float_length = NAN;
140 float float_expected = NAN;
141 float float_area = NAN;
143 double double_length = NAN;
144 double double_width = NAN;
145 double double_radius = NAN;
146 double double_height = NAN;
147 double double_expected = NAN;
148 double double_area = NAN;
155 std::cout <<
"AREA OF A SQUARE (int)" << std::endl;
156 std::cout <<
"Input Length: " << int_length << std::endl;
157 std::cout <<
"Expected Output: " << int_expected << std::endl;
158 std::cout <<
"Output: " << int_area << std::endl;
159 assert(int_area == int_expected);
160 std::cout <<
"TEST PASSED" << std::endl << std::endl;
164 float_expected = 6.25;
167 std::cout <<
"AREA OF A SQUARE (float)" << std::endl;
168 std::cout <<
"Input Length: " << float_length << std::endl;
169 std::cout <<
"Expected Output: " << float_expected << std::endl;
170 std::cout <<
"Output: " << float_area << std::endl;
171 assert(float_area == float_expected);
172 std::cout <<
"TEST PASSED" << std::endl << std::endl;
180 std::cout <<
"AREA OF A RECTANGLE (int)" << std::endl;
181 std::cout <<
"Input Length: " << int_length << std::endl;
182 std::cout <<
"Input Width: " << int_width << std::endl;
183 std::cout <<
"Expected Output: " << int_expected << std::endl;
184 std::cout <<
"Output: " << int_area << std::endl;
185 assert(int_area == int_expected);
186 std::cout <<
"TEST PASSED" << std::endl << std::endl;
191 double_expected = 14.25;
194 std::cout <<
"AREA OF A RECTANGLE (double)" << std::endl;
195 std::cout <<
"Input Length: " << double_length << std::endl;
196 std::cout <<
"Input Width: " << double_width << std::endl;
197 std::cout <<
"Expected Output: " << double_expected << std::endl;
198 std::cout <<
"Output: " << double_area << std::endl;
199 assert(double_area == double_expected);
200 std::cout <<
"TEST PASSED" << std::endl << std::endl;
208 std::cout <<
"AREA OF A TRIANGLE" << std::endl;
209 std::cout <<
"Input Base: " << int_base << std::endl;
210 std::cout <<
"Input Height: " << int_height << std::endl;
211 std::cout <<
"Expected Output: " << int_expected << std::endl;
212 std::cout <<
"Output: " << int_area << std::endl;
213 assert(int_area == int_expected);
214 std::cout <<
"TEST PASSED" << std::endl << std::endl;
223 std::cout <<
"AREA OF A CIRCLE" << std::endl;
224 std::cout <<
"Input Radius: " << double_radius << std::endl;
225 std::cout <<
"Expected Output: " << double_expected << std::endl;
226 std::cout <<
"Output: " << double_area << std::endl;
227 assert(double_area == double_expected);
228 std::cout <<
"TEST PASSED" << std::endl << std::endl;
236 std::cout <<
"AREA OF A PARALLELOGRAM" << std::endl;
237 std::cout <<
"Input Base: " << int_base << std::endl;
238 std::cout <<
"Input Height: " << int_height << std::endl;
239 std::cout <<
"Expected Output: " << int_expected << std::endl;
240 std::cout <<
"Output: " << int_area << std::endl;
241 assert(int_area == int_expected);
242 std::cout <<
"TEST PASSED" << std::endl << std::endl;
246 double_expected = 181.5;
249 std::cout <<
"SURFACE AREA OF A CUBE" << std::endl;
250 std::cout <<
"Input Length: " << double_length << std::endl;
251 std::cout <<
"Expected Output: " << double_expected << std::endl;
252 std::cout <<
"Output: " << double_area << std::endl;
253 assert(double_area == double_expected);
254 std::cout <<
"TEST PASSED" << std::endl << std::endl;
257 double_radius = 10.0;
258 double_expected = 1256.6370614359172;
262 std::cout <<
"SURFACE AREA OF A SPHERE" << std::endl;
263 std::cout <<
"Input Radius: " << double_radius << std::endl;
264 std::cout <<
"Expected Output: " << double_expected << std::endl;
265 std::cout <<
"Output: " << double_area << std::endl;
266 assert(double_area == double_expected);
267 std::cout <<
"TEST PASSED" << std::endl << std::endl;
272 double_expected = 276.46015351590177;
275 std::cout <<
"SURFACE AREA OF A CYLINDER" << std::endl;
276 std::cout <<
"Input Radius: " << double_radius << std::endl;
277 std::cout <<
"Input Height: " << double_height << std::endl;
278 std::cout <<
"Expected Output: " << double_expected << std::endl;
279 std::cout <<
"Output: " << double_area << std::endl;
280 assert(double_area == double_expected);
281 std::cout <<
"TEST PASSED" << std::endl << std::endl;
284 double_radius = 10.0;
285 double_expected = 942.4777960769379;
288 std::cout <<
"SURFACE AREA OF A HEMI-SPHERE" << std::endl;
289 std::cout <<
"Input Radius: " << double_radius << std::endl;
290 std::cout <<
"Expected Output: " << double_expected << std::endl;
291 std::cout <<
"Output: " << double_area << std::endl;
292 assert(double_area == double_expected);
293 std::cout <<
"TEST PASSED" << std::endl << std::endl;