diff options
Diffstat (limited to 'tests/Rpf9DumpDiagnostics/Program.cs')
| -rw-r--r-- | tests/Rpf9DumpDiagnostics/Program.cs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/Rpf9DumpDiagnostics/Program.cs b/tests/Rpf9DumpDiagnostics/Program.cs index 69feefcb2..87e96b817 100644 --- a/tests/Rpf9DumpDiagnostics/Program.cs +++ b/tests/Rpf9DumpDiagnostics/Program.cs | |||
| @@ -103,12 +103,21 @@ Console.WriteLine("Mesh key tests passed."); | |||
| 103 | var pastEnd = Entry(new ArchiveSegment(32, file.Length, system.Length)); | 103 | var pastEnd = Entry(new ArchiveSegment(32, file.Length, system.Length)); |
| 104 | try { RecoveredResource.Read(path, pastEnd); Check(false, "block past the end is rejected"); } | 104 | try { RecoveredResource.Read(path, pastEnd); Check(false, "block past the end is rejected"); } |
| 105 | catch (InvalidDataException) { } | 105 | catch (InvalidDataException) { } |
| 106 | var overflow = Entry(new ArchiveSegment(32, long.MaxValue, system.Length)); | ||
| 107 | try { RecoveredResource.Read(path, overflow); Check(false, "an overflowing block size is rejected"); } | ||
| 108 | catch (InvalidDataException) { } | ||
| 106 | // A raw block reads its own bytes; the 6-byte minimum is the smallest block the recovery step records. | 109 | // A raw block reads its own bytes; the 6-byte minimum is the smallest block the recovery step records. |
| 107 | var shortRaw = Entry(new ArchiveSegment(32 + zblock.Length + 16, 8, 8) { IsRaw = true }); | 110 | var shortRaw = Entry(new ArchiveSegment(32 + zblock.Length + 16, 8, 8) { IsRaw = true }); |
| 108 | Check(RecoveredResource.Read(path, shortRaw).SequenceEqual(gfx[..8]), "a raw block reads its own bytes"); | 111 | Check(RecoveredResource.Read(path, shortRaw).SequenceEqual(gfx[..8]), "a raw block reads its own bytes"); |
| 109 | var tooSmall = Entry(new ArchiveSegment(32 + zblock.Length + 16, 4, 4) { IsRaw = true }); | 112 | var tooSmall = Entry(new ArchiveSegment(32 + zblock.Length + 16, 4, 4) { IsRaw = true }); |
| 110 | try { RecoveredResource.Read(path, tooSmall); Check(false, "a block under six bytes is rejected"); } | 113 | try { RecoveredResource.Read(path, tooSmall); Check(false, "a block under six bytes is rejected"); } |
| 111 | catch (InvalidDataException) { } | 114 | catch (InvalidDataException) { } |
| 115 | var rawLargerStored = Entry(new ArchiveSegment(32 + zblock.Length + 16, 16, 8) { IsRaw = true }); | ||
| 116 | try { RecoveredResource.Read(path, rawLargerStored); Check(false, "a raw block with StoredSize > Size is rejected"); } | ||
| 117 | catch (InvalidDataException) { } | ||
| 118 | var rawSmallerStored = Entry(new ArchiveSegment(32 + zblock.Length + 16, 8, 16) { IsRaw = true }); | ||
| 119 | try { RecoveredResource.Read(path, rawSmallerStored); Check(false, "a raw block with StoredSize < Size is rejected"); } | ||
| 120 | catch (InvalidDataException) { } | ||
| 112 | // An entry that records no blocks is rejected rather than returning an empty resource. | 121 | // An entry that records no blocks is rejected rather than returning an empty resource. |
| 113 | var oversize = new ArchiveEntry("recovered/models/x.r9modeldata", 1, 1, 32, false, false, false, "Recovered model", 0); | 122 | var oversize = new ArchiveEntry("recovered/models/x.r9modeldata", 1, 1, 32, false, false, false, "Recovered model", 0); |
| 114 | try { RecoveredResource.Read(path, oversize); Check(false, "an entry without blocks is rejected"); } | 123 | try { RecoveredResource.Read(path, oversize); Check(false, "an entry without blocks is rejected"); } |