Commit 5cd353c4 authored by Georgios Dagkakis's avatar Georgios Dagkakis

tests added for the Examples

parent bdbb59d0
......@@ -40,8 +40,95 @@ class SimulationExamples(TestCase):
self.assertEquals(result['parts'], 732)
self.assertTrue(78.17 < result["blockage_ratio"] < 78.18)
self.assertTrue(26.73 < result["working_ratio"] < 27.74)
def testAssemblyLine(self):
from dream.simulation.Examples.AssemblyLine import main
result = main()
self.assertEquals(result['frames'], 664)
self.assertTrue(92.36 < result["working_ratio"] < 93.37)
def testSingleServer(self):
from dream.simulation.Examples.SingleServer import main
result = main()
self.assertEquals(result['parts'], 2880)
self.assertTrue(49.99 < result["working_ratio"] < 50.01)
def testClearBatchLines(self):
from dream.simulation.Examples.ClearBatchLines import main
result = main()
self.assertEquals(result['batches'], 89)
self.assertTrue(0.069 < result["waiting_ratio_M1"] < 0.07)
self.assertTrue(0.104 < result["waiting_ratio_M2"] < 0.105)
self.assertTrue(93.81 < result["waiting_ratio_M3"] < 93.82)
def testDecompositionOfBatches(self):
from dream.simulation.Examples.DecompositionOfBatches import main
result = main()
self.assertEquals(result['subbatches'], 2303)
self.assertTrue(79.96 < result["working_ratio"] < 79.97)
self.assertEquals(result["blockage_ratio"] , 0.0)
self.assertTrue(20.03 < result["waiting_ratio"] < 20.04)
def testSerialBatchProcessing(self):
from dream.simulation.Examples.SerialBatchProcessing import main
result = main()
self.assertEquals(result['batches'], 359)
self.assertTrue(0.104 < result["waiting_ratio_M1"] < 0.105)
self.assertTrue(0.104 < result["waiting_ratio_M2"] < 0.105)
self.assertTrue(75.06 < result["waiting_ratio_M3"] < 75.07)
def testJobShop1(self):
from dream.simulation.Examples.JobShop1 import main
result = main()
expectedResult=[['Queue1', 0], ['Machine1', 0], ['Queue3', 1.0], ['Machine3', 1.0], ['Queue2', 4.0], ['Machine2', 4.0], ['Exit', 6.0]]
self.assertEquals(result, expectedResult)
def testJobShop2EDD(self):
from dream.simulation.Examples.JobShop2EDD import main
result = main()
expectedResult=[['Queue1', 0], ['Machine1', 2.0], ['Queue3', 3.0], ['Machine3', 3.0], ['Queue2', 6.0], ['Machine2', 6.0], ['Exit', 8.0], \
['Queue1', 0], ['Machine1', 0], ['Queue2', 2.0], ['Machine2', 2.0], ['Queue3', 6.0], ['Machine3', 6.0], ['Exit', 12.0], ['Queue1', 0], \
['Machine1', 3.0], ['Queue3', 13.0], ['Machine3', 13.0], ['Exit', 16.0]]
self.assertEquals(result, expectedResult)
def testJobShop2MC(self):
from dream.simulation.Examples.JobShop2MC import main
result = main()
expectedResult=[['Queue1', 0], ['Machine1', 12.0], ['Queue3', 13.0], ['Machine3', 13.0], ['Queue2', 16.0], \
['Machine2', 16.0], ['Exit', 18.0], ['Queue1', 0], ['Machine1', 10.0], ['Queue2', 12.0], ['Machine2', 12.0], \
['Queue3', 16.0], ['Machine3', 16.0], ['Exit', 22.0], ['Queue1', 0], ['Machine1', 0], ['Queue3', 10.0], ['Machine3', 10.0], ['Exit', 13.0]]
self.assertEquals(result, expectedResult)
def testJobShop2Priority(self):
from dream.simulation.Examples.JobShop2Priority import main
result = main()
expectedResult=[['Queue1', 0], ['Machine1', 10.0], ['Queue3', 11.0], ['Machine3', 13.0], ['Queue2', 16.0], \
['Machine2', 17.0], ['Exit', 19.0], ['Queue1', 0], ['Machine1', 11.0], ['Queue2', 13.0], ['Machine2', 13.0], ['Queue3', 17.0], \
['Machine3', 17.0], ['Exit', 23.0], ['Queue1', 0], ['Machine1', 0], ['Queue3', 10.0], ['Machine3', 10.0], ['Exit', 13.0]]
self.assertEquals(result, expectedResult)
def testJobShop2RPC(self):
from dream.simulation.Examples.JobShop2RPC import main
result = main()
expectedResult=[['Queue1', 0], ['Machine1', 12.0], ['Queue3', 13.0], ['Machine3', 13.0], ['Queue2', 16.0], \
['Machine2', 16.0], ['Exit', 18.0], ['Queue1', 0], ['Machine1', 10.0], ['Queue2', 12.0], ['Machine2', 12.0], ['Queue3', 16.0], \
['Machine3', 16.0], ['Exit', 22.0], ['Queue1', 0], ['Machine1', 0], ['Queue3', 10.0], ['Machine3', 10.0], ['Exit', 13.0]]
self.assertEquals(result, expectedResult)
def testParallelServers1(self):
from dream.simulation.Examples.ParallelServers1 import main
result = main()
self.assertEquals(result['parts'], 2880)
self.assertTrue(23.09 < result["working_ratio_M1"] < 23.1)
self.assertTrue(26.9 < result["working_ratio_M2"] < 26.91)
#NOTE: testParallelServers3 is extension of testParallelServers2 so this test really tests if they both run
def testParallelServers3(self):
from dream.simulation.Examples.ParallelServers3 import main
result = main()
self.assertEquals(result['parts'], 2880)
self.assertTrue(46.18 < result["working_ratio_M1"] < 46.19)
self.assertTrue(3.81 < result["working_ratio_M2"] < 3.82)
self.assertEquals(result['NumM1'], 2660)
self.assertEquals(result['NumM2'], 220)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment