Ejemplo n.º 1
0
 def run():
     logging.basicConfig(format='%(threadName)s, %(asctime)s, %(message)s',
                         datefmt='%M:%S',
                         level=logging.DEBUG)
     num_of_stalls = int(input("Enter number of stalls "))
     num_of_users = int(input("Enter number of users "))
     bathroom = Bathroom(num_of_stalls)
     Main.enter_users_to_bathroom(num_of_users, bathroom)
Ejemplo n.º 2
0
    def __init__(self):
        bathroom = Bathroom()
        bedroom = Kitchen()
        pantry = Pantry()

        self.rooms = [bathroom, bedroom, pantry]
Ejemplo n.º 3
0
    def testBathroomWithManyUrinalsFreeAleatory(self):
        urinals = ([UrinalStatus.FREE] * 2) + [UrinalStatus.BUSY] + ([UrinalStatus.FREE] * 3) + ([UrinalStatus.BUSY] * 4) + ([UrinalStatus.FREE] * 4)
        #print urinals

        bathroom = Bathroom(urinals)
        self.assertEqual([0, 4, 11, 12, 13], bathroom.getUsableUrinals())
Ejemplo n.º 4
0
 def testSingleUrinalFree(self):
     urinals = [UrinalStatus.FREE]
     bathroom = Bathroom(urinals)
     self.assertEqual([0], bathroom.getUsableUrinals())
Ejemplo n.º 5
0
    def testBathroomWithManyUrinalsFreeCenter(self):
        urinals = [UrinalStatus.BUSY] + ([UrinalStatus.FREE] * 3) + [UrinalStatus.BUSY]

        bathroom = Bathroom(urinals)
        self.assertEqual([2], bathroom.getUsableUrinals())
Ejemplo n.º 6
0
 def testThreeUrinalsLastTwoFree(self):
     urinals = [UrinalStatus.BUSY] + [UrinalStatus.FREE] * 2
     bathroom = Bathroom(urinals)
     self.assertEqual([2], bathroom.getUsableUrinals())
Ejemplo n.º 7
0
 def testBathroomWithManyUrinalsFreeExtremes(self):
     urinals = [UrinalStatus.FREE] * 2 + [UrinalStatus.BUSY] + [UrinalStatus.FREE] * 2
     bathroom = Bathroom(urinals)
     self.assertEqual([0, 4], bathroom.getUsableUrinals())
Ejemplo n.º 8
0
 def testThreeUrinalsSecondFree(self):
     urinals = [UrinalStatus.BUSY, UrinalStatus.FREE, UrinalStatus.BUSY]
     bathroom = Bathroom(urinals)
     self.assertEqual([], bathroom.getUsableUrinals())
Ejemplo n.º 9
0
 def testThreeUrinalsThirdFree(self):
     urinals = [UrinalStatus.BUSY] * 2 + [UrinalStatus.FREE]
     bathroom = Bathroom(urinals)
     self.assertEqual([], bathroom.getUsableUrinals())
Ejemplo n.º 10
0
 def testThreeUrinalsAllBusy(self):
     urinals = [UrinalStatus.BUSY] * 3
     bathroom = Bathroom(urinals)
     self.assertEqual([], bathroom.getUsableUrinals())
Ejemplo n.º 11
0
 def testThreeUrinalsAllFree(self):
     urinals = [UrinalStatus.FREE] * 3
     bathroom = Bathroom(urinals)
     self.assertEqual([0, 1, 2], bathroom.getUsableUrinals())
Ejemplo n.º 12
0
 def testSingleUrinalFreeEmptyConstructor(self):
     bathroom = Bathroom()
     self.assertEqual([0], bathroom.getUsableUrinals())
Ejemplo n.º 13
0
 def testTwoUrinalsFirstFree(self):
     urinals = [UrinalStatus.FREE, UrinalStatus.BUSY]
     bathroom = Bathroom(urinals)
     self.assertEqual([], bathroom.getUsableUrinals())
Ejemplo n.º 14
0
 def testSingleUrinalBusy(self):
     urinals = [UrinalStatus.BUSY]
     bathroom = Bathroom(urinals)
     self.assertEqual([], bathroom.getUsableUrinals())