Commit 72d32bca by Michael Schmid

New tests

parent a9eacf10
......@@ -4,10 +4,8 @@ import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import java.util.HashSet;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import mvd.jester.model.Segment;
import mvd.jester.model.SystemSetup;
import mvd.jester.model.Task;
import mvd.jester.simulator.DynamicForkJoin;
......
package mvd.jester.tests;
import static org.junit.jupiter.api.Assertions.assertTrue;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import mvd.jester.info.SchedulingInfo;
import mvd.jester.info.TerminationInfo.Level;
import mvd.jester.model.SystemSetup;
import mvd.jester.priority.EarliestDeadlineFirst;
/**
* TestChwaLee
*/
public class TestChwaLee {
@Test
@DisplayName("Check if the schedulability check returns the correct values.")
public void testRunSchedulabilityCheck() {
{
SystemSetup systemSetup =
SystemSetup.readFromFile("src/test/resources/Taskset1.txt", 4);
ChwaLee cl = new ChwaLee(systemSetup);
SchedulingInfo schedulingInfo = cl.runSchedulabilityCheck(new EarliestDeadlineFirst());
assertTrue(schedulingInfo.getTerminationInfos().size() == 4);
assertTrue(schedulingInfo.checkLevelFail(Level.HIGH) == true);
assertTrue(schedulingInfo.checkTasksetFeasible() == false);
assertTrue(schedulingInfo.getFailedTerminationInfo().isPresent());
}
{
SystemSetup systemSetup =
SystemSetup.readFromFile("src/test/resources/Taskset1.txt", 8);
ChwaLee cl = new ChwaLee(systemSetup);
SchedulingInfo schedulingInfo = cl.runSchedulabilityCheck(new EarliestDeadlineFirst());
assertTrue(schedulingInfo.getTerminationInfos().size() == 4);
assertTrue(schedulingInfo.checkLevelFail(Level.HIGH) == true);
assertTrue(schedulingInfo.checkTasksetFeasible() == false);
assertTrue(schedulingInfo.getFailedTerminationInfo().isPresent());
}
{
SystemSetup systemSetup =
SystemSetup.readFromFile("src/test/resources/Taskset1.txt", 16);
ChwaLee cl = new ChwaLee(systemSetup);
SchedulingInfo schedulingInfo = cl.runSchedulabilityCheck(new EarliestDeadlineFirst());
assertTrue(schedulingInfo.getTerminationInfos().size() == 4);
assertTrue(schedulingInfo.checkLevelFail(Level.HIGH) == true);
assertTrue(schedulingInfo.checkTasksetFeasible() == false);
assertTrue(schedulingInfo.getFailedTerminationInfo().isPresent());
}
}
}
......@@ -20,9 +20,9 @@ public class TestSchmidMottok {
{
SystemSetup systemSetup =
SystemSetup.readFromFile("src/test/resources/Taskset1.txt", 4);
MaiaBertogna mb = new MaiaBertogna(systemSetup);
SchmidMottok sm = new SchmidMottok(systemSetup);
SchedulingInfo schedulingInfo = mb.runSchedulabilityCheck(new RateMonotonic());
SchedulingInfo schedulingInfo = sm.runSchedulabilityCheck(new RateMonotonic());
assertTrue(schedulingInfo.getTerminationInfos().size() == 4);
assertTrue(schedulingInfo.checkLevelFail(Level.HIGH) == true);
......@@ -32,9 +32,9 @@ public class TestSchmidMottok {
{
SystemSetup systemSetup =
SystemSetup.readFromFile("src/test/resources/Taskset1.txt", 8);
MaiaBertogna mb = new MaiaBertogna(systemSetup);
SchmidMottok sm = new SchmidMottok(systemSetup);
SchedulingInfo schedulingInfo = mb.runSchedulabilityCheck(new RateMonotonic());
SchedulingInfo schedulingInfo = sm.runSchedulabilityCheck(new RateMonotonic());
assertTrue(schedulingInfo.getTerminationInfos().size() == 4);
assertTrue(schedulingInfo.checkLevelFail(Level.HIGH) == true);
......@@ -44,9 +44,9 @@ public class TestSchmidMottok {
{
SystemSetup systemSetup =
SystemSetup.readFromFile("src/test/resources/Taskset1.txt", 16);
MaiaBertogna mb = new MaiaBertogna(systemSetup);
SchmidMottok sm = new SchmidMottok(systemSetup);
SchedulingInfo schedulingInfo = mb.runSchedulabilityCheck(new RateMonotonic());
SchedulingInfo schedulingInfo = sm.runSchedulabilityCheck(new RateMonotonic());
assertTrue(schedulingInfo.getTerminationInfos().size() == 4);
assertTrue(schedulingInfo.checkLevelFail(Level.HIGH) == false);
......
package mvd.jester.utils;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import com.google.common.io.Files;
import org.junit.Rule;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
import org.junit.rules.TemporaryFolder;
/**
* TestLogger
*/
public class TestLogger {
@TempDir
File tempDir;
@Test
@DisplayName("CHeck Logger")
void testLogger() throws IOException {
String fileName = tempDir.getAbsolutePath() + "/test.txt";
Logger logger = new Logger(fileName);
Logger failedLogger = new Logger(fileName);
Appendable out = new StringBuilder();
out.append("abc");
out.append("efg");
logger.log(out);
logger.finalize();
failedLogger.finalize();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment