Commit f16c3dd9 authored by Georgios Dagkakis's avatar Georgios Dagkakis

tests for the new examples

parent 73ecc520
...@@ -20,10 +20,10 @@ def main(): ...@@ -20,10 +20,10 @@ def main():
runSimulation(objectList, maxSimTime) runSimulation(objectList, maxSimTime)
#print the results #print the results
print "the system produced", E.numOfExits, "parts" print "the system produced", E.numOfExits, "batches"
working_ratio = (M.totalWorkingTime/maxSimTime)*100 working_ratio = (M.totalWorkingTime/maxSimTime)*100
print "the total working ratio of the Machine is", working_ratio, "%" print "the total working ratio of the Machine is", working_ratio, "%"
return {"parts": E.numOfExits, return {"batches": E.numOfExits,
"working_ratio": working_ratio} "working_ratio": working_ratio}
if __name__ == '__main__': if __name__ == '__main__':
......
...@@ -195,4 +195,23 @@ class SimulationExamples(TestCase): ...@@ -195,4 +195,23 @@ class SimulationExamples(TestCase):
result = main() result = main()
self.assertEquals(result['parts'], 10) self.assertEquals(result['parts'], 10)
self.assertEquals(result['simulationTime'], 36.0) self.assertEquals(result['simulationTime'], 36.0)
self.assertTrue(83.32 < result["working_ratio"] < 83.34) self.assertTrue(83.32 < result["working_ratio"] < 83.34)
\ No newline at end of file
def testSettingWip3(self):
from dream.simulation.Examples.SettingWip3 import main
result = main()
self.assertEquals(result['parts'], 2)
self.assertEquals(result['simulationTime'], 0.35)
self.assertEquals(result["working_ratio"], 100)
def testNonStarvingLine(self):
from dream.simulation.Examples.NonStarvingLine import main
result = main()
self.assertEquals(result['parts'], 9)
self.assertEquals(result["working_ratio"], 100)
def testNonStarvingLineBatches(self):
from dream.simulation.Examples.NonStarvingLineBatches import main
result = main()
self.assertEquals(result['batches'], 4)
self.assertEquals(result["working_ratio"], 100)
\ No newline at end of file
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