Path: Add additional roughly-equal depths unit tests

This commit is contained in:
Russell Johnson
2022-03-16 22:03:43 -05:00
parent abdb4eea86
commit 0c63eb2d94

View File

@@ -251,3 +251,63 @@ class depthTestCases(unittest.TestCase):
self.assertListEqual(
r, expected, "Expected {}, but result of {}".format(expected, r)
)
def test110(self):
"""two custom user depths roughly equal to final depth"""
args = {
"clearance_height": 20.0,
"safe_height": 15.0,
"start_depth": 9.0,
"step_down": 3.0,
"z_finish_step": 0.0,
"final_depth": 0.0,
"user_depths": [0.00000001, 0.0],
}
expected = [0]
d = PathUtils.depth_params(**args)
r = [i for i in d]
self.assertListEqual(
r, expected, "Expected {}, but result of {}".format(expected, r)
)
def test120(self):
"""four custom user depths with two roughly equal included"""
args = {
"clearance_height": 20.0,
"safe_height": 15.0,
"start_depth": 9.0,
"step_down": 3.0,
"z_finish_step": 0.0,
"final_depth": 0.0,
"user_depths": [6.0, 3.00000001, 3.0, 0.0],
}
expected = [6.0, 3.0, 0.0]
d = PathUtils.depth_params(**args)
r = [i for i in d]
self.assertListEqual(
r, expected, "Expected {}, but result of {}".format(expected, r)
)
def test130(self):
"""five custom user depths with three roughly equal included"""
args = {
"clearance_height": 20.0,
"safe_height": 15.0,
"start_depth": 9.0,
"step_down": 3.0,
"z_finish_step": 0.0,
"final_depth": 0.0,
"user_depths": [6.0, 3.00000002, 3.00000001, 3.0, 0.0],
}
expected = [6.0, 3.0, 0.0]
d = PathUtils.depth_params(**args)
r = [i for i in d]
self.assertListEqual(
r, expected, "Expected {}, but result of {}".format(expected, r)
)