-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/ME3Tweaks/Wwiser.NET
- Loading branch information
Showing
26 changed files
with
380 additions
and
46 deletions.
There are no files selected for viewing
Submodule BinarySerializer
updated
from 560031 to 40691b
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
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
39 changes: 39 additions & 0 deletions
39
ME3Tweaks.Wwiser.Tests/FormatTests/BankHeaderPaddingTests.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,39 @@ | ||
namespace ME3Tweaks.Wwiser.Tests.FormatTests; | ||
|
||
public class BankHeaderPaddingTests | ||
{ | ||
[TestCase(8)] | ||
[TestCase(24)] | ||
[TestCase(0x158)] | ||
public void DataProperlyAligned_PaddingIsZero(long dataOffset) | ||
{ | ||
var padding = new BankHeaderPadding(); | ||
padding.SetPadding(dataOffset); | ||
|
||
Assert.That(padding.Padding.Length, Is.EqualTo(0)); | ||
} | ||
|
||
[TestCase(0, 8)] | ||
[TestCase(4, 4)] | ||
[TestCase(33, 7)] | ||
public void DataNotAligned_PaddingAlignsProperly(long dataOffset, long expectedPadding) | ||
{ | ||
var padding = new BankHeaderPadding(); | ||
padding.SetPadding(dataOffset); | ||
|
||
Assert.That(padding.Padding.Length, Is.LessThanOrEqualTo(8)); | ||
Assert.That(padding.Padding.Length, Is.EqualTo(expectedPadding)); | ||
} | ||
|
||
[TestCase(15, 9)] | ||
[TestCase(12, 12)] | ||
[TestCase(0x15E, 10)] | ||
public void DataNotAligned_PaddingProperlyOffsetBy8(long dataOffset, long expectedPadding) | ||
{ | ||
var padding = new BankHeaderPadding(); | ||
padding.SetPadding(dataOffset); | ||
|
||
Assert.That(padding.Padding.Length, Is.GreaterThan(8)); | ||
Assert.That(padding.Padding.Length, Is.EqualTo(expectedPadding)); | ||
} | ||
} |
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
16 changes: 16 additions & 0 deletions
16
ME3Tweaks.Wwiser.Tests/HierarchyTests/SwitchContainerTests.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,16 @@ | ||
using ME3Tweaks.Wwiser.Model.Hierarchy; | ||
|
||
namespace ME3Tweaks.Wwiser.Tests.HierarchyTests; | ||
|
||
public class SwitchContainerTests | ||
{ | ||
[TestCase("SwitchContainer_V56.bin", 56)] | ||
public void SwitchContainer_Reserializes(string filename, int version) | ||
{ | ||
var data = TestData.GetTestDataBytes(@"Hierarchy",@"SwitchContainer", filename); | ||
var (_, result) = TestHelpers.Deserialize<SwitchContainer>(data, version); | ||
|
||
var reserialized = TestHelpers.Serialize(result, version); | ||
Assert.That(reserialized, Is.EquivalentTo(data)); | ||
} | ||
} |
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 added
BIN
+175 Bytes
ME3Tweaks.Wwiser.Tests/TestData/Hierarchy/SwitchContainer/SwitchContainer_V56.bin
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
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
Oops, something went wrong.