Skip to content

Commit

Permalink
added unittest for constrain function
Browse files Browse the repository at this point in the history
  • Loading branch information
Chr157i4n committed Aug 20, 2024
1 parent 8f3ea72 commit 5ca9d5a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/test_TMC_2209_math.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,13 @@ def test_steps_to_tstep(self):
"""test_steps_to_tstep"""
self.assertEqual(round(tmc_math.steps_to_tstep(400,2)), 234, "steps_to_tstep is wrong")

def test_constrain(self):
"""test_constrain"""
self.assertEqual(tmc_math.constrain(5,0,10), 5, "test_constrain is wrong")
self.assertEqual(tmc_math.constrain(15,0,10), 10, "test_constrain is wrong")
self.assertEqual(tmc_math.constrain(-5,0,10), 0, "test_constrain is wrong")
self.assertEqual(tmc_math.constrain(-5,-10,10), -5, "test_constrain is wrong")


if __name__ == '__main__':
unittest.main()

0 comments on commit 5ca9d5a

Please sign in to comment.