upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/tests/Rpf9DumpDiagnostics/Program.cs
diff options
context:
space:
mode:
authorNotRexed <therealnothingfn@gmail.com>2026-12-01 07:52:21 -0500
committerNotRexed <therealnothingfn@gmail.com>2026-12-01 07:52:21 -0500
commitdd4829ecfc259eebc0e42e3f72d2d61911ee010e (patch)
tree607dabec0efef7e5fe71297e2c5f0b512b0859eb /tests/Rpf9DumpDiagnostics/Program.cs
parente12f7f9f9a82288ee0424be753d383eb3eb7843f (diff)
parent1723dec94510d0aa3d99e795f0a656970c1f00e9 (diff)
Merge remote-tracking branch 'origin/main' into push/main-1130
# Conflicts: # d3d12/docs/switches.md
Diffstat (limited to 'tests/Rpf9DumpDiagnostics/Program.cs')
-rw-r--r--tests/Rpf9DumpDiagnostics/Program.cs9
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"); }