From 562ee141c7be2eb6b4c1402e154bfaf80f51ed17 Mon Sep 17 00:00:00 2001 From: Nic McPhee Date: Wed, 15 Jan 2014 21:17:42 -0600 Subject: [PATCH] Added acceptance tests (and a script that generates random tests) that I wrote for the Fall, 2009, version of the Refactoring course. These probably aren't complete in any grand sense of the word, but they hopefully give us some reasonable safety net to support refactoring. --- .../MachineNumberTooLarge.input | 4 + .../NegativeChangeOver.input | 4 + .../NegativeNumberOfTasks.input | 4 + .../NoJobs.input | 4 + .../NoMachines.input | 4 + .../ZeroMachineNumber.input | 4 + .../ZeroTaskTime.input | 4 + .../ZeroTasks.input | 4 + .../Machine_shop_test_files/AllOnes.input | 4 + .../Machine_shop_test_files/AllOnes.output | 9 + .../MachineShopSimulator.input | 14 ++ .../MachineShopSimulator.output | 30 ++++ .../OneMachineFiveTasks.input | 4 + .../OneMachineFiveTasks.output | 9 + .../Machine_shop_test_files/RandTest0.input | 46 +++++ .../Machine_shop_test_files/RandTest0.output | 105 ++++++++++++ .../Machine_shop_test_files/RandTest1.input | 42 +++++ .../Machine_shop_test_files/RandTest1.output | 105 ++++++++++++ .../Machine_shop_test_files/RandTest2.input | 14 ++ .../Machine_shop_test_files/RandTest2.output | 105 ++++++++++++ .../Machine_shop_test_files/RandTest3.input | 42 +++++ .../Machine_shop_test_files/RandTest3.output | 144 ++++++++++++++++ .../Machine_shop_test_files/RandTest4.input | 48 ++++++ .../Machine_shop_test_files/RandTest4.output | 75 ++++++++ .../Machine_shop_test_files/RandTest5.input | 44 +++++ .../Machine_shop_test_files/RandTest5.output | 162 ++++++++++++++++++ .../Machine_shop_test_files/RandTest6.input | 64 +++++++ .../Machine_shop_test_files/RandTest6.output | 120 +++++++++++++ .../Machine_shop_test_files/RandTest7.input | 54 ++++++ .../Machine_shop_test_files/RandTest7.output | 141 +++++++++++++++ .../Machine_shop_test_files/RandTest8.input | 60 +++++++ .../Machine_shop_test_files/RandTest8.output | 153 +++++++++++++++++ .../Machine_shop_test_files/RandTest9.input | 4 + .../Machine_shop_test_files/RandTest9.output | 27 +++ acceptanceTests/applications/FileIoTests.java | 159 +++++++++++++++++ .../LinkedQueueAcceptanceTest.java | 45 +++++ scripts/GenTestCases.rb | 20 +++ unitTests/dataStructures/ChainNodeTest.java | 33 ++++ unitTests/dataStructures/LinkedQueueTest.java | 42 +++++ .../exceptions/MyInputExceptionTest.java | 22 +++ 40 files changed, 1978 insertions(+) create mode 100644 acceptanceTests/Machine_shop_exception_test_files/MachineNumberTooLarge.input create mode 100644 acceptanceTests/Machine_shop_exception_test_files/NegativeChangeOver.input create mode 100644 acceptanceTests/Machine_shop_exception_test_files/NegativeNumberOfTasks.input create mode 100644 acceptanceTests/Machine_shop_exception_test_files/NoJobs.input create mode 100644 acceptanceTests/Machine_shop_exception_test_files/NoMachines.input create mode 100644 acceptanceTests/Machine_shop_exception_test_files/ZeroMachineNumber.input create mode 100644 acceptanceTests/Machine_shop_exception_test_files/ZeroTaskTime.input create mode 100644 acceptanceTests/Machine_shop_exception_test_files/ZeroTasks.input create mode 100644 acceptanceTests/Machine_shop_test_files/AllOnes.input create mode 100644 acceptanceTests/Machine_shop_test_files/AllOnes.output create mode 100644 acceptanceTests/Machine_shop_test_files/MachineShopSimulator.input create mode 100644 acceptanceTests/Machine_shop_test_files/MachineShopSimulator.output create mode 100644 acceptanceTests/Machine_shop_test_files/OneMachineFiveTasks.input create mode 100644 acceptanceTests/Machine_shop_test_files/OneMachineFiveTasks.output create mode 100644 acceptanceTests/Machine_shop_test_files/RandTest0.input create mode 100644 acceptanceTests/Machine_shop_test_files/RandTest0.output create mode 100644 acceptanceTests/Machine_shop_test_files/RandTest1.input create mode 100644 acceptanceTests/Machine_shop_test_files/RandTest1.output create mode 100644 acceptanceTests/Machine_shop_test_files/RandTest2.input create mode 100644 acceptanceTests/Machine_shop_test_files/RandTest2.output create mode 100644 acceptanceTests/Machine_shop_test_files/RandTest3.input create mode 100644 acceptanceTests/Machine_shop_test_files/RandTest3.output create mode 100644 acceptanceTests/Machine_shop_test_files/RandTest4.input create mode 100644 acceptanceTests/Machine_shop_test_files/RandTest4.output create mode 100644 acceptanceTests/Machine_shop_test_files/RandTest5.input create mode 100644 acceptanceTests/Machine_shop_test_files/RandTest5.output create mode 100644 acceptanceTests/Machine_shop_test_files/RandTest6.input create mode 100644 acceptanceTests/Machine_shop_test_files/RandTest6.output create mode 100644 acceptanceTests/Machine_shop_test_files/RandTest7.input create mode 100644 acceptanceTests/Machine_shop_test_files/RandTest7.output create mode 100644 acceptanceTests/Machine_shop_test_files/RandTest8.input create mode 100644 acceptanceTests/Machine_shop_test_files/RandTest8.output create mode 100644 acceptanceTests/Machine_shop_test_files/RandTest9.input create mode 100644 acceptanceTests/Machine_shop_test_files/RandTest9.output create mode 100644 acceptanceTests/applications/FileIoTests.java create mode 100644 acceptanceTests/dataStructures/LinkedQueueAcceptanceTest.java create mode 100644 scripts/GenTestCases.rb create mode 100644 unitTests/dataStructures/ChainNodeTest.java create mode 100644 unitTests/dataStructures/LinkedQueueTest.java create mode 100644 unitTests/exceptions/MyInputExceptionTest.java diff --git a/acceptanceTests/Machine_shop_exception_test_files/MachineNumberTooLarge.input b/acceptanceTests/Machine_shop_exception_test_files/MachineNumberTooLarge.input new file mode 100644 index 0000000..3dbe998 --- /dev/null +++ b/acceptanceTests/Machine_shop_exception_test_files/MachineNumberTooLarge.input @@ -0,0 +1,4 @@ +1 1 +1 +1 +10 1 diff --git a/acceptanceTests/Machine_shop_exception_test_files/NegativeChangeOver.input b/acceptanceTests/Machine_shop_exception_test_files/NegativeChangeOver.input new file mode 100644 index 0000000..591a7f2 --- /dev/null +++ b/acceptanceTests/Machine_shop_exception_test_files/NegativeChangeOver.input @@ -0,0 +1,4 @@ +1 1 +-1 +1 +1 1 diff --git a/acceptanceTests/Machine_shop_exception_test_files/NegativeNumberOfTasks.input b/acceptanceTests/Machine_shop_exception_test_files/NegativeNumberOfTasks.input new file mode 100644 index 0000000..2d2271f --- /dev/null +++ b/acceptanceTests/Machine_shop_exception_test_files/NegativeNumberOfTasks.input @@ -0,0 +1,4 @@ +1 1 +1 +-1 +1 1 diff --git a/acceptanceTests/Machine_shop_exception_test_files/NoJobs.input b/acceptanceTests/Machine_shop_exception_test_files/NoJobs.input new file mode 100644 index 0000000..5ad69ee --- /dev/null +++ b/acceptanceTests/Machine_shop_exception_test_files/NoJobs.input @@ -0,0 +1,4 @@ +1 0 +1 +1 +1 1 diff --git a/acceptanceTests/Machine_shop_exception_test_files/NoMachines.input b/acceptanceTests/Machine_shop_exception_test_files/NoMachines.input new file mode 100644 index 0000000..70243d0 --- /dev/null +++ b/acceptanceTests/Machine_shop_exception_test_files/NoMachines.input @@ -0,0 +1,4 @@ +0 1 +1 +1 +1 1 diff --git a/acceptanceTests/Machine_shop_exception_test_files/ZeroMachineNumber.input b/acceptanceTests/Machine_shop_exception_test_files/ZeroMachineNumber.input new file mode 100644 index 0000000..6196ac0 --- /dev/null +++ b/acceptanceTests/Machine_shop_exception_test_files/ZeroMachineNumber.input @@ -0,0 +1,4 @@ +1 1 +1 +1 +0 1 diff --git a/acceptanceTests/Machine_shop_exception_test_files/ZeroTaskTime.input b/acceptanceTests/Machine_shop_exception_test_files/ZeroTaskTime.input new file mode 100644 index 0000000..518a8d4 --- /dev/null +++ b/acceptanceTests/Machine_shop_exception_test_files/ZeroTaskTime.input @@ -0,0 +1,4 @@ +1 1 +1 +1 +1 0 diff --git a/acceptanceTests/Machine_shop_exception_test_files/ZeroTasks.input b/acceptanceTests/Machine_shop_exception_test_files/ZeroTasks.input new file mode 100644 index 0000000..fa74338 --- /dev/null +++ b/acceptanceTests/Machine_shop_exception_test_files/ZeroTasks.input @@ -0,0 +1,4 @@ +1 1 +1 +0 +1 1 diff --git a/acceptanceTests/Machine_shop_test_files/AllOnes.input b/acceptanceTests/Machine_shop_test_files/AllOnes.input new file mode 100644 index 0000000..78a7d56 --- /dev/null +++ b/acceptanceTests/Machine_shop_test_files/AllOnes.input @@ -0,0 +1,4 @@ +1 1 +1 +1 +1 1 diff --git a/acceptanceTests/Machine_shop_test_files/AllOnes.output b/acceptanceTests/Machine_shop_test_files/AllOnes.output new file mode 100644 index 0000000..3402f13 --- /dev/null +++ b/acceptanceTests/Machine_shop_test_files/AllOnes.output @@ -0,0 +1,9 @@ +Enter number of machines and jobs +Enter change-over times for machines +Enter number of tasks for job 1 +Enter the tasks (machine, time) in process order +Job 1 has completed at 1 Total wait was 0 +Finish time = 1 +Machine 1 completed 1 tasks +The total wait time was 0 + diff --git a/acceptanceTests/Machine_shop_test_files/MachineShopSimulator.input b/acceptanceTests/Machine_shop_test_files/MachineShopSimulator.input new file mode 100644 index 0000000..23a9431 --- /dev/null +++ b/acceptanceTests/Machine_shop_test_files/MachineShopSimulator.input @@ -0,0 +1,14 @@ +3 6 +2 0 1 +3 +1 2 2 4 3 3 +2 +2 2 1 4 +4 +3 6 2 1 3 2 1 3 +2 +1 3 2 4 +1 +1 2 +5 +2 2 1 2 3 3 1 1 2 3 diff --git a/acceptanceTests/Machine_shop_test_files/MachineShopSimulator.output b/acceptanceTests/Machine_shop_test_files/MachineShopSimulator.output new file mode 100644 index 0000000..98df3a5 --- /dev/null +++ b/acceptanceTests/Machine_shop_test_files/MachineShopSimulator.output @@ -0,0 +1,30 @@ +Enter number of machines and jobs +Enter change-over times for machines +Enter number of tasks for job 1 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 2 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 3 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 4 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 5 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 6 +Enter the tasks (machine, time) in process order +Job 5 has completed at 11 Total wait was 9 +Job 1 has completed at 11 Total wait was 2 +Job 4 has completed at 13 Total wait was 6 +Job 2 has completed at 17 Total wait was 11 +Job 3 has completed at 26 Total wait was 14 +Job 6 has completed at 32 Total wait was 21 +Finish time = 32 +Machine 1 completed 7 tasks +The total wait time was 52 + +Machine 2 completed 6 tasks +The total wait time was 8 + +Machine 3 completed 4 tasks +The total wait time was 3 + diff --git a/acceptanceTests/Machine_shop_test_files/OneMachineFiveTasks.input b/acceptanceTests/Machine_shop_test_files/OneMachineFiveTasks.input new file mode 100644 index 0000000..999b0d3 --- /dev/null +++ b/acceptanceTests/Machine_shop_test_files/OneMachineFiveTasks.input @@ -0,0 +1,4 @@ +1 1 +1 +5 +1 2 1 4 1 6 1 8 1 10 diff --git a/acceptanceTests/Machine_shop_test_files/OneMachineFiveTasks.output b/acceptanceTests/Machine_shop_test_files/OneMachineFiveTasks.output new file mode 100644 index 0000000..5b2dd6c --- /dev/null +++ b/acceptanceTests/Machine_shop_test_files/OneMachineFiveTasks.output @@ -0,0 +1,9 @@ +Enter number of machines and jobs +Enter change-over times for machines +Enter number of tasks for job 1 +Enter the tasks (machine, time) in process order +Job 1 has completed at 34 Total wait was 4 +Finish time = 34 +Machine 1 completed 5 tasks +The total wait time was 4 + diff --git a/acceptanceTests/Machine_shop_test_files/RandTest0.input b/acceptanceTests/Machine_shop_test_files/RandTest0.input new file mode 100644 index 0000000..886e1fd --- /dev/null +++ b/acceptanceTests/Machine_shop_test_files/RandTest0.input @@ -0,0 +1,46 @@ +12 22 +27 8 1 28 30 17 3 19 24 20 1 23 +15 +12 32 12 11 5 8 6 7 4 21 5 23 6 21 6 17 2 20 10 26 5 24 9 22 5 14 3 16 10 32 +31 +2 13 7 27 9 2 5 17 3 8 5 5 1 16 2 12 6 1 7 25 4 31 6 22 10 7 11 31 7 9 9 11 7 25 4 3 3 11 7 9 3 4 10 21 10 13 11 23 3 8 12 22 1 7 12 16 9 8 8 22 5 22 +30 +12 1 11 16 11 24 9 2 1 9 3 7 7 6 11 27 11 1 2 24 9 21 10 31 7 21 3 26 11 10 12 29 8 7 8 3 4 14 4 29 5 32 1 15 3 15 6 9 2 25 3 25 10 28 5 2 9 16 7 8 +11 +9 15 9 12 7 4 10 24 3 12 2 25 11 25 6 4 3 7 2 8 12 22 +1 +2 12 +8 +1 12 8 21 7 24 8 24 11 29 5 14 11 2 10 21 +4 +7 30 6 4 11 18 6 24 +26 +6 11 2 4 12 29 2 24 1 29 6 12 9 7 1 24 3 13 2 31 7 29 7 31 11 1 12 14 12 2 10 4 3 29 5 31 4 10 2 30 9 3 9 31 3 22 2 12 4 29 5 26 +7 +5 21 2 15 3 25 6 23 5 31 3 16 7 6 +16 +4 9 4 17 11 14 7 21 2 17 3 2 11 2 4 4 4 32 4 22 8 1 12 25 2 19 1 10 1 13 1 11 +26 +6 5 4 14 6 16 10 16 1 29 1 18 12 4 1 13 6 13 1 17 2 15 8 32 9 14 4 29 4 2 5 5 6 7 3 30 10 13 2 17 5 27 2 17 12 20 5 29 12 19 1 11 +17 +2 6 10 18 9 24 11 9 12 32 1 26 12 18 2 17 11 14 8 8 10 19 2 19 7 22 9 10 12 14 3 14 6 31 +8 +1 30 12 20 12 26 12 6 2 27 2 10 2 21 6 9 +25 +7 18 5 17 4 9 4 18 9 4 8 26 9 1 9 28 11 17 4 24 1 4 8 1 3 27 6 19 5 16 4 24 5 19 4 25 4 27 5 22 3 14 10 32 10 3 9 7 8 19 +27 +10 21 4 2 8 8 3 20 8 27 7 10 1 26 7 14 6 19 1 31 3 22 9 8 4 24 10 11 3 16 1 31 12 19 7 2 5 17 5 16 6 8 12 21 4 29 5 12 11 16 8 29 6 27 +29 +7 11 9 9 11 14 9 11 1 5 7 15 3 22 9 22 7 7 12 26 6 4 12 31 10 23 12 10 6 1 4 12 7 17 6 30 10 8 11 15 11 30 8 19 3 25 5 24 10 31 1 5 12 28 4 15 11 13 +32 +10 32 1 32 1 7 7 8 2 29 3 15 12 15 3 4 7 24 12 19 8 27 5 9 12 20 11 26 1 3 6 7 12 27 8 18 8 16 1 6 1 12 11 6 4 25 7 28 7 18 11 21 12 12 9 23 9 23 5 27 6 32 12 19 +22 +7 15 1 7 8 4 12 9 3 5 12 3 9 10 5 18 10 7 9 19 5 21 3 26 10 14 8 5 3 32 9 20 6 7 10 3 9 26 9 2 11 9 6 21 +11 +9 3 6 20 7 10 1 1 4 24 12 2 11 1 7 13 8 29 3 11 10 11 +32 +11 24 3 1 1 1 12 6 12 4 7 19 8 1 12 27 4 27 2 18 8 2 7 17 1 25 9 1 8 19 9 28 8 5 12 17 11 28 7 27 9 16 10 21 4 7 2 21 7 2 8 8 5 3 6 6 2 24 5 29 10 12 8 19 +1 +6 1 +21 +2 3 1 30 3 19 9 4 4 25 8 30 9 9 10 12 10 29 2 7 5 25 1 6 12 3 2 31 6 31 8 11 10 29 12 7 7 9 11 30 1 16 diff --git a/acceptanceTests/Machine_shop_test_files/RandTest0.output b/acceptanceTests/Machine_shop_test_files/RandTest0.output new file mode 100644 index 0000000..b904472 --- /dev/null +++ b/acceptanceTests/Machine_shop_test_files/RandTest0.output @@ -0,0 +1,105 @@ +Enter number of machines and jobs +Enter change-over times for machines +Enter number of tasks for job 1 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 2 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 3 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 4 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 5 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 6 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 7 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 8 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 9 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 10 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 11 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 12 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 13 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 14 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 15 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 16 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 17 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 18 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 19 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 20 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 21 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 22 +Enter the tasks (machine, time) in process order +Job 5 has completed at 33 Total wait was 21 +Job 21 has completed at 51 Total wait was 50 +Job 7 has completed at 150 Total wait was 74 +Job 6 has completed at 295 Total wait was 148 +Job 9 has completed at 373 Total wait was 236 +Job 4 has completed at 451 Total wait was 293 +Job 19 has completed at 589 Total wait was 464 +Job 13 has completed at 601 Total wait was 452 +Job 1 has completed at 850 Total wait was 556 +Job 12 has completed at 1030 Total wait was 729 +Job 18 has completed at 1146 Total wait was 863 +Job 10 has completed at 1151 Total wait was 932 +Job 14 has completed at 1306 Total wait was 885 +Job 22 has completed at 1388 Total wait was 1022 +Job 3 has completed at 1489 Total wait was 1006 +Job 2 has completed at 1593 Total wait was 1142 +Job 16 has completed at 1649 Total wait was 1166 +Job 8 has completed at 1739 Total wait was 1251 +Job 17 has completed at 1847 Total wait was 1257 +Job 15 has completed at 1910 Total wait was 1424 +Job 20 has completed at 1928 Total wait was 1463 +Job 11 has completed at 1986 Total wait was 1554 +Finish time = 1986 +Machine 1 completed 35 tasks +The total wait time was 5169 + +Machine 2 completed 32 tasks +The total wait time was 634 + +Machine 3 completed 34 tasks +The total wait time was 366 + +Machine 4 completed 31 tasks +The total wait time was 1370 + +Machine 5 completed 32 tasks +The total wait time was 2437 + +Machine 6 completed 33 tasks +The total wait time was 546 + +Machine 7 completed 36 tasks +The total wait time was 705 + +Machine 8 completed 29 tasks +The total wait time was 200 + +Machine 9 completed 36 tasks +The total wait time was 1270 + +Machine 10 completed 31 tasks +The total wait time was 680 + +Machine 11 completed 30 tasks +The total wait time was 204 + +Machine 12 completed 41 tasks +The total wait time was 3407 + diff --git a/acceptanceTests/Machine_shop_test_files/RandTest1.input b/acceptanceTests/Machine_shop_test_files/RandTest1.input new file mode 100644 index 0000000..abf7269 --- /dev/null +++ b/acceptanceTests/Machine_shop_test_files/RandTest1.input @@ -0,0 +1,42 @@ +14 20 +10 8 26 29 2 15 4 18 6 30 26 9 24 9 +15 +10 7 10 11 11 5 2 8 1 21 7 25 10 29 12 11 11 15 7 4 14 23 2 19 14 16 1 1 2 27 +27 +8 10 8 30 11 23 4 18 8 11 14 4 2 28 11 26 6 18 3 25 6 13 2 1 11 3 5 2 2 32 11 4 2 25 12 5 12 19 1 17 3 16 8 25 4 25 4 9 5 8 14 6 1 7 +32 +3 4 12 32 5 8 1 26 3 8 2 4 10 13 6 30 4 15 1 9 7 9 8 2 14 10 5 8 14 18 6 6 9 6 2 22 4 21 2 8 6 32 8 9 1 32 10 8 13 3 13 10 4 24 8 28 11 5 12 32 6 27 12 18 +17 +5 8 3 22 1 24 3 3 12 4 6 30 14 13 13 26 5 27 1 13 10 3 2 21 3 21 3 31 10 20 4 21 7 22 +13 +9 2 14 10 4 17 3 1 10 32 14 5 13 8 13 6 6 2 1 3 11 13 14 12 12 22 +18 +8 5 3 7 3 4 1 9 7 12 14 3 6 27 11 30 1 4 12 24 7 21 14 24 7 15 11 17 11 4 13 17 1 20 7 22 +29 +10 5 7 10 3 28 3 14 14 22 13 11 2 17 12 2 6 28 1 3 2 22 12 29 10 26 3 5 5 22 11 14 2 22 2 6 8 25 2 16 10 17 14 32 2 32 1 9 13 5 4 1 3 5 11 26 7 9 +22 +14 23 5 1 11 32 11 2 5 11 6 17 11 13 3 26 7 12 4 24 4 28 10 8 5 5 5 9 3 30 10 27 9 8 5 4 5 25 4 3 6 28 8 29 +19 +6 22 4 14 5 30 7 16 13 13 3 26 5 13 7 22 9 24 9 29 11 14 5 23 12 16 10 30 7 22 6 19 4 22 11 8 5 23 +22 +7 11 5 1 11 20 12 19 12 1 14 12 7 13 6 8 6 23 3 22 2 18 8 17 9 20 4 17 8 12 5 5 5 11 8 6 6 32 6 21 1 2 1 9 +26 +6 2 10 17 7 23 6 6 1 29 14 30 14 3 4 28 7 29 14 32 2 29 13 26 1 30 4 20 6 21 4 30 12 10 5 25 6 7 8 24 6 1 13 30 6 24 12 18 13 27 9 21 +1 +7 7 +7 +6 4 12 29 3 16 1 2 11 13 14 14 11 18 +7 +3 23 4 15 1 20 8 32 9 20 13 9 11 7 +14 +7 17 12 9 12 15 8 18 1 22 11 23 14 5 4 11 12 30 11 23 5 4 1 11 7 2 9 28 +2 +1 27 8 16 +6 +6 9 2 14 13 24 12 18 2 19 12 14 +20 +9 27 2 20 7 5 11 13 3 12 14 6 8 3 14 28 14 12 11 28 4 26 13 17 6 21 3 9 12 6 11 7 4 16 3 18 6 1 13 28 +31 +14 8 13 8 8 30 4 28 12 26 9 31 4 21 3 25 2 18 7 17 1 4 8 19 10 21 2 6 7 7 14 21 11 13 8 32 10 31 8 23 11 3 7 18 11 31 11 2 3 6 8 21 11 20 4 5 8 13 9 21 12 9 +25 +12 23 10 13 13 21 3 2 6 23 11 27 1 12 5 13 10 5 5 3 10 17 3 4 12 6 5 7 13 26 12 17 9 10 4 16 2 17 6 16 2 30 4 12 3 1 2 30 11 1 diff --git a/acceptanceTests/Machine_shop_test_files/RandTest1.output b/acceptanceTests/Machine_shop_test_files/RandTest1.output new file mode 100644 index 0000000..68ea4ad --- /dev/null +++ b/acceptanceTests/Machine_shop_test_files/RandTest1.output @@ -0,0 +1,105 @@ +Enter number of machines and jobs +Enter change-over times for machines +Enter number of tasks for job 1 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 2 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 3 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 4 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 5 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 6 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 7 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 8 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 9 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 10 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 11 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 12 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 13 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 14 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 15 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 16 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 17 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 18 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 19 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 20 +Enter the tasks (machine, time) in process order +Job 12 has completed at 22 Total wait was 15 +Job 16 has completed at 115 Total wait was 72 +Job 17 has completed at 267 Total wait was 169 +Job 14 has completed at 270 Total wait was 144 +Job 15 has completed at 585 Total wait was 367 +Job 1 has completed at 634 Total wait was 412 +Job 5 has completed at 787 Total wait was 654 +Job 10 has completed at 824 Total wait was 524 +Job 9 has completed at 838 Total wait was 452 +Job 13 has completed at 859 Total wait was 763 +Job 6 has completed at 1059 Total wait was 794 +Job 4 has completed at 1085 Total wait was 776 +Job 18 has completed at 1178 Total wait was 875 +Job 8 has completed at 1266 Total wait was 901 +Job 11 has completed at 1277 Total wait was 735 +Job 2 has completed at 1303 Total wait was 893 +Job 20 has completed at 1355 Total wait was 1003 +Job 7 has completed at 1470 Total wait was 1007 +Job 3 has completed at 1486 Total wait was 999 +Job 19 has completed at 1504 Total wait was 966 +Finish time = 1504 +Machine 1 completed 26 tasks +The total wait time was 193 + +Machine 2 completed 27 tasks +The total wait time was 470 + +Machine 3 completed 29 tasks +The total wait time was 3634 + +Machine 4 completed 27 tasks +The total wait time was 1233 + +Machine 5 completed 25 tasks +The total wait time was 41 + +Machine 6 completed 30 tasks +The total wait time was 731 + +Machine 7 completed 25 tasks +The total wait time was 134 + +Machine 8 completed 24 tasks +The total wait time was 483 + +Machine 9 completed 13 tasks +The total wait time was 14 + +Machine 10 completed 20 tasks +The total wait time was 831 + +Machine 11 completed 34 tasks +The total wait time was 2914 + +Machine 12 completed 28 tasks +The total wait time was 443 + +Machine 13 completed 19 tasks +The total wait time was 392 + +Machine 14 completed 26 tasks +The total wait time was 1008 + diff --git a/acceptanceTests/Machine_shop_test_files/RandTest2.input b/acceptanceTests/Machine_shop_test_files/RandTest2.input new file mode 100644 index 0000000..920fe00 --- /dev/null +++ b/acceptanceTests/Machine_shop_test_files/RandTest2.input @@ -0,0 +1,14 @@ +28 6 +13 1 30 7 5 26 23 7 26 21 17 12 23 2 28 29 1 23 30 31 25 27 26 7 7 30 25 31 +15 +24 32 25 15 18 14 11 5 28 29 8 15 2 21 14 26 25 16 5 23 8 22 20 15 28 3 23 3 11 3 +32 +1 28 11 1 1 27 21 20 9 5 25 19 23 6 6 1 18 5 19 20 17 5 8 1 12 25 21 19 14 19 9 26 11 21 15 18 24 16 28 31 19 12 26 13 3 17 11 19 11 13 1 32 27 15 2 28 15 15 11 23 1 21 16 5 +22 +4 6 8 2 21 25 5 6 3 32 10 8 8 28 12 6 22 13 20 22 26 7 23 2 24 10 24 26 13 25 3 13 6 14 25 15 6 14 13 14 24 31 15 16 +27 +14 14 9 6 12 12 17 25 15 4 9 16 9 2 27 6 11 11 2 10 17 3 27 13 28 18 4 18 1 19 25 26 12 14 9 6 16 23 7 11 9 27 13 13 9 19 3 13 13 18 27 17 20 25 +2 +24 20 5 15 +14 +6 12 3 19 5 13 27 20 9 19 3 28 6 16 24 30 17 19 8 31 5 4 14 17 9 25 23 19 diff --git a/acceptanceTests/Machine_shop_test_files/RandTest2.output b/acceptanceTests/Machine_shop_test_files/RandTest2.output new file mode 100644 index 0000000..057fc60 --- /dev/null +++ b/acceptanceTests/Machine_shop_test_files/RandTest2.output @@ -0,0 +1,105 @@ +Enter number of machines and jobs +Enter change-over times for machines +Enter number of tasks for job 1 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 2 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 3 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 4 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 5 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 6 +Enter the tasks (machine, time) in process order +Job 5 has completed at 75 Total wait was 40 +Job 1 has completed at 259 Total wait was 17 +Job 6 has completed at 321 Total wait was 49 +Job 3 has completed at 400 Total wait was 65 +Job 4 has completed at 557 Total wait was 168 +Job 2 has completed at 732 Total wait was 206 +Finish time = 732 +Machine 1 completed 5 tasks +The total wait time was 12 + +Machine 2 completed 3 tasks +The total wait time was 0 + +Machine 3 completed 6 tasks +The total wait time was 16 + +Machine 4 completed 2 tasks +The total wait time was 0 + +Machine 5 completed 5 tasks +The total wait time was 17 + +Machine 6 completed 5 tasks +The total wait time was 11 + +Machine 7 completed 1 tasks +The total wait time was 0 + +Machine 8 completed 6 tasks +The total wait time was 30 + +Machine 9 completed 10 tasks +The total wait time was 301 + +Machine 10 completed 1 tasks +The total wait time was 0 + +Machine 11 completed 8 tasks +The total wait time was 17 + +Machine 12 completed 4 tasks +The total wait time was 26 + +Machine 13 completed 4 tasks +The total wait time was 0 + +Machine 14 completed 4 tasks +The total wait time was 0 + +Machine 15 completed 4 tasks +The total wait time was 21 + +Machine 16 completed 2 tasks +The total wait time was 0 + +Machine 17 completed 4 tasks +The total wait time was 0 + +Machine 18 completed 2 tasks +The total wait time was 0 + +Machine 19 completed 2 tasks +The total wait time was 0 + +Machine 20 completed 3 tasks +The total wait time was 0 + +Machine 21 completed 3 tasks +The total wait time was 0 + +Machine 22 completed 1 tasks +The total wait time was 0 + +Machine 23 completed 4 tasks +The total wait time was 28 + +Machine 24 completed 7 tasks +The total wait time was 55 + +Machine 25 completed 5 tasks +The total wait time was 0 + +Machine 26 completed 2 tasks +The total wait time was 0 + +Machine 27 completed 5 tasks +The total wait time was 1 + +Machine 28 completed 4 tasks +The total wait time was 10 + diff --git a/acceptanceTests/Machine_shop_test_files/RandTest3.input b/acceptanceTests/Machine_shop_test_files/RandTest3.input new file mode 100644 index 0000000..b6908c7 --- /dev/null +++ b/acceptanceTests/Machine_shop_test_files/RandTest3.input @@ -0,0 +1,42 @@ +27 20 +3 12 26 12 26 17 6 13 12 21 23 29 6 16 25 11 29 25 14 30 26 1 25 23 5 14 9 +4 +6 15 1 10 17 23 27 26 +7 +5 20 7 31 17 15 18 17 11 4 11 28 19 5 +29 +25 5 11 1 5 26 9 25 2 21 16 18 9 11 16 22 8 15 17 11 21 25 10 32 8 21 12 23 10 27 6 2 5 24 23 13 23 3 25 8 16 27 5 12 15 30 8 6 10 29 8 21 3 16 4 17 25 13 +15 +8 4 10 19 20 29 8 1 27 2 3 30 18 18 15 20 13 21 11 11 8 14 26 29 20 2 3 31 26 16 +25 +25 8 10 22 11 32 18 16 26 28 15 17 9 5 6 9 22 25 22 6 27 14 24 28 24 24 12 16 9 10 3 14 26 22 23 4 27 22 8 9 14 17 17 17 23 4 2 10 22 1 +8 +9 32 19 6 6 24 25 31 5 13 11 27 27 5 25 8 +14 +20 19 7 16 22 20 8 14 23 2 9 19 25 25 24 9 13 27 1 18 20 2 26 24 26 17 19 7 +25 +23 32 21 31 14 23 24 2 3 32 8 8 2 22 1 25 12 18 15 28 26 14 1 4 24 21 5 15 8 27 12 28 6 2 12 17 27 17 15 22 5 13 27 17 3 6 1 2 20 17 +26 +13 2 19 26 12 18 9 28 19 23 16 10 5 31 9 30 8 11 10 3 8 2 22 23 24 32 6 12 16 29 24 18 15 21 15 24 4 19 9 13 20 14 13 5 19 3 14 32 4 11 8 14 +11 +23 16 27 10 10 24 20 25 18 27 11 31 15 22 22 18 12 11 4 21 1 19 +7 +2 22 8 15 4 14 14 4 9 16 6 6 3 30 +25 +6 20 13 27 3 5 17 4 21 24 5 7 8 2 18 27 21 22 21 14 25 28 9 9 17 18 25 16 17 26 26 20 1 9 14 21 17 11 26 1 19 14 18 23 3 21 3 6 12 23 +14 +27 30 11 25 16 20 18 17 13 14 18 30 3 23 21 16 20 26 20 10 7 17 9 11 20 13 3 26 +13 +2 12 15 8 26 9 2 5 22 18 18 5 3 23 11 22 5 19 13 2 10 10 20 2 12 15 +29 +26 6 25 24 27 10 4 11 17 5 26 18 14 21 15 22 13 3 11 3 25 10 25 20 24 1 18 28 17 26 6 13 20 12 7 1 15 23 9 1 17 19 13 23 11 24 1 17 11 18 21 25 20 13 26 18 8 1 +20 +3 8 7 1 22 25 1 26 17 26 3 28 7 26 7 24 15 8 21 23 22 5 14 5 7 7 24 21 20 2 23 9 3 13 24 24 25 9 6 24 +16 +27 7 13 27 16 21 20 8 8 3 15 23 16 9 20 21 20 24 22 19 22 23 19 18 26 21 20 7 26 29 14 1 +15 +4 15 23 2 23 6 11 1 21 28 14 16 17 29 4 31 22 32 18 2 24 13 6 30 7 26 11 5 14 7 +32 +17 7 8 2 2 25 1 12 10 7 13 12 3 6 12 18 12 20 17 2 26 16 16 8 20 18 24 7 18 8 6 26 25 23 24 8 5 3 20 21 27 3 4 17 13 9 20 4 9 20 20 21 13 7 23 2 18 10 16 4 7 31 27 15 +8 +6 1 21 22 15 21 18 17 12 26 7 7 25 23 1 5 diff --git a/acceptanceTests/Machine_shop_test_files/RandTest3.output b/acceptanceTests/Machine_shop_test_files/RandTest3.output new file mode 100644 index 0000000..5192735 --- /dev/null +++ b/acceptanceTests/Machine_shop_test_files/RandTest3.output @@ -0,0 +1,144 @@ +Enter number of machines and jobs +Enter change-over times for machines +Enter number of tasks for job 1 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 2 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 3 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 4 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 5 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 6 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 7 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 8 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 9 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 10 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 11 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 12 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 13 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 14 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 15 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 16 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 17 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 18 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 19 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 20 +Enter the tasks (machine, time) in process order +Job 1 has completed at 100 Total wait was 26 +Job 6 has completed at 238 Total wait was 92 +Job 11 has completed at 335 Total wait was 228 +Job 20 has completed at 343 Total wait was 221 +Job 2 has completed at 375 Total wait was 255 +Job 7 has completed at 399 Total wait was 180 +Job 17 has completed at 471 Total wait was 210 +Job 10 has completed at 623 Total wait was 399 +Job 18 has completed at 693 Total wait was 450 +Job 14 has completed at 718 Total wait was 568 +Job 16 has completed at 748 Total wait was 434 +Job 3 has completed at 783 Total wait was 279 +Job 9 has completed at 807 Total wait was 353 +Job 5 has completed at 850 Total wait was 470 +Job 4 has completed at 851 Total wait was 604 +Job 15 has completed at 960 Total wait was 544 +Job 13 has completed at 966 Total wait was 688 +Job 8 has completed at 988 Total wait was 545 +Job 12 has completed at 1021 Total wait was 623 +Job 19 has completed at 1142 Total wait was 750 +Finish time = 1142 +Machine 1 completed 11 tasks +The total wait time was 0 + +Machine 2 completed 7 tasks +The total wait time was 105 + +Machine 3 completed 17 tasks +The total wait time was 1337 + +Machine 4 completed 9 tasks +The total wait time was 12 + +Machine 5 completed 11 tasks +The total wait time was 174 + +Machine 6 completed 13 tasks +The total wait time was 204 + +Machine 7 completed 11 tasks +The total wait time was 27 + +Machine 8 completed 19 tasks +The total wait time was 66 + +Machine 9 completed 14 tasks +The total wait time was 181 + +Machine 10 completed 9 tasks +The total wait time was 49 + +Machine 11 completed 14 tasks +The total wait time was 85 + +Machine 12 completed 12 tasks +The total wait time was 493 + +Machine 13 completed 13 tasks +The total wait time was 77 + +Machine 14 completed 10 tasks +The total wait time was 88 + +Machine 15 completed 14 tasks +The total wait time was 507 + +Machine 16 completed 10 tasks +The total wait time was 43 + +Machine 17 completed 15 tasks +The total wait time was 503 + +Machine 18 completed 14 tasks +The total wait time was 1088 + +Machine 19 completed 8 tasks +The total wait time was 23 + +Machine 20 completed 22 tasks +The total wait time was 1494 + +Machine 21 completed 10 tasks +The total wait time was 127 + +Machine 22 completed 12 tasks +The total wait time was 66 + +Machine 23 completed 11 tasks +The total wait time was 268 + +Machine 24 completed 13 tasks +The total wait time was 468 + +Machine 25 completed 15 tasks +The total wait time was 52 + +Machine 26 completed 16 tasks +The total wait time was 244 + +Machine 27 completed 13 tasks +The total wait time was 138 + diff --git a/acceptanceTests/Machine_shop_test_files/RandTest4.input b/acceptanceTests/Machine_shop_test_files/RandTest4.input new file mode 100644 index 0000000..6251e07 --- /dev/null +++ b/acceptanceTests/Machine_shop_test_files/RandTest4.input @@ -0,0 +1,48 @@ +1 23 +1 +15 +1 20 1 30 1 19 1 25 1 9 1 13 1 1 1 8 1 26 1 13 1 20 1 26 1 19 1 5 1 1 +3 +1 31 1 19 1 31 +5 +1 6 1 27 1 25 1 17 1 16 +10 +1 27 1 6 1 28 1 8 1 21 1 14 1 20 1 32 1 30 1 25 +21 +1 21 1 26 1 1 1 5 1 2 1 1 1 12 1 14 1 14 1 16 1 22 1 15 1 20 1 23 1 16 1 15 1 32 1 6 1 23 1 9 1 29 +32 +1 19 1 20 1 4 1 26 1 10 1 4 1 30 1 23 1 12 1 13 1 3 1 8 1 24 1 20 1 17 1 14 1 19 1 19 1 10 1 14 1 17 1 21 1 11 1 32 1 12 1 20 1 15 1 12 1 11 1 10 1 32 1 22 +12 +1 7 1 32 1 12 1 16 1 16 1 9 1 12 1 22 1 10 1 32 1 3 1 28 +31 +1 20 1 7 1 30 1 32 1 6 1 1 1 10 1 19 1 6 1 21 1 13 1 2 1 17 1 13 1 16 1 28 1 26 1 18 1 11 1 16 1 26 1 15 1 32 1 14 1 9 1 5 1 9 1 27 1 9 1 19 1 25 +32 +1 19 1 21 1 16 1 25 1 10 1 4 1 19 1 1 1 3 1 22 1 26 1 25 1 19 1 17 1 19 1 31 1 15 1 1 1 22 1 10 1 32 1 6 1 21 1 32 1 26 1 19 1 10 1 31 1 6 1 19 1 7 1 30 +25 +1 25 1 23 1 18 1 9 1 24 1 22 1 22 1 29 1 29 1 30 1 17 1 15 1 2 1 23 1 18 1 29 1 11 1 19 1 24 1 19 1 12 1 10 1 4 1 14 1 21 +29 +1 20 1 22 1 5 1 31 1 25 1 27 1 16 1 14 1 2 1 15 1 26 1 14 1 27 1 23 1 21 1 28 1 31 1 31 1 18 1 11 1 18 1 26 1 29 1 1 1 28 1 23 1 24 1 7 1 27 +1 +1 16 +32 +1 3 1 28 1 27 1 5 1 20 1 18 1 10 1 10 1 11 1 9 1 19 1 30 1 31 1 25 1 27 1 10 1 30 1 5 1 3 1 11 1 8 1 23 1 30 1 28 1 31 1 26 1 18 1 5 1 12 1 28 1 13 1 28 +11 +1 1 1 29 1 26 1 13 1 27 1 25 1 3 1 19 1 9 1 24 1 5 +22 +1 17 1 7 1 24 1 19 1 21 1 26 1 5 1 18 1 8 1 7 1 15 1 1 1 4 1 26 1 5 1 31 1 15 1 12 1 2 1 11 1 4 1 3 +13 +1 17 1 7 1 12 1 5 1 9 1 22 1 13 1 20 1 21 1 27 1 25 1 6 1 7 +24 +1 1 1 28 1 6 1 22 1 20 1 13 1 17 1 30 1 19 1 25 1 23 1 10 1 8 1 20 1 13 1 21 1 7 1 10 1 4 1 15 1 13 1 6 1 28 1 9 +28 +1 18 1 22 1 20 1 3 1 20 1 7 1 13 1 21 1 11 1 20 1 5 1 6 1 7 1 5 1 6 1 20 1 15 1 7 1 18 1 24 1 9 1 6 1 16 1 15 1 4 1 7 1 4 1 23 +1 +1 27 +24 +1 23 1 25 1 17 1 1 1 31 1 10 1 27 1 5 1 21 1 26 1 21 1 31 1 30 1 13 1 10 1 7 1 12 1 24 1 24 1 4 1 2 1 17 1 14 1 25 +12 +1 6 1 32 1 27 1 8 1 12 1 10 1 10 1 11 1 31 1 11 1 28 1 28 +15 +1 15 1 11 1 3 1 27 1 2 1 11 1 5 1 23 1 9 1 32 1 19 1 31 1 7 1 18 1 2 +32 +1 14 1 27 1 8 1 18 1 9 1 21 1 1 1 5 1 27 1 3 1 26 1 19 1 27 1 31 1 14 1 2 1 30 1 4 1 20 1 14 1 25 1 20 1 25 1 22 1 8 1 9 1 28 1 27 1 22 1 20 1 27 1 2 diff --git a/acceptanceTests/Machine_shop_test_files/RandTest4.output b/acceptanceTests/Machine_shop_test_files/RandTest4.output new file mode 100644 index 0000000..d21eb7d --- /dev/null +++ b/acceptanceTests/Machine_shop_test_files/RandTest4.output @@ -0,0 +1,75 @@ +Enter number of machines and jobs +Enter change-over times for machines +Enter number of tasks for job 1 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 2 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 3 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 4 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 5 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 6 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 7 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 8 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 9 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 10 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 11 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 12 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 13 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 14 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 15 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 16 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 17 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 18 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 19 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 20 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 21 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 22 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 23 +Enter the tasks (machine, time) in process order +Job 12 has completed at 242 Total wait was 226 +Job 19 has completed at 333 Total wait was 306 +Job 2 has completed at 917 Total wait was 836 +Job 3 has completed at 1607 Total wait was 1516 +Job 4 has completed at 3153 Total wait was 2942 +Job 14 has completed at 3667 Total wait was 3486 +Job 7 has completed at 3918 Total wait was 3719 +Job 21 has completed at 4097 Total wait was 3883 +Job 16 has completed at 4329 Total wait was 4138 +Job 1 has completed at 4691 Total wait was 4456 +Job 22 has completed at 4873 Total wait was 4658 +Job 5 has completed at 5950 Total wait was 5628 +Job 15 has completed at 6238 Total wait was 5957 +Job 17 has completed at 6648 Total wait was 6280 +Job 20 has completed at 6690 Total wait was 6270 +Job 10 has completed at 6785 Total wait was 6316 +Job 18 has completed at 7202 Total wait was 6850 +Job 11 has completed at 7287 Total wait was 6697 +Job 8 has completed at 7483 Total wait was 6981 +Job 6 has completed at 7556 Total wait was 7032 +Job 9 has completed at 7587 Total wait was 7023 +Job 13 has completed at 7616 Total wait was 7034 +Job 23 has completed at 7619 Total wait was 7064 +Finish time = 7619 +Machine 1 completed 430 tasks +The total wait time was 109298 + diff --git a/acceptanceTests/Machine_shop_test_files/RandTest5.input b/acceptanceTests/Machine_shop_test_files/RandTest5.input new file mode 100644 index 0000000..e8e53be --- /dev/null +++ b/acceptanceTests/Machine_shop_test_files/RandTest5.input @@ -0,0 +1,44 @@ +32 21 +30 6 19 28 16 5 9 18 10 9 3 25 12 3 10 15 17 27 30 0 9 19 30 13 0 5 16 2 20 5 6 3 +22 +11 4 7 17 21 11 2 27 23 31 24 6 20 17 28 20 24 4 16 25 14 4 13 20 21 21 28 1 12 29 13 26 23 9 23 14 11 5 3 18 10 29 29 28 +7 +5 4 21 25 3 16 12 18 9 25 18 19 29 15 +30 +11 31 26 1 16 9 26 21 26 25 1 32 9 3 4 7 19 10 11 19 20 32 15 3 26 4 26 27 16 19 9 21 25 5 16 29 14 24 5 11 7 10 8 3 21 11 20 9 30 27 13 32 29 26 26 9 26 30 21 24 +10 +28 32 26 21 3 15 23 27 10 3 19 19 12 13 18 29 29 12 30 17 +15 +19 14 27 24 18 17 17 28 27 20 2 22 29 24 8 15 8 30 17 19 12 25 31 8 21 10 30 18 25 19 +29 +24 29 15 19 19 17 16 11 21 19 24 12 14 32 22 8 16 21 6 28 8 28 4 12 17 18 29 22 4 17 10 13 26 17 27 6 10 14 10 14 1 19 3 4 1 26 22 1 8 5 9 16 1 26 30 30 24 4 +20 +32 6 22 23 26 6 2 9 6 2 13 19 9 31 12 14 2 25 8 7 6 32 23 28 5 22 15 8 23 28 20 22 12 6 14 22 22 29 12 23 +7 +27 21 2 17 15 23 13 3 32 9 28 21 25 21 +10 +29 11 31 28 9 23 28 32 30 29 29 24 23 22 6 1 25 27 1 21 +30 +8 11 16 15 1 22 13 10 17 27 19 8 22 11 18 25 17 30 10 11 23 17 14 2 17 31 29 24 8 11 22 23 3 31 14 3 11 9 8 27 27 28 29 24 13 24 29 28 25 27 29 15 10 18 8 26 18 6 26 16 +22 +22 20 22 16 15 20 32 18 31 14 18 3 20 6 19 26 16 7 28 30 4 19 18 24 8 22 22 1 20 18 7 7 1 9 2 2 15 18 20 7 16 11 17 29 +29 +13 28 9 18 32 11 26 2 12 15 1 27 27 21 31 16 26 22 19 15 3 27 30 8 31 23 10 14 20 3 25 8 31 10 1 14 15 17 18 2 28 25 28 32 18 13 12 9 14 16 16 12 23 31 23 5 9 18 +20 +27 5 16 15 25 26 18 27 17 21 31 5 6 4 31 5 19 12 10 31 17 19 12 17 10 7 21 7 14 7 2 4 15 7 23 15 23 32 27 13 +14 +10 3 19 6 12 7 13 20 18 8 29 26 32 1 3 27 6 1 23 3 15 18 21 12 22 1 19 12 +32 +31 24 13 32 27 19 23 21 32 28 2 13 2 29 6 32 9 1 24 23 29 28 30 28 2 8 8 31 5 30 19 18 8 1 19 11 10 2 31 6 14 14 11 10 3 8 2 30 25 30 21 14 5 9 15 15 21 1 5 27 22 32 28 30 +3 +27 6 31 32 22 30 +18 +32 2 27 29 6 31 24 11 12 2 6 32 3 1 8 2 28 32 21 12 17 16 20 12 1 17 18 5 17 30 16 14 21 16 29 23 +18 +6 1 7 15 15 9 23 31 25 9 26 14 2 20 16 10 15 19 3 16 24 18 16 31 31 27 13 6 29 27 30 1 26 1 15 5 +17 +8 12 29 13 15 7 6 19 31 21 5 10 8 5 30 25 10 24 16 24 14 12 3 21 28 16 18 21 16 15 5 9 23 12 +13 +9 30 19 32 23 13 29 18 15 28 19 11 16 29 3 4 16 19 5 1 29 7 17 10 32 26 +28 +12 19 17 12 25 4 20 3 25 18 1 20 25 22 13 15 3 20 31 23 26 4 10 2 8 21 26 1 25 8 8 31 28 30 25 25 11 26 13 28 19 15 21 16 23 29 1 32 20 23 16 24 11 8 8 20 diff --git a/acceptanceTests/Machine_shop_test_files/RandTest5.output b/acceptanceTests/Machine_shop_test_files/RandTest5.output new file mode 100644 index 0000000..a234f08 --- /dev/null +++ b/acceptanceTests/Machine_shop_test_files/RandTest5.output @@ -0,0 +1,162 @@ +Enter number of machines and jobs +Enter change-over times for machines +Enter number of tasks for job 1 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 2 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 3 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 4 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 5 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 6 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 7 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 8 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 9 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 10 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 11 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 12 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 13 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 14 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 15 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 16 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 17 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 18 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 19 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 20 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 21 +Enter the tasks (machine, time) in process order +Job 16 has completed at 146 Total wait was 78 +Job 8 has completed at 167 Total wait was 52 +Job 2 has completed at 211 Total wait was 89 +Job 18 has completed at 349 Total wait was 89 +Job 9 has completed at 384 Total wait was 166 +Job 4 has completed at 435 Total wait was 247 +Job 14 has completed at 512 Total wait was 367 +Job 7 has completed at 602 Total wait was 240 +Job 5 has completed at 629 Total wait was 336 +Job 19 has completed at 642 Total wait was 376 +Job 17 has completed at 649 Total wait was 362 +Job 11 has completed at 673 Total wait was 346 +Job 13 has completed at 717 Total wait was 438 +Job 20 has completed at 726 Total wait was 498 +Job 6 has completed at 797 Total wait was 309 +Job 3 has completed at 799 Total wait was 285 +Job 21 has completed at 900 Total wait was 401 +Job 1 has completed at 910 Total wait was 544 +Job 12 has completed at 921 Total wait was 459 +Job 15 has completed at 936 Total wait was 331 +Job 10 has completed at 1011 Total wait was 451 +Finish time = 1011 +Machine 1 completed 12 tasks +The total wait time was 197 + +Machine 2 completed 12 tasks +The total wait time was 49 + +Machine 3 completed 13 tasks +The total wait time was 131 + +Machine 4 completed 4 tasks +The total wait time was 59 + +Machine 5 completed 9 tasks +The total wait time was 14 + +Machine 6 completed 11 tasks +The total wait time was 85 + +Machine 7 completed 4 tasks +The total wait time was 21 + +Machine 8 completed 19 tasks +The total wait time was 243 + +Machine 9 completed 10 tasks +The total wait time was 62 + +Machine 10 completed 14 tasks +The total wait time was 9 + +Machine 11 completed 8 tasks +The total wait time was 9 + +Machine 12 completed 13 tasks +The total wait time was 144 + +Machine 13 completed 13 tasks +The total wait time was 218 + +Machine 14 completed 10 tasks +The total wait time was 46 + +Machine 15 completed 15 tasks +The total wait time was 141 + +Machine 16 completed 19 tasks +The total wait time was 341 + +Machine 17 completed 13 tasks +The total wait time was 54 + +Machine 18 completed 13 tasks +The total wait time was 643 + +Machine 19 completed 15 tasks +The total wait time was 955 + +Machine 20 completed 11 tasks +The total wait time was 0 + +Machine 21 completed 14 tasks +The total wait time was 81 + +Machine 22 completed 12 tasks +The total wait time was 144 + +Machine 23 completed 18 tasks +The total wait time was 1682 + +Machine 24 completed 8 tasks +The total wait time was 108 + +Machine 25 completed 14 tasks +The total wait time was 33 + +Machine 26 completed 17 tasks +The total wait time was 92 + +Machine 27 completed 11 tasks +The total wait time was 406 + +Machine 28 completed 12 tasks +The total wait time was 20 + +Machine 29 completed 19 tasks +The total wait time was 399 + +Machine 30 completed 9 tasks +The total wait time was 0 + +Machine 31 completed 14 tasks +The total wait time was 69 + +Machine 32 completed 8 tasks +The total wait time was 9 + diff --git a/acceptanceTests/Machine_shop_test_files/RandTest6.input b/acceptanceTests/Machine_shop_test_files/RandTest6.input new file mode 100644 index 0000000..ce1d2a1 --- /dev/null +++ b/acceptanceTests/Machine_shop_test_files/RandTest6.input @@ -0,0 +1,64 @@ +8 31 +16 13 28 11 25 5 9 15 +26 +4 12 2 24 6 12 4 2 2 2 3 26 6 12 1 31 7 27 5 13 8 14 4 29 4 12 3 8 6 18 1 26 1 7 3 25 7 26 3 28 6 10 4 4 8 16 7 21 4 9 1 15 +30 +7 22 4 24 8 9 5 1 6 19 2 13 8 7 1 8 2 25 6 5 2 4 8 23 8 29 2 26 2 29 6 17 7 19 8 21 4 24 4 16 5 25 2 25 7 25 2 7 4 1 8 5 2 25 6 8 4 7 3 20 +19 +2 6 5 25 2 16 6 8 7 28 6 31 5 3 8 6 2 31 8 20 8 5 1 10 3 15 3 9 5 7 3 21 6 10 5 22 4 25 +22 +3 20 2 1 4 22 8 7 1 29 5 4 5 28 6 31 3 2 8 5 8 26 5 28 5 25 8 12 8 10 7 28 6 15 4 10 8 23 2 24 3 8 4 25 +5 +4 13 1 25 8 24 1 10 1 20 +1 +1 17 +30 +3 7 1 9 8 7 5 5 1 5 3 14 8 15 8 17 8 18 4 13 8 5 4 6 8 26 7 17 5 22 1 4 2 12 8 32 3 28 1 5 7 9 8 1 1 4 3 8 5 14 3 15 1 2 7 1 8 10 6 1 +10 +6 10 3 31 8 2 7 14 1 32 1 9 6 7 5 9 5 22 4 2 +12 +6 6 6 23 8 24 4 17 3 22 7 28 8 31 5 4 2 4 5 14 4 9 3 7 +8 +1 29 4 11 8 24 1 14 3 5 2 14 3 23 4 28 +5 +4 4 1 15 2 3 2 3 6 15 +20 +4 28 3 26 2 21 6 17 7 23 8 21 7 21 6 10 2 32 1 27 6 32 6 14 7 11 2 11 4 11 7 25 3 18 1 16 2 11 4 1 +5 +7 2 1 7 1 28 2 5 3 13 +12 +5 2 1 30 5 31 3 6 6 15 3 25 7 14 4 28 5 25 4 9 7 1 1 28 +24 +2 26 7 26 4 3 2 3 8 5 3 18 8 21 7 8 2 23 2 31 2 18 7 9 1 21 8 24 6 22 6 16 7 16 4 17 8 3 8 28 2 28 6 1 3 12 1 28 +13 +5 18 8 29 7 27 7 28 7 21 6 24 2 2 8 4 4 7 3 29 8 22 1 1 4 31 +6 +5 1 1 31 2 9 3 4 8 15 1 19 +9 +8 16 6 11 2 19 6 21 5 27 4 5 1 26 3 31 3 21 +23 +1 1 7 32 2 17 4 7 1 20 1 13 7 21 6 9 2 32 1 9 6 16 6 12 8 2 3 25 1 32 5 22 3 10 8 23 8 21 1 16 1 10 8 16 3 19 +28 +3 1 4 4 8 27 3 9 1 24 1 32 1 32 5 26 1 12 7 13 1 22 4 12 7 21 8 32 5 15 2 2 4 17 6 25 7 19 2 4 1 3 5 18 5 23 7 18 6 5 4 22 8 24 7 28 +8 +5 9 2 24 5 7 4 19 6 15 7 30 8 22 7 30 +22 +4 15 7 7 8 32 8 4 6 28 1 15 1 24 1 23 3 17 6 24 2 6 4 29 1 7 5 5 5 30 8 28 5 24 4 29 8 20 5 11 2 4 6 16 +1 +7 13 +24 +6 9 2 3 8 26 3 21 5 5 8 6 2 2 7 16 7 3 1 29 6 27 1 12 5 14 5 6 3 17 8 28 3 2 7 16 8 20 6 16 5 23 1 23 4 30 3 16 +28 +3 10 6 4 6 22 3 5 5 14 2 11 3 12 4 4 6 5 3 14 6 6 2 3 7 1 7 26 5 2 1 5 6 4 4 22 1 10 1 23 7 31 8 14 4 17 3 1 1 24 7 26 4 23 3 19 +6 +5 2 8 18 2 30 8 31 7 6 6 29 +3 +6 26 4 30 8 27 +23 +3 21 4 24 2 20 4 7 7 29 3 11 7 25 7 32 2 25 1 32 6 16 3 11 6 10 4 21 4 10 4 21 3 15 7 25 3 21 8 24 8 27 8 28 8 4 +22 +8 22 1 9 6 15 3 26 2 32 7 11 5 13 8 7 3 23 3 19 1 1 3 13 1 2 6 21 2 31 6 2 6 21 3 23 2 1 1 24 8 3 7 7 +16 +3 23 4 14 4 20 2 20 8 16 3 15 5 27 6 7 4 30 1 16 8 12 3 29 4 30 6 18 4 29 4 31 +30 +7 13 1 3 8 21 3 9 3 24 8 2 3 22 7 25 4 29 7 32 6 7 1 11 6 16 3 8 4 22 4 28 7 5 5 14 7 17 1 21 8 25 1 5 3 4 3 13 1 27 2 23 6 3 4 22 2 5 5 25 diff --git a/acceptanceTests/Machine_shop_test_files/RandTest6.output b/acceptanceTests/Machine_shop_test_files/RandTest6.output new file mode 100644 index 0000000..a797ae5 --- /dev/null +++ b/acceptanceTests/Machine_shop_test_files/RandTest6.output @@ -0,0 +1,120 @@ +Enter number of machines and jobs +Enter change-over times for machines +Enter number of tasks for job 1 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 2 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 3 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 4 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 5 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 6 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 7 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 8 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 9 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 10 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 11 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 12 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 13 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 14 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 15 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 16 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 17 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 18 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 19 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 20 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 21 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 22 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 23 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 24 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 25 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 26 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 27 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 28 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 29 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 30 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 31 +Enter the tasks (machine, time) in process order +Job 6 has completed at 17 Total wait was 0 +Job 23 has completed at 55 Total wait was 42 +Job 11 has completed at 387 Total wait was 347 +Job 27 has completed at 401 Total wait was 318 +Job 5 has completed at 508 Total wait was 416 +Job 26 has completed at 601 Total wait was 485 +Job 13 has completed at 805 Total wait was 750 +Job 21 has completed at 878 Total wait was 722 +Job 8 has completed at 899 Total wait was 761 +Job 17 has completed at 1096 Total wait was 1017 +Job 14 has completed at 1179 Total wait was 965 +Job 10 has completed at 1234 Total wait was 1086 +Job 16 has completed at 1383 Total wait was 1140 +Job 18 has completed at 1391 Total wait was 1214 +Job 9 has completed at 1514 Total wait was 1325 +Job 12 has completed at 1761 Total wait was 1385 +Job 15 has completed at 2007 Total wait was 1600 +Job 22 has completed at 2033 Total wait was 1635 +Job 30 has completed at 2124 Total wait was 1787 +Job 20 has completed at 2143 Total wait was 1653 +Job 4 has completed at 2160 Total wait was 1777 +Job 2 has completed at 2304 Total wait was 1815 +Job 19 has completed at 2529 Total wait was 2144 +Job 1 has completed at 2604 Total wait was 2175 +Job 3 has completed at 2635 Total wait was 2337 +Job 29 has completed at 2675 Total wait was 2349 +Job 25 has completed at 2676 Total wait was 2318 +Job 24 has completed at 2805 Total wait was 2435 +Job 28 has completed at 2853 Total wait was 2394 +Job 7 has completed at 2894 Total wait was 2562 +Job 31 has completed at 3026 Total wait was 2545 +Finish time = 3026 +Machine 1 completed 69 tasks +The total wait time was 6305 + +Machine 2 completed 54 tasks +The total wait time was 1895 + +Machine 3 completed 67 tasks +The total wait time was 21988 + +Machine 4 completed 64 tasks +The total wait time was 3168 + +Machine 5 completed 46 tasks +The total wait time was 2027 + +Machine 6 completed 60 tasks +The total wait time was 421 + +Machine 7 completed 57 tasks +The total wait time was 966 + +Machine 8 completed 74 tasks +The total wait time was 6729 + diff --git a/acceptanceTests/Machine_shop_test_files/RandTest7.input b/acceptanceTests/Machine_shop_test_files/RandTest7.input new file mode 100644 index 0000000..d30f008 --- /dev/null +++ b/acceptanceTests/Machine_shop_test_files/RandTest7.input @@ -0,0 +1,54 @@ +20 26 +28 19 25 7 23 2 27 15 0 12 14 11 3 23 5 0 27 7 6 12 +10 +9 22 15 14 13 24 17 10 9 23 15 29 6 14 14 22 11 1 6 20 +22 +16 32 10 17 3 15 5 19 15 14 17 6 12 28 12 31 15 2 16 25 11 13 11 21 6 2 5 17 8 31 16 11 4 19 17 9 16 16 18 28 8 16 8 8 +8 +4 9 17 16 6 13 4 12 12 20 10 26 2 27 14 26 +14 +12 30 12 28 5 25 6 26 13 5 8 11 18 1 19 25 3 8 15 21 12 3 2 24 2 26 16 30 +5 +14 11 13 32 19 20 16 20 6 1 +8 +5 12 5 1 7 10 3 2 4 6 1 10 9 3 15 6 +3 +7 8 13 11 20 15 +2 +11 11 8 2 +8 +20 9 7 18 1 1 16 6 16 23 20 20 15 1 8 22 +29 +7 29 11 17 3 7 2 28 9 27 13 16 17 4 8 32 10 21 19 6 18 32 3 4 20 28 3 6 18 14 5 27 5 19 4 30 2 13 19 22 20 23 13 4 7 31 6 16 13 10 14 30 14 29 20 15 5 3 +28 +2 3 14 26 4 4 9 15 11 11 15 5 16 9 2 1 20 18 10 16 9 25 17 9 9 24 3 25 7 4 1 19 9 24 9 21 19 17 1 32 10 3 18 9 19 17 17 7 2 14 12 26 12 27 4 24 +10 +13 13 17 29 17 13 3 18 19 22 9 15 1 12 9 22 12 3 15 9 +6 +20 10 9 12 17 11 11 13 5 11 7 11 +9 +20 9 19 6 11 10 4 28 4 17 1 27 1 3 9 23 17 17 +10 +4 17 8 8 16 6 13 11 14 20 13 20 4 6 10 19 14 17 8 26 +22 +6 4 1 1 9 15 10 20 11 11 16 29 10 20 10 30 6 4 19 32 11 8 14 21 11 10 17 30 9 11 11 18 6 6 4 21 9 6 12 25 17 21 7 8 +13 +6 18 5 20 17 1 3 6 9 13 2 17 16 30 18 8 15 18 10 26 7 27 3 16 1 17 +14 +9 32 2 19 3 16 17 25 11 26 2 29 15 24 6 31 7 18 15 8 12 1 20 26 13 12 17 16 +23 +5 2 18 25 4 3 18 23 10 14 13 3 17 23 13 11 19 25 5 6 19 15 6 18 16 25 10 22 11 14 7 32 5 7 4 3 18 18 14 5 3 17 17 20 9 16 +11 +4 27 20 23 13 13 3 1 20 23 3 31 18 20 5 10 15 25 20 25 1 11 +30 +20 23 15 31 5 11 5 4 6 10 4 30 3 19 3 19 20 28 12 1 2 6 3 30 10 12 18 23 15 8 12 7 19 12 8 28 20 1 14 22 8 21 17 11 10 20 20 26 19 13 3 26 3 23 16 19 5 5 10 15 +23 +13 32 6 31 18 32 20 17 1 11 18 32 5 19 10 9 1 29 7 27 13 6 3 3 12 1 12 6 16 24 13 25 8 4 11 32 14 20 9 6 6 19 18 2 16 21 +32 +11 20 3 17 5 24 2 29 10 3 7 26 7 19 5 13 20 6 2 19 1 29 19 13 18 32 10 15 2 5 17 24 14 6 3 15 16 15 14 14 12 24 13 31 8 8 4 30 8 8 16 27 8 5 7 3 6 15 7 22 8 10 4 12 +27 +14 23 13 23 4 26 19 11 6 19 5 26 16 4 20 21 14 30 12 21 18 14 8 2 3 32 9 4 16 15 11 20 1 4 20 14 3 8 4 11 7 5 11 23 18 8 14 6 20 15 9 21 4 30 +29 +7 4 14 30 4 32 11 15 17 12 6 7 15 31 5 4 17 30 1 19 6 18 14 32 2 25 20 18 6 19 8 30 15 12 12 14 8 5 20 18 5 17 19 4 14 4 17 32 2 6 20 15 15 3 3 31 13 11 +17 +17 13 18 11 12 23 14 11 13 12 11 23 15 18 14 28 12 19 17 6 6 30 1 18 11 13 9 9 2 29 2 24 15 28 diff --git a/acceptanceTests/Machine_shop_test_files/RandTest7.output b/acceptanceTests/Machine_shop_test_files/RandTest7.output new file mode 100644 index 0000000..8ff0d77 --- /dev/null +++ b/acceptanceTests/Machine_shop_test_files/RandTest7.output @@ -0,0 +1,141 @@ +Enter number of machines and jobs +Enter change-over times for machines +Enter number of tasks for job 1 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 2 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 3 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 4 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 5 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 6 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 7 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 8 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 9 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 10 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 11 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 12 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 13 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 14 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 15 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 16 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 17 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 18 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 19 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 20 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 21 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 22 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 23 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 24 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 25 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 26 +Enter the tasks (machine, time) in process order +Job 8 has completed at 13 Total wait was 0 +Job 7 has completed at 114 Total wait was 80 +Job 5 has completed at 138 Total wait was 54 +Job 9 has completed at 240 Total wait was 140 +Job 6 has completed at 330 Total wait was 280 +Job 13 has completed at 334 Total wait was 266 +Job 3 has completed at 336 Total wait was 187 +Job 15 has completed at 402 Total wait was 252 +Job 12 has completed at 469 Total wait was 313 +Job 1 has completed at 486 Total wait was 307 +Job 14 has completed at 537 Total wait was 397 +Job 4 has completed at 606 Total wait was 343 +Job 20 has completed at 618 Total wait was 409 +Job 17 has completed at 663 Total wait was 446 +Job 18 has completed at 673 Total wait was 390 +Job 26 has completed at 744 Total wait was 429 +Job 22 has completed at 811 Total wait was 403 +Job 16 has completed at 873 Total wait was 522 +Job 19 has completed at 928 Total wait was 581 +Job 24 has completed at 1027 Total wait was 591 +Job 2 has completed at 1039 Total wait was 659 +Job 11 has completed at 1058 Total wait was 623 +Job 21 has completed at 1227 Total wait was 723 +Job 25 has completed at 1229 Total wait was 731 +Job 10 has completed at 1253 Total wait was 710 +Job 23 has completed at 1267 Total wait was 728 +Finish time = 1267 +Machine 1 completed 16 tasks +The total wait time was 280 + +Machine 2 completed 19 tasks +The total wait time was 396 + +Machine 3 completed 25 tasks +The total wait time was 1423 + +Machine 4 completed 22 tasks +The total wait time was 261 + +Machine 5 completed 23 tasks +The total wait time was 1478 + +Machine 6 completed 22 tasks +The total wait time was 78 + +Machine 7 completed 18 tasks +The total wait time was 487 + +Machine 8 completed 19 tasks +The total wait time was 257 + +Machine 9 completed 23 tasks +The total wait time was 182 + +Machine 10 completed 18 tasks +The total wait time was 115 + +Machine 11 completed 21 tasks +The total wait time was 233 + +Machine 12 completed 20 tasks +The total wait time was 324 + +Machine 13 completed 21 tasks +The total wait time was 511 + +Machine 14 completed 22 tasks +The total wait time was 950 + +Machine 15 completed 20 tasks +The total wait time was 238 + +Machine 16 completed 20 tasks +The total wait time was 125 + +Machine 17 completed 25 tasks +The total wait time was 2638 + +Machine 18 completed 18 tasks +The total wait time was 165 + +Machine 19 completed 16 tasks +The total wait time was 99 + +Machine 20 completed 25 tasks +The total wait time was 324 + diff --git a/acceptanceTests/Machine_shop_test_files/RandTest8.input b/acceptanceTests/Machine_shop_test_files/RandTest8.input new file mode 100644 index 0000000..043fa5e --- /dev/null +++ b/acceptanceTests/Machine_shop_test_files/RandTest8.input @@ -0,0 +1,60 @@ +21 29 +31 26 19 26 21 4 25 2 25 3 7 11 22 5 25 13 18 4 26 19 23 +10 +13 11 8 21 15 29 4 18 16 30 17 31 19 9 7 13 5 12 19 12 +10 +4 8 17 3 8 23 21 13 5 30 21 30 9 11 17 10 4 9 21 29 +4 +11 18 4 16 10 23 7 7 +15 +8 17 8 16 3 11 8 11 7 15 1 16 1 12 9 2 12 27 12 6 3 32 12 24 2 17 8 8 8 22 +10 +19 3 13 25 1 6 12 27 18 15 21 25 20 20 12 21 15 29 13 24 +31 +2 29 17 6 8 16 21 19 3 10 14 26 19 20 16 26 3 2 8 32 1 5 19 15 11 24 16 15 5 14 14 24 7 23 2 32 6 11 18 23 4 6 2 6 11 14 16 32 10 31 14 21 16 15 21 6 3 18 10 25 1 12 +31 +9 7 12 21 14 4 13 23 2 31 11 5 3 8 16 15 8 10 7 12 6 24 2 4 4 12 4 22 9 16 11 13 16 27 3 19 6 11 13 9 7 32 15 6 14 21 1 16 6 21 21 11 12 23 9 11 10 31 19 9 3 25 +10 +6 30 11 15 15 29 1 27 14 8 3 1 19 3 10 17 1 30 4 16 +14 +8 12 13 22 4 22 18 17 3 11 21 9 19 8 15 17 16 13 4 19 15 29 4 21 5 18 6 25 +24 +21 10 1 21 4 17 9 21 4 24 5 29 19 2 15 23 7 22 9 23 5 8 2 23 1 1 20 11 14 27 17 2 18 25 15 13 18 13 4 15 17 3 7 31 21 21 14 17 +26 +13 13 3 11 16 7 4 9 8 9 14 2 1 1 9 23 19 6 19 13 5 11 7 3 15 10 4 17 14 3 13 8 17 19 10 5 13 27 1 14 5 1 16 22 3 7 15 9 13 24 13 5 +32 +3 27 6 15 6 7 5 16 14 28 13 6 20 26 11 27 5 29 7 6 16 25 10 19 6 20 10 16 4 13 13 9 4 16 12 27 16 11 17 27 11 8 3 29 9 20 18 31 2 27 9 28 18 28 4 11 3 7 7 9 9 2 18 15 +14 +20 13 12 26 13 30 15 23 9 16 12 11 2 12 2 16 8 26 13 31 1 28 8 20 2 15 19 17 +30 +5 18 10 14 15 7 9 4 13 30 8 27 9 2 4 5 1 2 21 15 1 18 3 6 12 13 17 5 7 25 17 21 6 1 9 13 21 31 4 15 5 20 15 7 14 15 17 19 9 3 10 8 13 4 16 27 1 14 9 31 +16 +3 4 19 3 15 16 21 30 19 16 13 29 19 28 5 4 9 17 12 17 1 20 10 32 5 8 13 2 7 5 20 13 +26 +16 9 18 19 9 25 18 5 17 28 16 3 15 24 12 6 2 21 10 25 2 21 4 19 4 13 2 11 20 32 8 19 3 2 16 12 18 10 7 10 9 3 9 13 3 29 3 21 16 18 21 5 +10 +8 32 21 19 18 5 12 32 8 27 10 4 3 2 13 24 19 5 14 20 +5 +4 32 18 29 8 9 7 5 15 25 +3 +11 21 12 6 10 9 +10 +11 24 10 13 18 1 6 3 5 10 20 3 11 28 9 25 12 32 3 12 +7 +1 13 7 4 18 11 21 32 18 27 7 11 8 24 +22 +2 10 2 13 21 14 8 3 15 17 9 2 10 16 19 1 21 26 15 18 11 30 13 26 19 15 7 19 9 5 2 7 21 7 3 5 3 6 16 2 11 17 17 18 +29 +10 10 3 7 15 18 20 21 4 21 15 17 2 15 15 23 20 16 3 15 7 1 2 12 3 25 6 9 3 3 1 11 3 2 4 6 13 28 10 6 5 4 3 18 6 15 7 18 18 13 17 29 21 22 12 27 7 21 +20 +1 24 9 15 3 17 10 26 20 20 20 27 9 11 20 19 4 17 1 27 13 21 6 16 9 29 9 32 12 16 12 23 12 4 15 8 5 24 10 13 +1 +16 30 +7 +13 6 17 1 4 5 12 16 15 1 21 2 19 14 +9 +17 24 9 31 14 32 4 3 12 2 9 31 20 7 15 16 8 6 +25 +21 24 20 30 17 31 11 2 9 24 20 26 14 16 1 31 9 9 20 24 3 7 12 22 7 25 15 27 3 9 9 21 3 24 19 8 5 5 2 8 6 5 9 11 13 30 17 5 21 26 +20 +11 29 17 18 14 20 8 6 19 6 3 21 14 1 7 18 17 15 2 31 8 16 8 32 17 15 10 11 14 8 2 15 2 7 11 24 20 18 11 29 diff --git a/acceptanceTests/Machine_shop_test_files/RandTest8.output b/acceptanceTests/Machine_shop_test_files/RandTest8.output new file mode 100644 index 0000000..5787867 --- /dev/null +++ b/acceptanceTests/Machine_shop_test_files/RandTest8.output @@ -0,0 +1,153 @@ +Enter number of machines and jobs +Enter change-over times for machines +Enter number of tasks for job 1 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 2 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 3 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 4 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 5 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 6 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 7 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 8 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 9 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 10 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 11 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 12 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 13 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 14 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 15 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 16 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 17 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 18 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 19 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 20 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 21 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 22 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 23 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 24 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 25 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 26 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 27 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 28 +Enter the tasks (machine, time) in process order +Enter number of tasks for job 29 +Enter the tasks (machine, time) in process order +Job 25 has completed at 52 Total wait was 22 +Job 19 has completed at 102 Total wait was 66 +Job 3 has completed at 138 Total wait was 74 +Job 21 has completed at 199 Total wait was 77 +Job 18 has completed at 307 Total wait was 207 +Job 20 has completed at 338 Total wait was 187 +Job 26 has completed at 521 Total wait was 476 +Job 8 has completed at 563 Total wait was 387 +Job 17 has completed at 572 Total wait was 402 +Job 5 has completed at 601 Total wait was 406 +Job 27 has completed at 624 Total wait was 472 +Job 29 has completed at 643 Total wait was 303 +Job 4 has completed at 685 Total wait was 449 +Job 1 has completed at 755 Total wait was 569 +Job 2 has completed at 867 Total wait was 701 +Job 15 has completed at 917 Total wait was 673 +Job 13 has completed at 992 Total wait was 708 +Job 9 has completed at 1022 Total wait was 779 +Job 24 has completed at 1055 Total wait was 666 +Job 11 has completed at 1105 Total wait was 826 +Job 22 has completed at 1202 Total wait was 925 +Job 10 has completed at 1209 Total wait was 807 +Job 16 has completed at 1265 Total wait was 862 +Job 28 has completed at 1314 Total wait was 864 +Job 6 has completed at 1326 Total wait was 768 +Job 12 has completed at 1331 Total wait was 746 +Job 7 has completed at 1349 Total wait was 850 +Job 14 has completed at 1402 Total wait was 982 +Job 23 has completed at 1407 Total wait was 974 +Finish time = 1407 +Machine 1 completed 22 tasks +The total wait time was 866 + +Machine 2 completed 23 tasks +The total wait time was 541 + +Machine 3 completed 35 tasks +The total wait time was 925 + +Machine 4 completed 29 tasks +The total wait time was 2887 + +Machine 5 completed 18 tasks +The total wait time was 210 + +Machine 6 completed 15 tasks +The total wait time was 11 + +Machine 7 completed 23 tasks +The total wait time was 566 + +Machine 8 completed 25 tasks +The total wait time was 468 + +Machine 9 completed 34 tasks +The total wait time was 2564 + +Machine 10 completed 21 tasks +The total wait time was 66 + +Machine 11 completed 17 tasks +The total wait time was 318 + +Machine 12 completed 23 tasks +The total wait time was 358 + +Machine 13 completed 25 tasks +The total wait time was 1605 + +Machine 14 completed 18 tasks +The total wait time was 71 + +Machine 15 completed 25 tasks +The total wait time was 1652 + +Machine 16 completed 19 tasks +The total wait time was 95 + +Machine 17 completed 21 tasks +The total wait time was 339 + +Machine 18 completed 17 tasks +The total wait time was 92 + +Machine 19 completed 21 tasks +The total wait time was 1170 + +Machine 20 completed 17 tasks +The total wait time was 163 + +Machine 21 completed 23 tasks +The total wait time was 1261 + diff --git a/acceptanceTests/Machine_shop_test_files/RandTest9.input b/acceptanceTests/Machine_shop_test_files/RandTest9.input new file mode 100644 index 0000000..ddbff90 --- /dev/null +++ b/acceptanceTests/Machine_shop_test_files/RandTest9.input @@ -0,0 +1,4 @@ +7 1 +25 22 31 30 3 24 17 +11 +1 2 1 31 5 18 6 10 6 22 7 3 7 2 6 15 6 27 7 25 5 31 diff --git a/acceptanceTests/Machine_shop_test_files/RandTest9.output b/acceptanceTests/Machine_shop_test_files/RandTest9.output new file mode 100644 index 0000000..9aad969 --- /dev/null +++ b/acceptanceTests/Machine_shop_test_files/RandTest9.output @@ -0,0 +1,27 @@ +Enter number of machines and jobs +Enter change-over times for machines +Enter number of tasks for job 1 +Enter the tasks (machine, time) in process order +Job 1 has completed at 278 Total wait was 92 +Finish time = 278 +Machine 1 completed 2 tasks +The total wait time was 25 + +Machine 2 completed 0 tasks +The total wait time was 0 + +Machine 3 completed 0 tasks +The total wait time was 0 + +Machine 4 completed 0 tasks +The total wait time was 0 + +Machine 5 completed 2 tasks +The total wait time was 0 + +Machine 6 completed 4 tasks +The total wait time was 50 + +Machine 7 completed 3 tasks +The total wait time was 17 + diff --git a/acceptanceTests/applications/FileIoTests.java b/acceptanceTests/applications/FileIoTests.java new file mode 100644 index 0000000..3980706 --- /dev/null +++ b/acceptanceTests/applications/FileIoTests.java @@ -0,0 +1,159 @@ +package applications; + +import static org.junit.Assert.*; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileReader; +import java.io.FilenameFilter; +import java.io.IOException; +import java.io.PrintStream; + +import org.junit.Test; + +import exceptions.MyInputException; + +/** + * A simple set of unit tests that just run the MachineShopSimulator on a set + * of input files and compare the results to the expected output files. + * + * @author Nic McPhee + */ +public class FileIoTests { + + private static final String ACCEPTANCE_TEST_DIRECTORY = "acceptanceTests/"; + private static final String TEST_FILE_DIRECTORY + = ACCEPTANCE_TEST_DIRECTORY + "Machine_shop_test_files/"; + private static final String EXCEPTION_TEST_FILE_DIRECTORY + = ACCEPTANCE_TEST_DIRECTORY + "Machine_shop_exception_test_files/"; + + /** + * For each file in the Test_files directory with a name of the form + * *.input, run the simulator with that as input, save the output + * to a temp file, and compare that to the expected output file. + * @throws IOException + */ + @Test + public final void runFileBasedTests() throws IOException { + String[] inputFiles = collectInputFileNames(); + for (String inputFile : inputFiles) { + File outputFile = runInputFile(inputFile, TEST_FILE_DIRECTORY); + String expectedOutputFile = generateExpectedOutputFile(inputFile); + checkFilesMatch(expectedOutputFile, outputFile); + } + } + + private String[] collectInputFileNames() { + File testFileDirectory = new File(TEST_FILE_DIRECTORY); + FilenameFilter inputFileFilter = new FilenameFilter() { + @Override + public boolean accept(File directory, String name) { + return name.endsWith(".input"); + } + }; + String[] inputFiles = testFileDirectory.list(inputFileFilter); + return inputFiles; + } + + private File runInputFile(String inputFile, String directory) throws IOException { + System.err.println("Processing input file: <" + inputFile + ">"); + FileInputStream fileInputStream = new FileInputStream(directory + inputFile); + System.setIn(fileInputStream); + File outputFile = File.createTempFile("simulator", ".ouptut"); + PrintStream filePrintStream = new PrintStream(outputFile); + System.setOut(filePrintStream); + MachineShopSimulator.main(new String[] { }); + return outputFile; + } + + private String generateExpectedOutputFile(String inputFile) { + String outputFile = inputFile.replace(".input", ".output"); + return outputFile; + } + + private void checkFilesMatch(String expectedOutputFile, File outputFile) + throws IOException { + FileReader expectedFileReader = new FileReader(TEST_FILE_DIRECTORY + expectedOutputFile); + FileReader actualFileReader = new FileReader(outputFile); + BufferedReader expectedReader = new BufferedReader(expectedFileReader); + BufferedReader actualReader = new BufferedReader(actualFileReader); + String expectedLine = expectedReader.readLine(); + String actualLine = actualReader.readLine(); + + while (expectedLine != null && actualLine != null) { + assertEquals("In file " + expectedOutputFile, expectedLine, actualLine); + expectedLine = expectedReader.readLine(); + actualLine = actualReader.readLine(); + } + assertTrue("In file " + expectedOutputFile + " the files didn't end at the same time", + expectedLine == null && actualLine == null); + } + + @Test + public void noMachinesShouldThrowException() throws IOException { + String inputFile = "NoMachines.input"; + String expectedMessage = MachineShopSimulator.NUMBER_OF_MACHINES_AND_JOBS_MUST_BE_AT_LEAST_1; + runExceptionTest(inputFile, expectedMessage); + } + + @Test + public void noJobsShouldThrowException() throws IOException { + String inputFile = "NoJobs.input"; + String expectedMessage = MachineShopSimulator.NUMBER_OF_MACHINES_AND_JOBS_MUST_BE_AT_LEAST_1; + runExceptionTest(inputFile, expectedMessage); + } + + @Test + public void negativeChangeOverShouldThrowException() throws IOException { + String inputFile = "NegativeChangeOver.input"; + String expectedMessage = MachineShopSimulator.CHANGE_OVER_TIME_MUST_BE_AT_LEAST_0; + runExceptionTest(inputFile, expectedMessage); + } + + @Test + public void negativeNumberOfTasksShouldThrowException() throws IOException { + String inputFile = "NegativeNumberOfTasks.input"; + String expectedMessage = MachineShopSimulator.EACH_JOB_MUST_HAVE_AT_LEAST_1_TASK; + runExceptionTest(inputFile, expectedMessage); + } + + @Test + public void zeroTasksShouldThrowException() throws IOException { + String inputFile = "ZeroTasks.input"; + String expectedMessage = MachineShopSimulator.EACH_JOB_MUST_HAVE_AT_LEAST_1_TASK; + runExceptionTest(inputFile, expectedMessage); + } + + @Test + public void zeroMachineNumberShouldThrowException() throws IOException { + String inputFile = "ZeroMachineNumber.input"; + String expectedMessage = MachineShopSimulator.BAD_MACHINE_NUMBER_OR_TASK_TIME; + runExceptionTest(inputFile, expectedMessage); + } + + @Test + public void tooLargeMachineNumberShouldThrowException() throws IOException { + String inputFile = "MachineNumberTooLarge.input"; + String expectedMessage = MachineShopSimulator.BAD_MACHINE_NUMBER_OR_TASK_TIME; + runExceptionTest(inputFile, expectedMessage); + } + + @Test + public void zeroTaskTimeShouldThrowException() throws IOException { + String inputFile = "ZeroTaskTime.input"; + String expectedMessage = MachineShopSimulator.BAD_MACHINE_NUMBER_OR_TASK_TIME; + runExceptionTest(inputFile, expectedMessage); + } + + private void runExceptionTest(String inputFile, String expectedMessage) + throws IOException { + try { + runInputFile(inputFile, EXCEPTION_TEST_FILE_DIRECTORY); + fail("Running the \"" + inputFile + "\" test should have thrown an exception."); + } catch (MyInputException e) { + assertEquals(expectedMessage, e.getMessage()); + } + } + +} diff --git a/acceptanceTests/dataStructures/LinkedQueueAcceptanceTest.java b/acceptanceTests/dataStructures/LinkedQueueAcceptanceTest.java new file mode 100644 index 0000000..1c2f822 --- /dev/null +++ b/acceptanceTests/dataStructures/LinkedQueueAcceptanceTest.java @@ -0,0 +1,45 @@ +package dataStructures; + +import org.junit.Test; +import static org.junit.Assert.*; + +public class LinkedQueueAcceptanceTest { + + /** + * A simple acceptance test based on the one little test that + * Sahni provided with the code. + */ + @Test + public void sahniTest() { + LinkedQueue q = new LinkedQueue(3); + // add a few elements + q.put(new Integer(1)); + q.put(new Integer(2)); + q.put(new Integer(3)); + q.put(new Integer(4)); + + assertEquals(4, q.getRearElement()); + assertEquals(1, q.getFrontElement()); + assertEquals(1, q.remove()); + assertEquals(4, q.getRearElement()); + assertEquals(2, q.getFrontElement()); + assertEquals(2, q.remove()); + assertEquals(4, q.getRearElement()); + assertEquals(3, q.getFrontElement()); + assertEquals(3, q.remove()); + assertEquals(4, q.getRearElement()); + assertEquals(4, q.getFrontElement()); + assertEquals(4, q.remove()); + + assertTrue(q.isEmpty()); + } + + @Test + public void emptyQueueTests() { + LinkedQueue q = new LinkedQueue(); + assertTrue(q.isEmpty()); + assertNull(q.getFrontElement()); + assertNull(q.getRearElement()); + assertNull(q.remove()); + } +} diff --git a/scripts/GenTestCases.rb b/scripts/GenTestCases.rb new file mode 100644 index 0000000..907297e --- /dev/null +++ b/scripts/GenTestCases.rb @@ -0,0 +1,20 @@ + +def genTest + numMachines = 1 + rand(32) + numJobs = 1 + rand(32) + puts "#{numMachines} #{numJobs}" + changeTimes = (0...numMachines).map { rand(32) } + puts changeTimes.join(" ") + (0...numJobs).each do + numTasks = 1 + rand(32) + puts numTasks + pairs = (0...numTasks).map do + machine = 1 + rand(numMachines) + time = 1 + rand(32) + [machine, time] + end + puts pairs.join(" ") + end +end + +genTest \ No newline at end of file diff --git a/unitTests/dataStructures/ChainNodeTest.java b/unitTests/dataStructures/ChainNodeTest.java new file mode 100644 index 0000000..3a875d8 --- /dev/null +++ b/unitTests/dataStructures/ChainNodeTest.java @@ -0,0 +1,33 @@ +package dataStructures; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class ChainNodeTest { + + @Test + public final void testChainNode() { + ChainNode node = new ChainNode(); + assertNull(node.element); + assertNull(node.next); + } + + @Test + public final void testChainNodeObject() { + String string = "A test object"; + ChainNode node = new ChainNode(string); + assertEquals(string, node.element); + assertNull(node.next); + } + + @Test + public final void testChainNodeObjectNext() { + String firstNodeString = "First node"; + String secondNodeString = "Second node"; + ChainNode firstNode = new ChainNode(firstNodeString); + ChainNode secondNode = new ChainNode(secondNodeString, firstNode); + assertEquals(secondNodeString, secondNode.element); + assertEquals(firstNode, secondNode.next); + } +} diff --git a/unitTests/dataStructures/LinkedQueueTest.java b/unitTests/dataStructures/LinkedQueueTest.java new file mode 100644 index 0000000..d1fafd3 --- /dev/null +++ b/unitTests/dataStructures/LinkedQueueTest.java @@ -0,0 +1,42 @@ +package dataStructures; + +import static org.junit.Assert.*; + +import org.junit.Before; +import org.junit.Test; + +public class LinkedQueueTest { + + @Test + public void testIsEmpty() { + LinkedQueue queue = new LinkedQueue(); + assertTrue(queue.isEmpty()); + queue.put("An item"); + assertFalse(queue.isEmpty()); + queue.remove(); + assertTrue(queue.isEmpty()); + } + + @Test + public void testQueueOperations() { + LinkedQueue queue = new LinkedQueue(); + assertNull(queue.getFrontElement()); + assertNull(queue.getRearElement()); + final String firstItem = "First item"; + final String secondItem = "Second item"; + queue.put(firstItem); + assertEquals(firstItem, queue.getFrontElement()); + assertEquals(firstItem, queue.getRearElement()); + queue.put(secondItem); + assertEquals(firstItem, queue.getFrontElement()); + assertEquals(secondItem, queue.getRearElement()); + assertEquals(firstItem, queue.remove()); + assertEquals(secondItem, queue.getFrontElement()); + assertEquals(secondItem, queue.getRearElement()); + assertEquals(secondItem, queue.remove()); + assertNull(queue.getFrontElement()); + assertNull(queue.getRearElement()); + assertNull(queue.remove()); + } + +} diff --git a/unitTests/exceptions/MyInputExceptionTest.java b/unitTests/exceptions/MyInputExceptionTest.java new file mode 100644 index 0000000..2c8a3b5 --- /dev/null +++ b/unitTests/exceptions/MyInputExceptionTest.java @@ -0,0 +1,22 @@ +package exceptions; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class MyInputExceptionTest { + + @Test + public final void testMyInputException() { + MyInputException exception = new MyInputException(); + assertNull(exception.getMessage()); + } + + @Test + public final void testMyInputExceptionString() { + String message = "A test message"; + MyInputException exception = new MyInputException(message); + assertEquals(message, exception.getMessage()); + } + +}