8 from phm_msgs.msg
import Reliability
10 PKG =
'phm_reliability_calculation' 11 NAME =
'test_phm_reliability_estimation_node' 16 reliability_dict = dict({
'System': {
'Power': {
'Reliability': {
'Nominal': 0.9999992289110848}},
'Mobility': {
'Reliability': {
'Nominal': 0.9999999213314239}},
'Communication': {
'Reliability': {
'Nominal': 0.9999999822923761}},
'Reliability': {
'Nominal': 0.999999118612577,
'Sensor Based': 0.999999118612577},
'Computation': {
'Reliability': {
'Nominal': 0.9999999998083333}},
'Sensing': {
'Reliability': {
'Nominal': 0.9999999862692709}}}})
20 phm_reliability = Reliability()
23 system_value = 0.999999118613
24 system_sensor_based_value = 0.999999118613
25 module_names = [
"Power",
"Mobility",
"Communication",
"Computation",
"Sensing"]
26 module_values = [0.9999992289110848, 0.9999999213314239, 0.9999999822923761, 0.9999999998083333, 0.9999999862692709]
27 module_sensor_based_values = [0.0, 0.0, 0.0, 0.0, 0.0]
30 self.assertAlmostEqual(phm_reliability.system_value, system_value, 5)
31 self.assertAlmostEqual(phm_reliability.system_sensor_based_value, system_sensor_based_value, 5)
32 self.assertListEqual(phm_reliability.module_names, module_names)
33 self.assertListEqual(phm_reliability.module_values, module_values)
34 self.assertListEqual(phm_reliability.module_sensor_based_values, module_sensor_based_values)
37 if __name__ ==
'__main__':
38 rosunit.unitrun(PKG, NAME, TestReliabilityEstimationNode, sysargs =
"--cov", coverage_packages=[str(PKG)])
def test_set_reliability_func(self)