Skip to content

Commit

Permalink
test(Cloak): add Ctl and Dat tests
Browse files Browse the repository at this point in the history
  • Loading branch information
matigramirez committed Oct 9, 2023
1 parent d4ff93b commit c042289
Show file tree
Hide file tree
Showing 9 changed files with 76 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/Parsec.Tests/Parsec.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -773,5 +773,26 @@
<None Update="Shaiya\3DC\Demf_Mentle002_L.3DC">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Shaiya\Cloak\CLOTH_TEXTHRE_DE.CTL">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Shaiya\Cloak\CLOTH_TEXTHRE_EL.CTL">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Shaiya\Cloak\CLOTH_TEXTHRE_HU.CTL">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Shaiya\Cloak\CLOTH_TEXTHRE_VI.CTL">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Shaiya\Cloak\EmblemBack.dat">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Shaiya\Cloak\EmblemFront.dat">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Shaiya\Cloak\EmblemList.dat">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
55 changes: 55 additions & 0 deletions tests/Parsec.Tests/Shaiya/Cloak/CloakTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
namespace Parsec.Tests.Shaiya.Cloak;

public class CloakTests
{
[Theory]
[InlineData("CLOTH_TEXTHRE_DE.CTL")]
[InlineData("CLOTH_TEXTHRE_EL.CTL")]
[InlineData("CLOTH_TEXTHRE_HU.CTL")]
[InlineData("CLOTH_TEXTHRE_VI.CTL")]
public void CtlReadWriteTest(string fileName)
{
var filePath = $"Shaiya/Cloak/{fileName}";
var jsonPath = $"Shaiya/Cloak/{fileName}.json";
var newObjPath = $"Shaiya/Cloak/new_{fileName}";

var obj = ParsecReader.FromFile<Parsec.Shaiya.Cloak.ClothTexture.Ctl>(filePath);

obj.WriteJson(jsonPath);
var objFromJson = ParsecReader.FromJsonFile<Parsec.Shaiya.Cloak.ClothTexture.Ctl>(jsonPath);

// Check bytes
Assert.Equal(obj.GetBytes(), objFromJson.GetBytes());

objFromJson.Write(newObjPath);
var newObj = ParsecReader.FromFile<Parsec.Shaiya.Cloak.ClothTexture.Ctl>(newObjPath);

// Check bytes
Assert.Equal(obj.GetBytes(), newObj.GetBytes());
}

[Theory]
[InlineData("EmblemBack.dat")]
[InlineData("EmblemFront.dat")]
[InlineData("EmblemList.dat")]
public void EmblemDatReadWriteTest(string fileName)
{
var filePath = $"Shaiya/Cloak/{fileName}";
var jsonPath = $"Shaiya/Cloak/{fileName}.json";
var newObjPath = $"Shaiya/Cloak/new_{fileName}";

var obj = ParsecReader.FromFile<Parsec.Shaiya.Cloak.Emblem.EmblemDat>(filePath);

obj.WriteJson(jsonPath);
var objFromJson = ParsecReader.FromJsonFile<Parsec.Shaiya.Cloak.Emblem.EmblemDat>(jsonPath);

// Check bytes
Assert.Equal(obj.GetBytes(), objFromJson.GetBytes());

objFromJson.Write(newObjPath);
var newObj = ParsecReader.FromFile<Parsec.Shaiya.Cloak.Emblem.EmblemDat>(newObjPath);

// Check bytes
Assert.Equal(obj.GetBytes(), newObj.GetBytes());
}
}
Binary file added tests/Parsec.Tests/Shaiya/Cloak/EmblemBack.dat
Binary file not shown.
Binary file added tests/Parsec.Tests/Shaiya/Cloak/EmblemFront.dat
Binary file not shown.
Binary file added tests/Parsec.Tests/Shaiya/Cloak/EmblemList.dat
Binary file not shown.

0 comments on commit c042289

Please sign in to comment.