コード例 #1
0
        public void TaskFileReader1()
        {
            var fileName        = Path.Join(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "Task1Import.txt");
            var resultReadInDto = TaskFileReader.ReadInTasksFromFile(fileName);
            var taskSet         = resultReadInDto.tasks;

            Assert.Equal(taskSet.Count, 3);
            Assert.Equal(taskSet[0].ExecutionTime, 20);
            Assert.Equal(taskSet[0].Period, 70);
            Assert.Equal(taskSet[0].Deadline, 50);
            Assert.Equal(taskSet[0].StaticPriority, 3);
            Assert.Equal(taskSet[0].DynamicPriority, 3);


            Assert.Equal(taskSet[1].ExecutionTime, 20);
            Assert.Equal(taskSet[1].Period, 80);
            Assert.Equal(taskSet[1].Deadline, 80);
            Assert.Equal(taskSet[1].StaticPriority, 2);
            Assert.Equal(taskSet[1].DynamicPriority, 3);

            Assert.Equal(taskSet[2].ExecutionTime, 35);
            Assert.Equal(taskSet[2].Period, 200);
            Assert.Equal(taskSet[2].Deadline, 100);
            Assert.Equal(taskSet[2].StaticPriority, 1);
            Assert.Equal(taskSet[2].DynamicPriority, 2);


            var isScheduable = ResponseTimeAnalysis.FeasibilityUsingResponseTimeAnalysis(taskSet);
            var exist        = ResponseTimeAnalysis.DoesFeasibleScheduleExist(taskSet);

            Assert.Equal(isScheduable, exist);
            Assert.True(isScheduable);
        }
コード例 #2
0
        public void PreemptionDeadline()
        {
            var fileName        = Path.Join(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "Task2Import.txt");
            var resultReadInDto = TaskFileReader.ReadInTasksFromFile(fileName);
            var taskSet         = resultReadInDto.tasks;

            ResponseTimeAnalysis.ChangeDynamicPrioritiesToMeetDeadlines(taskSet);
            var isScheduleable = ResponseTimeAnalysis.FeasibilityUsingResponseTimeAnalysis(taskSet);
            var exist          = ResponseTimeAnalysis.DoesFeasibleScheduleExist(taskSet);

            Assert.Equal(isScheduleable, exist);
            Assert.True(isScheduleable);
        }