MCPcopy Create free account
hub / github.com/JSBSim-Team/jsbsim / Compare

Method Compare

tests/TestModelLoading.py:117–143  ·  view source on GitHub ↗
(self, section)

Source from the content-addressed store, hash-verified

115 self.Compare(section_element.tag+" file:"+section_file)
116
117 def Compare(self, section):
118 # Rerun the script with the modified aircraft definition
119 self.sandbox.delete_csv_files()
120 fdm = CreateFDM(self.sandbox)
121 # We need to tell JSBSim that the aircraft definition is located in the
122 # directory build/.../aircraft
123 fdm.set_aircraft_path('aircraft')
124 fdm.set_output_directive(self.sandbox.path_to_jsbsim_file('tests',
125 'output.xml'))
126 fdm.load_script(self.script)
127 fdm['simulation/randomseed'] = 0.0
128
129 fdm.run_ic()
130 ExecuteUntil(fdm, 50.0)
131
132 mod = pd.read_csv('output.csv', index_col=0)
133
134 # Check the data are matching i.e. the time steps are the same between
135 # the two data sets and that the output data are also the same.
136 self.assertTrue(isDataMatching(self.ref, mod))
137
138 # Whether the data is read from the aircraft definition file or from an
139 # external file, the results shall be exactly identical. Hence the
140 # precision set to 0.0.
141 diff = FindDifferences(self.ref, mod, 0.0)
142 self.assertEqual(len(diff), 0,
143 msg='\nTesting section "'+section+'"\n'+diff.to_string())
144
145 def test_model_loading(self):
146 self.longMessage = True

Callers 3

DetachAndCompareMethod · 0.95
InsertAndCompareMethod · 0.95

Calls 8

CreateFDMFunction · 0.90
ExecuteUntilFunction · 0.90
isDataMatchingFunction · 0.90
FindDifferencesFunction · 0.90
load_scriptMethod · 0.80
assertEqualMethod · 0.80
delete_csv_filesMethod · 0.45
path_to_jsbsim_fileMethod · 0.45

Tested by

no test coverage detected