-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into feature/rajas-of-asia-support
- Loading branch information
Showing
15 changed files
with
166 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule Fronter.NET
updated
8 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using commonItems; | ||
using Xunit; | ||
|
||
namespace ImperatorToCK3.UnitTests.CK3.Cultures; | ||
|
||
public class NameListTests { | ||
[Fact] | ||
public void NameListIsCorrectlyLoaded() { | ||
var reader = new BufferedReader(""" | ||
{ | ||
male_names = { | ||
John | ||
"Alexander" | ||
2 = { Tom "Mark" } | ||
} | ||
female_names = { | ||
Jane | ||
"Alexandra" | ||
2 = { Sandra "Maria" } | ||
} | ||
"""); | ||
var nameList = new ImperatorToCK3.CK3.Cultures.NameList("test", reader); | ||
|
||
Assert.Equal("test", nameList.Id); | ||
Assert.Collection(nameList.MaleNames, | ||
item => Assert.Equal("John", item), | ||
item => Assert.Equal("Alexander", item), | ||
item => Assert.Equal("Tom", item), | ||
item => Assert.Equal("Mark", item) | ||
); | ||
Assert.Collection(nameList.FemaleNames, | ||
item => Assert.Equal("Jane", item), | ||
item => Assert.Equal("Alexandra", item), | ||
item => Assert.Equal("Sandra", item), | ||
item => Assert.Equal("Maria", item) | ||
); | ||
} | ||
} |
102 changes: 102 additions & 0 deletions
102
ImperatorToCK3.UnitTests/Imperator/Diplomacy/DiplomacyDBTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
using commonItems; | ||
using System; | ||
using System.IO; | ||
using Xunit; | ||
|
||
namespace ImperatorToCK3.UnitTests.Imperator.Diplomacy; | ||
|
||
[Collection("Sequential")] | ||
[CollectionDefinition("Sequential", DisableParallelization = true)] | ||
public class DiplomacyDBTests { | ||
[Fact] | ||
public void WarWithNoAttackersIsSkipped() { | ||
var output = new StringWriter(); | ||
Console.SetOut(output); | ||
|
||
var reader = new BufferedReader(""" | ||
database = { | ||
1 = { previous=no } | ||
2 = { previous=no defender=1 } | ||
} | ||
"""); | ||
var diplomacy = new ImperatorToCK3.Imperator.Diplomacy.DiplomacyDB(reader); | ||
|
||
Assert.Empty(diplomacy.Wars); | ||
var logStr = output.ToString(); | ||
Assert.Contains("[DEBUG] Skipping war 1 has no attackers!", logStr); | ||
Assert.Contains("[DEBUG] Skipping war 2 has no attackers!", logStr); | ||
} | ||
|
||
[Fact] | ||
public void WarWithNoDefendersIsSkipped() { | ||
var output = new StringWriter(); | ||
Console.SetOut(output); | ||
|
||
var reader = new BufferedReader(""" | ||
database = { | ||
1 = { previous=no attacker=1 } | ||
} | ||
"""); | ||
var diplomacy = new ImperatorToCK3.Imperator.Diplomacy.DiplomacyDB(reader); | ||
|
||
Assert.Empty(diplomacy.Wars); | ||
var logStr = output.ToString(); | ||
Assert.Contains("[DEBUG] Skipping war 1 has no defenders!", logStr); | ||
} | ||
|
||
[Fact] | ||
public void WarWithNoWarGoalIsSkipped() { | ||
var output = new StringWriter(); | ||
Console.SetOut(output); | ||
|
||
var reader = new BufferedReader(""" | ||
database = { | ||
1 = { previous=no attacker=1 defender=2 } | ||
} | ||
"""); | ||
var diplomacy = new ImperatorToCK3.Imperator.Diplomacy.DiplomacyDB(reader); | ||
|
||
Assert.Empty(diplomacy.Wars); | ||
var logStr = output.ToString(); | ||
Assert.Contains("[WARN] Skipping war 1 with no wargoal!", logStr); | ||
} | ||
|
||
[Fact] | ||
public void PreviousWarsAreSkipped() { | ||
var reader = new BufferedReader("database = { 1 = { previous=yes } }"); | ||
var diplomacy = new ImperatorToCK3.Imperator.Diplomacy.DiplomacyDB(reader); | ||
|
||
Assert.Empty(diplomacy.Wars); | ||
} | ||
|
||
[Fact] | ||
public void WarCanBeLoaded() { | ||
var reader = new BufferedReader(""" | ||
database = { | ||
1 = { | ||
attacker=1 defender=2 start_date=1.1.1 take_province={ type="conquer_wargoal" state=3 } | ||
} | ||
} | ||
"""); | ||
var diplomacy = new ImperatorToCK3.Imperator.Diplomacy.DiplomacyDB(reader); | ||
|
||
Assert.Single(diplomacy.Wars); | ||
Assert.Equal(new Date("1.1.1", AUC: true), diplomacy.Wars[0].StartDate); | ||
Assert.Equal((ulong)1, diplomacy.Wars[0].AttackerCountryIds[0]); | ||
Assert.Equal((ulong)2, diplomacy.Wars[0].DefenderCountryIds[0]); | ||
Assert.Equal("conquer_wargoal", diplomacy.Wars[0].WarGoal); | ||
Assert.Equal((ulong)3, diplomacy.Wars[0].TargetedStateId); | ||
} | ||
|
||
[Fact] | ||
public void DependencyCanBeLoaded() { | ||
var reader = new BufferedReader("dependency = { first=1 second=2 start_date=1.1.1 subject_type=tributary }"); | ||
var diplomacy = new ImperatorToCK3.Imperator.Diplomacy.DiplomacyDB(reader); | ||
|
||
Assert.Single(diplomacy.Dependencies); | ||
Assert.Equal((ulong)1, diplomacy.Dependencies[0].OverlordId); | ||
Assert.Equal((ulong)2, diplomacy.Dependencies[0].SubjectId); | ||
Assert.Equal(new Date("1.1.1", AUC: true), diplomacy.Dependencies[0].StartDate); | ||
Assert.Equal("tributary", diplomacy.Dependencies[0].SubjectType); | ||
} | ||
} |
31 changes: 0 additions & 31 deletions
31
ImperatorToCK3.UnitTests/Imperator/Diplomacy/DiplomacyTests.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file renamed
BIN
+3.48 MB
.../rakaly-0.5.3-aarch64-apple-darwin/rakaly → .../rakaly-0.5.4-aarch64-apple-darwin/rakaly
Binary file not shown.
Binary file renamed
BIN
+3.58 MB
...y-0.5.3-x86_64-pc-windows-msvc/rakaly.exe → ...y-0.5.4-x86_64-pc-windows-msvc/rakaly.exe
Binary file not shown.
Binary file renamed
BIN
+3.67 MB
...ly-0.5.3-x86_64-unknown-linux-musl/rakaly → ...ly-0.5.4-x86_64-unknown-linux-musl/rakaly
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters