Skip to content

Commit 245a9a7

Browse files
Clean up tests, improve and test size estimation
1 parent 6f73d3e commit 245a9a7

6 files changed

Lines changed: 39 additions & 380 deletions

File tree

CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ Each section defines a `Magic` constant used for validation. Useful for debuggin
135135

136136
## Testing
137137

138-
Tests use `MockExternalData` which provides hardcoded stat/item info for common test cases. For full integration testing, use `TxtFileExternalData` with real game data.
138+
All tests use `TxtFileExternalData.Default` which provides embedded stat/item info for versions 96, 97, and 99. For modded saves, use a custom `TxtFileExternalData` instance loaded from mod-specific .txt files.
139139

140140
Round-trip tests verify that read -> write produces identical bytes.
141141

SupportOlderVersions.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,6 @@ These require careful implementation of the bit packing/unpacking logic. See dis
462462
| `src/D2SSharp/Data/TxtFileExternalData.cs` | Parse 1.09 columns |
463463
| `src/D2SSharp/Model/Item.cs` | Version-aware stat reading/writing |
464464
| `src/D2SSharp/Enums/StatId.cs` | Optional: legacy paired stats helper |
465-
| `src/D2SSharp.Tests/Mocks/MockExternalData.cs` | Update to return 1.09 columns |
466465

467466
---
468467

src/D2SSharp.Tests/ConversionBinaryTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ private int CompareSections(string name1, byte[] data1, uint version1,
146146
int size1 = pos1 - prev1;
147147
int size2 = pos2 - prev2;
148148
int diff = size2 - size1;
149-
string diffStr = diff == 0 ? "=" : (diff > 0 ? $"+{diff}" : diff.ToString());
149+
string diffStr = diff == 0 ? "=" : diff > 0 ? $"+{diff}" : diff.ToString();
150150

151151
bool sizeMatch = size1 == size2;
152152
bool contentMatch = false;
@@ -184,9 +184,9 @@ private int CompareSections(string name1, byte[] data1, uint version1,
184184
if (section1[j] != section2[j])
185185
{
186186
string ignoreReason = isIgnored
187-
? (sectionName == "Items"
187+
? sectionName == "Items"
188188
? " (ignored: items compared separately, ordering may differ)"
189-
: " (ignored: checksum differs due to item ordering)")
189+
: " (ignored: checksum differs due to item ordering)"
190190
: "";
191191
_output.WriteLine($" ^ First diff at offset {j}: 0x{section1[j]:X2} vs 0x{section2[j]:X2}{ignoreReason}");
192192
break;

src/D2SSharp.Tests/Mocks/MockExternalData.cs

Lines changed: 0 additions & 355 deletions
This file was deleted.

0 commit comments

Comments
 (0)