Skip to content

Commit

Permalink
Added a test to trigger the bug reported in #485.
Browse files Browse the repository at this point in the history
  • Loading branch information
bcoconni committed Jul 24, 2021
1 parent 4669cda commit ab51299
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ set(PYTHON_TESTS ResetOutputFiles
TestFunctions
TestDistributor
TestMagnetometer
)
TestLinearActuator)

foreach(test ${PYTHON_TESTS})
add_test(NAME ${test}
Expand Down
37 changes: 37 additions & 0 deletions tests/TestLinearActuator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# TestDeadBand.py
#
# Test that the <linear_actuator> component is functional.
#
# Copyright (c) 2021 Bertrand Coconnier
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 3 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses/>
#

from JSBSim_utils import JSBSimTestCase, RunTest, FlightModel


class TestLinearActuator(JSBSimTestCase):
def test_bug_GH485(self):
"""Regression test for issue GH#485"""
tripod = FlightModel(self, 'tripod')
tripod.include_system_test_file('linear_actuator.xml')
fdm = tripod.start()

for v0, v in zip((2, 1, 358, 359, 1, 2, 359), (2, 1, -2, -1, 1, 2, -1)):
fdm['test/input'] = v0
fdm.run()
self.assertAlmostEqual(fdm['test/output'], v)


RunTest(TestLinearActuator)
10 changes: 10 additions & 0 deletions tests/linear_actuator.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<system>
<property>test/input</property>
<channel name="test">
<linear_actuator>
<input>test/input</input>
<module>360</module>
<output>test/output</output>
</linear_actuator>
</channel>
</system>

0 comments on commit ab51299

Please sign in to comment.