Add ElevatorController
[cs356-p1-elevator.git] / test.cpp
index 54121a7..6f85ea1 100644 (file)
--- a/test.cpp
+++ b/test.cpp
@@ -6,10 +6,33 @@ using namespace std;
 #include "stop.hpp"
 #include "position.hpp"
 #include "elevator.hpp"
+#include "elevatorcontroller.hpp"
 
 
 int main (int argc, char *argv[])
 {
+       const int floors = 10;
+       const int elevators = 2;
+
+       ElevatorController ec(floors, elevators);
+
+       //ec.elevator_request (0, 2);
+       ec.call_elevator_to (3, DOWN);
+
+       for (int i=0; i<35; i++)
+               ec.move_elevators ();
+
+       // Note: without the GUI, this is dependent on choosing the same elevator
+       // that was randomly chosen by the call_elevator_to() funtion.
+       //
+       // This may need to be run a few times to work :)
+       ec.elevator_request (0, 2);
+
+       for (int i=0; i<35; i++)
+               ec.move_elevators ();
+
+
+#if TEST_ELEVATOR
        Elevator e(2);
 
        Stop s2(3, DOWN);
@@ -29,6 +52,7 @@ int main (int argc, char *argv[])
                usleep (500000);
                e.move ();
        }
+#endif
 
        return 0;
 }