Beispiel #1
0
 def test9_find_shift_length(self):
     tracks = [{
         'length': 0.001357555252636717,
         'height': 0.27323144259972437
     }, {
         'length': 0.00044454299901235724,
         'height': 0.29143638564699315
     }, {
         'length': 0.0015111441942070921,
         'height': 0.28761205180112825
     }, {
         'length': 0.0044636256720058352,
         'height': 0.29966298108692219
     }]
     path = {'length': 0.0022231318821379987, 'height': 0.28167659027887154}
     length_till_shift, shift_length = combining_routes.find_shift_length(
         tracks, path)
     self.assertTrue(length_till_shift >= 0)
Beispiel #2
0
 def test4_find_shift_length(self):
     tracks = [{
         "length": 1.0,
         "height": 1.4
     }, {
         "length": 0.8,
         "height": 2
     }, {
         "length": 0.8,
         "height": 3
     }, {
         "length": 0.6,
         "height": 2.4
     }]
     path = {"length": 0.9, "height": 1.7}
     length_till_shift, shift_length = combining_routes.find_shift_length(
         tracks, path)
     self.assertAlmostEqual(length_till_shift, 0.55)
     self.assertAlmostEqual(shift_length, 0.9)
Beispiel #3
0
 def test1_find_shift_length(self):
     tracks = [{
         "length": 0.5,
         "height": 1.4
     }, {
         "length": 0.8,
         "height": 2
     }, {
         "length": 0.8,
         "height": 3
     }, {
         "length": 0.6,
         "height": 2.4
     }]
     path = {"length": 2, "height": 3.5}
     length_till_shift, shift_length = combining_routes.find_shift_length(
         tracks, path)
     self.assertEqual(length_till_shift, -1)
     self.assertEqual(shift_length, 0)
Beispiel #4
0
 def test7_find_shift_length(self):
     tracks = [{
         "length": 0.7,
         "height": 1
     }, {
         "length": 0.6,
         "height": 1.5
     }, {
         "length": 0.5,
         "height": 2.5
     }, {
         "length": 1,
         "height": 1.7
     }]
     path = {"length": 1.4, "height": 1.8}
     length_till_shift, shift_length = combining_routes.find_shift_length(
         tracks, path)
     print(length_till_shift, shift_length)
     self.assertAlmostEqual(length_till_shift, 0.4875)
     self.assertAlmostEqual(shift_length, 1.8 - 0.4875)
Beispiel #5
0
 def test6_find_shift_length(self):
     tracks = [{
         "length": 0.3,
         "height": 0.5
     }, {
         "length": 0.5,
         "height": 0.4
     }, {
         "length": 1.5,
         "height": 2.5
     }, {
         "length": 0.6,
         "height": 2.4
     }]
     path = {"length": 1.0, "height": 1.8}
     length_till_shift, shift_length = combining_routes.find_shift_length(
         tracks, path)
     print(length_till_shift, shift_length)
     self.assertAlmostEqual(length_till_shift, 0.466666666)
     self.assertAlmostEqual(shift_length, 1.0)
Beispiel #6
0
 def test5_find_shift_length(self):
     tracks = [{
         "length": 1.0,
         "height": 1
     }, {
         "length": 0.7,
         "height": 2.5
     }, {
         "length": 0.8,
         "height": 1.8
     }, {
         "length": 0.6,
         "height": 2.4
     }]
     path = {"length": 0.9, "height": 2.0}
     length_till_shift, shift_length = combining_routes.find_shift_length(
         tracks, path)
     print(length_till_shift, shift_length)
     self.assertAlmostEqual(length_till_shift, 0.7)
     self.assertAlmostEqual(shift_length, 0.9)
Beispiel #7
0
 def test10_find_shift_length(self):
     tracks = [{
         'length': 0.0019061394364962218,
         'height': -0.2230461360862837
     }, {
         'length': 0.001280597461137607,
         'height': -0.17942790734837177
     }, {
         'length': 0.003547419439255187,
         'height': -0.16684866975505908
     }, {
         'length': 0.0026727699269563964,
         'height': -0.1514126857047556
     }, {
         'length': 0.0005930737361545882,
         'height': -0.16761378492166606
     }]
     path = {'length': 0.004501471916353294, 'height': -0.19081592394007982}
     length_before_shift, shift_length = combining_routes.find_shift_length(
         tracks, path)
     #print(length_before_shift)
     self.assertEqual(shift_length, path["length"])
Beispiel #8
0
 def test8_find_shift_length(self):
     tracks = [{
         "length": 1.0,
         "height": 2
     }, {
         "length": 0.8,
         "height": 1.6
     }, {
         "length": 0.9,
         "height": 3.0
     }, {
         "length": 0.4,
         "height": 2.2
     }, {
         "length": 0.6,
         "height": 3.2
     }]
     path = {"length": 3, "height": 2.4}
     length_till_shift, shift_length = combining_routes.find_shift_length(
         tracks, path)
     print(length_till_shift, shift_length)
     self.assertAlmostEqual(length_till_shift, 0.55)
     self.assertAlmostEqual(shift_length, 3)