-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
170 additions
and
7 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
IntelOrca.Biohazard.Tests/IntelOrca.Biohazard.Tests.csproj
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,21 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<TargetFramework>net472</TargetFramework> | ||
<IsPackable>false</IsPackable> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" /> | ||
<PackageReference Include="xunit" Version="2.4.1" /> | ||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3"> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> | ||
<PackageReference Include="coverlet.collector" Version="3.1.2"> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\IntelOrca.Biohazard\IntelOrca.Biohazard.csproj" /> | ||
</ItemGroup> | ||
</Project> |
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,132 @@ | ||
using System; | ||
using System.IO; | ||
using IntelOrca.Biohazard.RE1; | ||
using IntelOrca.Biohazard.RE2; | ||
using Xunit; | ||
|
||
namespace IntelOrca.Biohazard.Tests | ||
{ | ||
public class TestRE1Rando : TestBaseRandomizer | ||
{ | ||
public override byte Game => 1; | ||
} | ||
|
||
public class TestRE2Rando : TestBaseRandomizer | ||
{ | ||
public override byte Game => 2; | ||
} | ||
|
||
public abstract class TestBaseRandomizer | ||
{ | ||
public abstract byte Game { get; } | ||
|
||
[Fact] | ||
public void RandomizeDoors() | ||
{ | ||
var config = GetBaseConfig(); | ||
config.RandomDoors = true; | ||
Randomize(config); | ||
} | ||
|
||
[Fact] | ||
public void RandomizeItems_Shuffle() | ||
{ | ||
var config = GetBaseConfig(); | ||
config.RandomDoors = false; | ||
config.AlternativeRoutes = false; | ||
config.ShuffleItems = true; | ||
Randomize(config); | ||
} | ||
|
||
[Fact] | ||
public void RandomizeItems_AlternativeRoutes() | ||
{ | ||
var config = GetBaseConfig(); | ||
config.RandomDoors = false; | ||
config.AlternativeRoutes = true; | ||
config.ShuffleItems = false; | ||
Randomize(config); | ||
} | ||
|
||
[Fact] | ||
public void RandomizeBGM() | ||
{ | ||
var config = GetBaseConfig(); | ||
config.RandomDoors = false; | ||
config.RandomItems = false; | ||
config.RandomEnemies = false; | ||
config.RandomNPCs = false; | ||
config.ChangePlayer = false; | ||
config.RandomBgm = true; | ||
Randomize(config); | ||
} | ||
|
||
protected void Randomize(RandoConfig config) | ||
{ | ||
var dataPath = Path.Combine(Environment.CurrentDirectory, "..", "..", "..", "..", "IntelOrca.Biohazard", "data"); | ||
Environment.SetEnvironmentVariable("BIORAND_DATA", dataPath); | ||
|
||
var reInstall = GetInstallConfig(); | ||
var rando = GetRandomizer(); | ||
rando.Generate(config, reInstall); | ||
} | ||
|
||
private BaseRandomiser GetRandomizer() | ||
{ | ||
return Game == 1 ? | ||
(BaseRandomiser)new Re1Randomiser() : | ||
(BaseRandomiser)new Re2Randomiser(); | ||
} | ||
|
||
private RandoConfig GetBaseConfig() | ||
{ | ||
var config = new RandoConfig(); | ||
config.Player = 0; | ||
config.GameVariant = 0; | ||
config.Game = Game; | ||
config.Seed = 12345; | ||
|
||
config.RandomDoors = false; | ||
config.AreaCount = 2; | ||
config.AreaSize = 4; | ||
|
||
config.RandomItems = true; | ||
config.IncludeDocuments = true; | ||
config.AlternativeRoutes = false; | ||
config.ProtectFromSoftLock = true; | ||
config.ShuffleItems = false; | ||
|
||
config.RandomEnemies = true; | ||
config.EnemyDifficulty = 2; | ||
|
||
config.IncludeNPCRE1 = true; | ||
config.IncludeNPCRE2 = true; | ||
config.IncludeNPCRE3 = true; | ||
config.IncludeNPCOther = true; | ||
|
||
if (config.Game == 2) | ||
{ | ||
config.ChangePlayer = true; | ||
config.Player0 = 0; | ||
config.Player1 = 0; | ||
} | ||
else | ||
{ | ||
config.ChangePlayer = false; | ||
} | ||
|
||
config.RandomBgm = false; | ||
return config; | ||
} | ||
|
||
private static ReInstallConfig GetInstallConfig() | ||
{ | ||
var reInstall = new ReInstallConfig(); | ||
reInstall.SetInstallPath(0, @"F:\games\re1"); | ||
reInstall.SetInstallPath(1, @"F:\games\re2"); | ||
reInstall.SetEnabled(0, true); | ||
reInstall.SetEnabled(1, true); | ||
return reInstall; | ||
} | ||
} | ||
} |
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