Esempio 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)
Esempio n. 2
0
    def __init__(self):
        bathroom = Bathroom()
        bedroom = Kitchen()
        pantry = Pantry()

        self.rooms = [bathroom, bedroom, pantry]
Esempio 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())
Esempio n. 4
0
 def testSingleUrinalFree(self):
     urinals = [UrinalStatus.FREE]
     bathroom = Bathroom(urinals)
     self.assertEqual([0], bathroom.getUsableUrinals())
Esempio n. 5
0
    def testBathroomWithManyUrinalsFreeCenter(self):
        urinals = [UrinalStatus.BUSY] + ([UrinalStatus.FREE] * 3) + [UrinalStatus.BUSY]

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