122 uint16_t int_length = 0;
123 uint16_t int_width = 0;
124 uint16_t int_base = 0;
125 uint16_t int_height = 0;
126 uint16_t int_hypotenuse = 0;
127 uint16_t int_sides = 0;
128 uint16_t int_expected = 0;
129 uint16_t int_perimeter = 0;
131 float float_length = NAN;
132 float float_expected = NAN;
133 float float_perimeter = NAN;
135 double double_length = NAN;
136 double double_width = NAN;
137 double double_radius = NAN;
138 double double_height = NAN;
139 double double_expected = NAN;
140 double double_perimeter = NAN;
147 std::cout <<
"perimeter OF A SQUARE (int)" << std::endl;
148 std::cout <<
"Input Length: " << int_length << std::endl;
149 std::cout <<
"Expected Output: " << int_expected << std::endl;
150 std::cout <<
"Output: " << int_perimeter << std::endl;
151 assert(int_perimeter == int_expected);
152 std::cout <<
"TEST PASSED" << std::endl << std::endl;
159 std::cout <<
"perimeter OF A SQUARE (float)" << std::endl;
160 std::cout <<
"Input Length: " << float_length << std::endl;
161 std::cout <<
"Expected Output: " << float_expected << std::endl;
162 std::cout <<
"Output: " << float_perimeter << std::endl;
163 assert(float_perimeter == float_expected);
164 std::cout <<
"TEST PASSED" << std::endl << std::endl;
172 std::cout <<
"perimeter OF A RECTANGLE (int)" << std::endl;
173 std::cout <<
"Input Length: " << int_length << std::endl;
174 std::cout <<
"Input Width: " << int_width << std::endl;
175 std::cout <<
"Expected Output: " << int_expected << std::endl;
176 std::cout <<
"Output: " << int_perimeter << std::endl;
177 assert(int_perimeter == int_expected);
178 std::cout <<
"TEST PASSED" << std::endl << std::endl;
183 double_expected = 16.4;
186 std::cout <<
"perimeter OF A RECTANGLE (double)" << std::endl;
187 std::cout <<
"Input Length: " << double_length << std::endl;
188 std::cout <<
"Input Width: " << double_width << std::endl;
189 std::cout <<
"Expected Output: " << double_expected << std::endl;
190 std::cout <<
"Output: " << double_perimeter << std::endl;
191 assert(double_perimeter == double_expected);
192 std::cout <<
"TEST PASSED" << std::endl << std::endl;
202 std::cout <<
"perimeter OF A TRIANGLE" << std::endl;
203 std::cout <<
"Input Base: " << int_base << std::endl;
204 std::cout <<
"Input Height: " << int_height << std::endl;
205 std::cout <<
"Expected Output: " << int_expected << std::endl;
206 std::cout <<
"Output: " << int_perimeter << std::endl;
207 assert(int_perimeter == int_expected);
208 std::cout <<
"TEST PASSED" << std::endl << std::endl;
217 std::cout <<
"perimeter OF A CIRCLE" << std::endl;
218 std::cout <<
"Input Radius: " << double_radius << std::endl;
219 std::cout <<
"Expected Output: " << double_expected << std::endl;
220 std::cout <<
"Output: " << double_perimeter << std::endl;
221 assert(double_perimeter == double_expected);
222 std::cout <<
"TEST PASSED" << std::endl << std::endl;
230 std::cout <<
"perimeter OF A PARALLELOGRAM" << std::endl;
231 std::cout <<
"Input Base: " << int_base << std::endl;
232 std::cout <<
"Input Height: " << int_height << std::endl;
233 std::cout <<
"Expected Output: " << int_expected << std::endl;
234 std::cout <<
"Output: " << int_perimeter << std::endl;
235 assert(int_perimeter == int_expected);
236 std::cout <<
"TEST PASSED" << std::endl << std::endl;
240 double_expected = 66.0;
243 std::cout <<
"SURFACE perimeter OF A CUBE" << std::endl;
244 std::cout <<
"Input Length: " << double_length << std::endl;
245 std::cout <<
"Expected Output: " << double_expected << std::endl;
246 std::cout <<
"Output: " << double_perimeter << std::endl;
247 assert(double_perimeter == double_expected);
248 std::cout <<
"TEST PASSED" << std::endl << std::endl;
256 std::cout <<
"SURFACE perimeter OF A N-POLYGON" << std::endl;
257 std::cout <<
"Input Sides: " << int_sides << std::endl;
258 std::cout <<
"Input Length: " << int_length << std::endl;
259 std::cout <<
"Expected Output: " << int_expected << std::endl;
260 std::cout <<
"Output: " << int_perimeter << std::endl;
261 assert(int_perimeter == int_expected);
262 std::cout <<
"TEST PASSED" << std::endl << std::endl;
267 double_expected = 22.0;
271 std::cout <<
"SURFACE perimeter OF A CYLINDER" << std::endl;
272 std::cout <<
"Input Radius: " << double_radius << std::endl;
273 std::cout <<
"Input Height: " << double_height << std::endl;
274 std::cout <<
"Expected Output: " << double_expected << std::endl;
275 std::cout <<
"Output: " << double_perimeter << std::endl;
276 assert(double_perimeter == double_expected);
277 std::cout <<
"TEST PASSED" << std::endl << std::endl;