Skip to content

Commit

Permalink
create branch plus test
Browse files Browse the repository at this point in the history
  • Loading branch information
zlukich committed Mar 20, 2024
1 parent ab8d662 commit 25e4d2e
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 5 deletions.
37 changes: 32 additions & 5 deletions src/test/java/org/matsim/run/RunIntegrationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,17 @@
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.matsim.application.MATSimApplication;
import org.matsim.core.config.Config;
import org.matsim.core.config.ConfigUtils;
import org.matsim.core.controler.OutputDirectoryHierarchy;
import org.matsim.core.events.EventsUtils;
import org.matsim.simwrapper.SimWrapperConfigGroup;
import org.matsim.testcases.MatsimTestUtils;
import org.matsim.utils.eventsfilecomparison.ComparisonResult;

import java.io.File;

import static org.assertj.core.api.Assertions.assertThat;

public class RunIntegrationTest {

Expand All @@ -13,11 +23,28 @@ public class RunIntegrationTest {
@Test
public void runScenario() {

assert MATSimApplication.execute(LausitzScenario.class,
"--1pct",
"--iterations", "1",
"--output", utils.getOutputDirectory(),
"--config:controller.overwriteFiles=deleteDirectoryIfExists") == 0 : "Must return non error code";
String output = utils.getOutputDirectory();

Config config = ConfigUtils.loadConfig("input/v1.0/lausitz-v1.0-25pct.config.xml");

config.global().setNumberOfThreads(1);
config.qsim().setNumberOfThreads(1);
config.controller().setLastIteration(1);
config.controller().setOverwriteFileSetting(OutputDirectoryHierarchy.OverwriteFileSetting.deleteDirectoryIfExists);
config.controller().setOutputDirectory(output);

ConfigUtils.addOrGetModule(config, SimWrapperConfigGroup.class).defaultDashboards = SimWrapperConfigGroup.Mode.disabled;


MATSimApplication.execute(LausitzScenario.class, config, "run", "--1pct"
);


EventsUtils.assertEqualEventsFingerprint(
new File(utils.getOutputDirectory(), "lausitz-1pct.output_events.xml.gz"),
new File(utils.getInputDirectory(), "lausitz-1pct.output_events.fp.zst").toString()
);


}
}
Binary file not shown.

0 comments on commit 25e4d2e

Please sign in to comment.