def test_average_lower_bound(): assert test_common.isclose(average(test_common.lowerBound), lowerAverage), "Lower average bound test"
def test_average_upper_bound(): assert test_common.isclose(average(test_common.upperBound), upperAverage), "Upper average bound test"
def test_regression_b1_upper_bound(): assert test_common.isclose(regression_b1(upper_x, upper_y), upper_b1), "Upper regression (b1) bound test"
def __eq__(self, fdm_data): mock_simulator_data_datagram = MockSimulatorDataDatagram() if not isclose(fdm_data.time, mock_simulator_data_datagram.simulation_time, 0.001): return False if not isclose(fdm_data.gps.latitude, mock_simulator_data_datagram.latitude, 0.001): return False if not isclose(fdm_data.gps.longitude, mock_simulator_data_datagram.longitude, 0.001): return False if not isclose(fdm_data.gps.altitude, mock_simulator_data_datagram.altitude, 0.001): return False if not isclose(fdm_data.gps.airspeed, mock_simulator_data_datagram.airspeed, 0.001): return False if not isclose(fdm_data.gps.heading, mock_simulator_data_datagram.heading, 0.001): return False if not isclose(fdm_data.accelerometer.x, mock_simulator_data_datagram.x_acceleration, 0.001): return False if not isclose(fdm_data.accelerometer.y, mock_simulator_data_datagram.y_acceleration, 0.001): return False if not isclose(fdm_data.accelerometer.z, mock_simulator_data_datagram.z_acceleration, 0.001): return False if not isclose(fdm_data.gyroscope.roll_rate, mock_simulator_data_datagram.roll_rate, 0.001): return False if not isclose(fdm_data.gyroscope.pitch_rate, mock_simulator_data_datagram.pitch_rate, 0.001): return False if not isclose(fdm_data.gyroscope.yaw_rate, mock_simulator_data_datagram.yaw_rate, 0.001): return False if not isclose(fdm_data.thermometer.temperature, mock_simulator_data_datagram.temperature, 0.001): return False if not isclose(fdm_data.pressure_sensor.pressure, mock_simulator_data_datagram.static_pressure, 0.001): return False if not isclose(fdm_data.pitot_tube.pressure, mock_simulator_data_datagram.total_pressure, 0.001): return False if not isclose(fdm_data.ins.roll, mock_simulator_data_datagram.roll, 0.001): return False if not isclose(fdm_data.ins.pitch, mock_simulator_data_datagram.pitch, 0.001): return False if not isclose(fdm_data.ins.latitude, mock_simulator_data_datagram.latitude, 0.001): return False if not isclose(fdm_data.ins.longitude, mock_simulator_data_datagram.longitude, 0.001): return False if not isclose(fdm_data.ins.altitude, mock_simulator_data_datagram.altitude, 0.001): return False if not isclose(fdm_data.ins.airspeed, mock_simulator_data_datagram.airspeed, 0.001): return False if not isclose(fdm_data.ins.heading, mock_simulator_data_datagram.heading, 0.001): return False if not isclose(fdm_data.engine.thrust, mock_simulator_data_datagram.thrust, 0.001): return False if not isclose(fdm_data.controls.aileron, mock_simulator_data_datagram.aileron, 0.001): return False if not isclose(fdm_data.controls.elevator, mock_simulator_data_datagram.elevator, 0.001): return False if not isclose(fdm_data.controls.rudder, mock_simulator_data_datagram.rudder, 0.001): return False if not isclose(fdm_data.controls.throttle, mock_simulator_data_datagram.throttle, 0.001): return False if not isclose(fdm_data.accelerations.x, mock_simulator_data_datagram.fdm_x_acceleration, 0.001): return False if not isclose(fdm_data.accelerations.y, mock_simulator_data_datagram.fdm_y_acceleration, 0.001): return False if not isclose(fdm_data.accelerations.z, mock_simulator_data_datagram.fdm_z_acceleration, 0.001): return False if not isclose(fdm_data.accelerations.p_dot, mock_simulator_data_datagram.p_dot, 0.001): return False if not isclose(fdm_data.accelerations.q_dot, mock_simulator_data_datagram.q_dot, 0.001): return False if not isclose(fdm_data.accelerations.r_dot, mock_simulator_data_datagram.r_dot, 0.001): return False if not isclose(fdm_data.accelerations.u_dot, mock_simulator_data_datagram.u_dot, 0.001): return False if not isclose(fdm_data.accelerations.v_dot, mock_simulator_data_datagram.v_dot, 0.001): return False if not isclose(fdm_data.accelerations.w_dot, mock_simulator_data_datagram.w_dot, 0.001): return False if not isclose(fdm_data.accelerations.gravity, mock_simulator_data_datagram.gravity, 0.001): return False if not isclose(fdm_data.velocities.p, mock_simulator_data_datagram.p, 0.001): return False if not isclose(fdm_data.velocities.q, mock_simulator_data_datagram.q, 0.001): return False if not isclose(fdm_data.velocities.r, mock_simulator_data_datagram.r, 0.001): return False if not isclose(fdm_data.velocities.true_airspeed, mock_simulator_data_datagram.true_airspeed, 0.001): return False if not isclose(fdm_data.velocities.climb_rate, mock_simulator_data_datagram.climb_rate, 0.001): return False if not isclose(fdm_data.velocities.u, mock_simulator_data_datagram.u, 0.001): return False if not isclose(fdm_data.velocities.v, mock_simulator_data_datagram.v, 0.001): return False if not isclose(fdm_data.velocities.w, mock_simulator_data_datagram.w, 0.001): return False if not isclose(fdm_data.velocities.calibrated_airspeed, mock_simulator_data_datagram.calibrated_airspeed, 0.001): return False if not isclose(fdm_data.velocities.equivalent_airspeed, mock_simulator_data_datagram.equivalent_airspeed, 0.001): return False if not isclose(fdm_data.velocities.ground_speed, mock_simulator_data_datagram.ground_speed, 0.001): return False if not isclose(fdm_data.position.latitude, mock_simulator_data_datagram.fdm_latitude, 0.001): return False if not isclose(fdm_data.position.longitude, mock_simulator_data_datagram.fdm_longitude, 0.001): return False if not isclose(fdm_data.position.altitude, mock_simulator_data_datagram.fdm_altitude, 0.001): return False if not isclose(fdm_data.position.heading, mock_simulator_data_datagram.fdm_heading, 0.001): return False if not isclose(fdm_data.orientation.phi, mock_simulator_data_datagram.phi, 0.001): return False if not isclose(fdm_data.orientation.theta, mock_simulator_data_datagram.theta, 0.001): return False if not isclose(fdm_data.orientation.psi, mock_simulator_data_datagram.psi, 0.001): return False if not isclose(fdm_data.atmosphere.pressure, mock_simulator_data_datagram.fdm_pressure, 0.001): return False if not isclose(fdm_data.atmosphere.sea_level_pressure, mock_simulator_data_datagram.fdm_sea_level_pressure, 0.001): return False if not isclose(fdm_data.atmosphere.temperature, mock_simulator_data_datagram.fdm_temperature, 0.001): return False if not isclose(fdm_data.atmosphere.sea_level_temperature, mock_simulator_data_datagram.fdm_sea_level_temperature, 0.001): return False if not isclose(fdm_data.atmosphere.density, mock_simulator_data_datagram.fdm_density, 0.001): return False if not isclose(fdm_data.atmosphere.sea_level_density, mock_simulator_data_datagram.fdm_sea_level_density, 0.001): return False if not isclose(fdm_data.forces.x_body, mock_simulator_data_datagram.x_body, 0.001): return False if not isclose(fdm_data.forces.y_body, mock_simulator_data_datagram.y_body, 0.001): return False if not isclose(fdm_data.forces.z_body, mock_simulator_data_datagram.z_body, 0.001): return False if not isclose(fdm_data.forces.x_wind, mock_simulator_data_datagram.x_wind, 0.001): return False if not isclose(fdm_data.forces.y_wind, mock_simulator_data_datagram.y_wind, 0.001): return False if not isclose(fdm_data.forces.z_wind, mock_simulator_data_datagram.z_wind, 0.001): return False if not isclose(fdm_data.forces.x_total, mock_simulator_data_datagram.x_total, 0.001): return False if not isclose(fdm_data.forces.y_total, mock_simulator_data_datagram.y_total, 0.001): return False if not isclose(fdm_data.forces.z_total, mock_simulator_data_datagram.z_total, 0.001): return False return True
def test_regression_b0_upper_bound(): print(regression_b0(upper_x, upper_y, upper_b1)) assert test_common.isclose(regression_b0(upper_x, upper_y, upper_b1), upper_b0), "Upper regression (b0) bound test"
def test_regression_b1_lower_bound(): assert test_common.isclose(regression_b1(lower_x, lower_y), lower_b1), "Lower regression (b1) bound test"
def test_correlation_upper_bound(): assert test_common.isclose(correlation( upper_x, upper_y), upper_correlation), "Upper correlation bound test"
def test_regression_b0_lower_bound(): print(regression_b0(lower_x, lower_y, lower_b1)) assert test_common.isclose(regression_b0(lower_x, lower_y, lower_b1), lower_b0), "Lower regression (b0) bound test"
def test_correlation_lower_bound(): assert test_common.isclose(correlation( lower_x, lower_y), lower_correlation), "Lower correlation bound test"
def test_variance_upper_bound(): assert test_common.isclose(variance(test_common.upperBound), upper_variance), "Upper variance bound test"
def test_variance_lower_bound(): assert test_common.isclose(variance(test_common.lowerBound), lower_variance), "Lower variance bound test"
def test_ecart_type_upper_bound(): assert test_common.isclose(ecartType(test_common.upperBound), upper_ecart_type), "Upper ecart type bound test"
def test_ecart_type_lower_bound(): assert test_common.isclose(ecartType(test_common.lowerBound), lower_ecart_type), "Lower ecart type bound test"