def testCalcSatSuccess(self): #without detour time r0 = Rider("R0", 0, 8, 24, 7.75, 20, -87.6333, 41.8996, -87.6764, 41.9012) r0.calcDetourTime(1) r0.calcPrice(1) r0.calcSat() self.assertAlmostEqual(1.592, r0.getSat(), delta=0.01) #with detour time r0 = Rider("R0", 0, 8, 24, 7.75, 20, -87.6333, 41.8996, -87.6764, 41.9012) r0.calcDetourTime(2) r0.calcPrice(1) r0.calcSat() self.assertAlmostEqual(1.518, r0.getSat(), delta=0.01)
def testConstructor(self): r1 = Rider("R1", 0, 7, 6, 10, 20, 1, 1, 2, 1) self.assertEqual("R1", r1.getID()) self.assertEqual(0, r1.getRequestTimeStamp()) self.assertEqual(7, r1.getSrcZone()) self.assertEqual(6, r1.getDestZone()) self.assertEqual(10, r1.getDefaultPrice()) self.assertEqual(math.inf, r1.getPrice()) self.assertEqual(20, r1.getPatience()) self.assertEqual(1, r1.getShortestTime()) self.assertEqual(None, r1.getArrivalTimestamp()) self.assertEqual(None, r1.getGroupID()) self.assertEqual("waiting", r1.getStatus()) self.assertEqual(0, r1.getWaitTime()) self.assertEqual(-1, r1.getDetourTime()) self.assertEqual(0, r1.getSat()) self.assertEqual( "{R1, 0, 7, 6, 10, inf, 20, 6, 1, None, None, waiting, 0, -1, 0}", str(r1))