Spaces:
Sleeping
Sleeping
Create tests/test_solver.py
Browse files- tests/test_solver.py +22 -0
tests/test_solver.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# tests/test_solver.py
|
| 2 |
+
import unittest
|
| 3 |
+
import numpy as np
|
| 4 |
+
from ortools.constraint_solver import pywrapcp
|
| 5 |
+
|
| 6 |
+
class TestGhostFleetSolver(unittest.TestCase):
|
| 7 |
+
|
| 8 |
+
def test_solver_initialization(self):
|
| 9 |
+
"""Test if OR-Tools manager initializes correctly."""
|
| 10 |
+
num_locs = 10
|
| 11 |
+
num_vehicles = 2
|
| 12 |
+
manager = pywrapcp.RoutingIndexManager(num_locs, num_vehicles, 0)
|
| 13 |
+
self.assertIsNotNone(manager, "Routing Manager should not be None")
|
| 14 |
+
|
| 15 |
+
def test_coordinate_generation(self):
|
| 16 |
+
"""Test if we generate the correct shape of data."""
|
| 17 |
+
# Simple mock of the generation logic
|
| 18 |
+
locations = np.random.rand(5, 2)
|
| 19 |
+
self.assertEqual(locations.shape, (5, 2), "Should define (Lat, Lon) for 5 points")
|
| 20 |
+
|
| 21 |
+
if __name__ == '__main__':
|
| 22 |
+
unittest.main()
|