85 double initial_velocity = 5.0;
89 double expected_time_of_flight = 0.655;
90 double flight_time_output =
91 std::round(physics::ground_to_ground_projectile_motion::time_of_flight(initial_velocity, angle) * 1000.0) /
94 std::cout <<
"Projectile Flight Time (double)" << std::endl;
95 std::cout <<
"Input Initial Velocity: " << initial_velocity << std::endl;
96 std::cout <<
"Input Angle: " << angle << std::endl;
97 std::cout <<
"Expected Output: " << expected_time_of_flight << std::endl;
98 std::cout <<
"Output: " << flight_time_output << std::endl;
99 assert(flight_time_output == expected_time_of_flight);
100 std::cout <<
"TEST PASSED" << std::endl << std::endl;
103 double expected_horizontal_range = 2.51;
104 double horizontal_range_output =
105 std::round(physics::ground_to_ground_projectile_motion::horizontal_range(initial_velocity, angle,
106 flight_time_output) *
110 std::cout <<
"Projectile Horizontal Range (double)" << std::endl;
111 std::cout <<
"Input Initial Velocity: " << initial_velocity << std::endl;
112 std::cout <<
"Input Angle: " << angle << std::endl;
113 std::cout <<
"Input Time Of Flight: " << flight_time_output << std::endl;
114 std::cout <<
"Expected Output: " << expected_horizontal_range << std::endl;
115 std::cout <<
"Output: " << horizontal_range_output << std::endl;
116 assert(horizontal_range_output == expected_horizontal_range);
117 std::cout <<
"TEST PASSED" << std::endl << std::endl;
120 double expected_max_height = 0.526;
121 double max_height_output =
122 std::round(physics::ground_to_ground_projectile_motion::max_height(initial_velocity, angle) * 1000.0) /
125 std::cout <<
"Projectile Max Height (double)" << std::endl;
126 std::cout <<
"Input Initial Velocity: " << initial_velocity << std::endl;
127 std::cout <<
"Input Angle: " << angle << std::endl;
128 std::cout <<
"Expected Output: " << expected_max_height << std::endl;
129 std::cout <<
"Output: " << max_height_output << std::endl;
130 assert(max_height_output == expected_max_height);
131 std::cout <<
"TEST PASSED" << std::endl << std::endl;