def setUp(self): super(StrategyEvaluatorTestCase, self).setUp() scheduler = SchedulerFactory.getScheduler("FiFo", timeslice=10) scheduler.initialize("A") scheduler.run() self.evaluator = StrategyEvaluator()
class StrategyEvaluatorComplexTestCase(FiFoScenario2): def setUp(self): super(StrategyEvaluatorComplexTestCase, self).setUp() scheduler = SchedulerFactory.getScheduler("FiFo", timeslice=10) scheduler.initialize("A") scheduler.run() self.evaluator = StrategyEvaluator() def test_getAverageCPUusage(self): cpu_usage = self.evaluator.getAverageCPUusage() self.assertEqual(cpu_usage, 1.0) def test_getPeriodDuration(self): periodDuration = self.evaluator.getPeriodDuration() self.assertEqual(periodDuration, 40) def test_getMeanResponseTime(self): meanRT = self.evaluator.getMeanResponseTime() self.assertEqual(meanRT, 7.5)
class StrategyEvaluatorTestCase(SimpleFiFoScenario): def setUp(self): super(StrategyEvaluatorTestCase, self).setUp() scheduler = SchedulerFactory.getScheduler("FiFo", timeslice=10) scheduler.initialize("A") scheduler.run() self.evaluator = StrategyEvaluator() def test_averageCPUusage(self): expected = 30.0 / 35.0 # remeber: at least one value has to be a float! avg_usage = self.evaluator.getAverageCPUusage() self.assertEqual(avg_usage, expected) def test_PeriodDuration(self): duration = self.evaluator.getPeriodDuration() self.assertEqual(duration, 35) def test_getMeanResponseTime(self): # in this case, the mean response time is 0 mean_r = self.evaluator.getMeanResponseTime() self.assertEqual(mean_r, 0.0)