Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Garanas committed Jun 3, 2024
1 parent 96332c9 commit b3a95dc
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.jupiter.api.Assertions.*;
import static org.junit.jupiter.api.Assertions.assertEquals;

class LoadReplayLoaderTest {

Expand All @@ -41,6 +43,7 @@ public void parseBinary01() throws CompressorException, IOException {

assertNoUnprocessedTokens(fafReplayContainer);
assertNoErrorTokens(fafReplayContainer);
assertEquals("neroxis_map_generator_1.11.0_wvmzfgnlgiebu_bqgaeb3bgzldwstbaa", ReplaySemantics.getMapFolder(fafReplayContainer));

List<ChatMessage> chatMessages = ReplaySemantics.getChatMessages(fafReplayContainer.header().sources(), fafReplayContainer.registeredEvents());
assertEquals(106, chatMessages.size());
Expand All @@ -58,6 +61,7 @@ public void parseBinary02() throws CompressorException, IOException {

assertNoUnprocessedTokens(fafReplayContainer);
assertNoErrorTokens(fafReplayContainer);
assertEquals("SCMP_039", ReplaySemantics.getMapFolder(fafReplayContainer));

List<ChatMessage> chatMessages = ReplaySemantics.getChatMessages(fafReplayContainer.header().sources(), fafReplayContainer.registeredEvents());
assertEquals(2, chatMessages.size());
Expand All @@ -75,6 +79,7 @@ public void parseBinary03() throws CompressorException, IOException {

assertNoUnprocessedTokens(fafReplayContainer);
assertNoErrorTokens(fafReplayContainer);
assertEquals("dualgap_fix_adaptive.v0007", ReplaySemantics.getMapFolder(fafReplayContainer));

List<ChatMessage> chatMessages = ReplaySemantics.getChatMessages(fafReplayContainer.header().sources(), fafReplayContainer.registeredEvents());
assertEquals(1, chatMessages.size());
Expand All @@ -92,6 +97,7 @@ public void parseBinary04() throws CompressorException, IOException {

assertNoUnprocessedTokens(fafReplayContainer);
assertNoErrorTokens(fafReplayContainer);
assertEquals("SCMP_009", ReplaySemantics.getMapFolder(fafReplayContainer));

List<ChatMessage> chatMessages = ReplaySemantics.getChatMessages(fafReplayContainer.header().sources(), fafReplayContainer.registeredEvents());
assertEquals(7, chatMessages.size());
Expand All @@ -109,6 +115,7 @@ public void parseBinary05() throws CompressorException, IOException {

assertNoUnprocessedTokens(fafReplayContainer);
assertNoErrorTokens(fafReplayContainer);
assertEquals("SCMP_026", ReplaySemantics.getMapFolder(fafReplayContainer));

List<ChatMessage> chatMessages = ReplaySemantics.getChatMessages(fafReplayContainer.header().sources(), fafReplayContainer.registeredEvents());
assertEquals(0, chatMessages.size());
Expand All @@ -126,6 +133,7 @@ public void parseBinary06() throws CompressorException, IOException {

assertNoUnprocessedTokens(fafReplayContainer);
assertNoErrorTokens(fafReplayContainer);
assertEquals("SCMP_026", ReplaySemantics.getMapFolder(fafReplayContainer));

List<ChatMessage> chatMessages = ReplaySemantics.getChatMessages(fafReplayContainer.header().sources(), fafReplayContainer.registeredEvents());
assertEquals(0, chatMessages.size());
Expand All @@ -143,6 +151,7 @@ public void parseBinary07() throws CompressorException, IOException {

assertNoUnprocessedTokens(fafReplayContainer);
assertNoErrorTokens(fafReplayContainer);
assertEquals("SCMP_026", ReplaySemantics.getMapFolder(fafReplayContainer));

List<ChatMessage> chatMessages = ReplaySemantics.getChatMessages(fafReplayContainer.header().sources(), fafReplayContainer.registeredEvents());
assertEquals(3, chatMessages.size());
Expand All @@ -159,9 +168,14 @@ public void parseBinary08() throws CompressorException, IOException {
ReplayContainer fafReplayContainer = ReplayLoader.loadFAFReplayFromDisk(fafReplayFile);

assertEquals(2, fafReplayContainer.header().mods().size());
List<String> modUIDs = new ArrayList<>();
modUIDs.add("fnewm028-v096-55b4-92b6-64398e7ge43f");
modUIDs.add("d883189d-c556-4d68-b1c8-6ad201b3f7ad");
assertLinesMatch(modUIDs , ReplaySemantics.getModUIDs(fafReplayContainer));

assertNoUnprocessedTokens(fafReplayContainer);
assertNoErrorTokens(fafReplayContainer);
assertEquals("project_tumulus.v0004", ReplaySemantics.getMapFolder(fafReplayContainer));

List<ChatMessage> chatMessages = ReplaySemantics.getChatMessages(fafReplayContainer.header().sources(), fafReplayContainer.registeredEvents());
assertEquals(0, chatMessages.size());
Expand All @@ -180,10 +194,12 @@ public void compareBinary01() throws CompressorException, IOException {
ReplayContainer fafReplayContainer = ReplayLoader.loadFAFReplayFromDisk(fafReplayFile);
assertNoUnprocessedTokens(fafReplayContainer);
assertNoErrorTokens(fafReplayContainer);
assertEquals("SCMP_026", ReplaySemantics.getMapFolder(fafReplayContainer));

ReplayContainer scfaReplayContainer = ReplayLoader.loadSCFAReplayFromDisk(scfaReplayFile);
assertNoUnprocessedTokens(scfaReplayContainer);
assertNoErrorTokens(scfaReplayContainer);
assertEquals("SCMP_026", ReplaySemantics.getMapFolder(fafReplayContainer));

assertEquals(scfaReplayContainer.registeredEvents().size(), fafReplayContainer.registeredEvents().size());
assertArrayEquals( scfaReplayContainer.registeredEvents().toArray(), fafReplayContainer.registeredEvents().toArray());
Expand All @@ -200,10 +216,12 @@ public void compareBinary02() throws CompressorException, IOException {
ReplayContainer fafReplayContainer = ReplayLoader.loadFAFReplayFromDisk(fafReplayFile);
assertNoUnprocessedTokens(fafReplayContainer);
assertNoErrorTokens(fafReplayContainer);
assertEquals("open_palms_-_faf_version.v0002", ReplaySemantics.getMapFolder(fafReplayContainer));

ReplayContainer scfaReplayContainer = ReplayLoader.loadSCFAReplayFromDisk(scfaReplayFile);
assertNoUnprocessedTokens(scfaReplayContainer);
assertNoErrorTokens(scfaReplayContainer);
assertEquals("open_palms_-_faf_version.v0002", ReplaySemantics.getMapFolder(fafReplayContainer));

assertEquals(scfaReplayContainer.registeredEvents().size(), fafReplayContainer.registeredEvents().size());
assertArrayEquals( scfaReplayContainer.registeredEvents().toArray(), fafReplayContainer.registeredEvents().toArray());
Expand All @@ -221,10 +239,12 @@ public void compareBinary03() throws CompressorException, IOException {
ReplayContainer fafReplayContainer = ReplayLoader.loadFAFReplayFromDisk(fafReplayFile);
assertNoUnprocessedTokens(fafReplayContainer);
assertNoErrorTokens(fafReplayContainer);
assertEquals("SCMP_026", ReplaySemantics.getMapFolder(fafReplayContainer));

ReplayContainer scfaReplayContainer = ReplayLoader.loadSCFAReplayFromDisk(scfaReplayFile);
assertNoUnprocessedTokens(scfaReplayContainer);
assertNoErrorTokens(scfaReplayContainer);
assertEquals("SCMP_026", ReplaySemantics.getMapFolder(fafReplayContainer));

assertEquals(scfaReplayContainer.registeredEvents().size(), fafReplayContainer.registeredEvents().size());
assertArrayEquals( scfaReplayContainer.registeredEvents().toArray(), fafReplayContainer.registeredEvents().toArray());
Expand Down

0 comments on commit b3a95dc

Please sign in to comment.