Some work on tests & metadata

This commit is contained in:
Caleb J. Gardner
2026-01-15 06:56:43 -06:00
parent 428f938c3a
commit ed14f13d9a
2 changed files with 27 additions and 3 deletions
+20 -1
View File
@@ -1,8 +1,27 @@
const std = @import("std");
const stuff = @import("builtin");
test "Basics" {}
const Archive = @import("archive.zig");
const Superblock = @import("super.zig");
const TestArchive = "testing/LinuxPATest.sfs";
test "Basics" {
var fil = try std.fs.cwd().openFile(TestArchive);
defer fil.close();
var sfs: Archive = try .init(std.testing.allocator, fil);
defer sfs.deinit();
}
const TestFile = "Start.exe";
const TestFileExtractLocation = "testing/Start.exe";
test "ExtractSingleFile" {}
const TestFullExtractLocation = "testing/TestExtract";
test "ExtractCompleteArchive" {}
const CorrectSuperblock = Superblock{
.magic = "hsqs",
};
+7 -2
View File
@@ -14,6 +14,7 @@ decomp: *DecompMgr,
buf: [8192]u8 = undefined,
interface: Reader,
err: anyerror = 0,
pub fn init(rdr: Reader, decomp: *DecompMgr) This {
return .{
@@ -23,12 +24,16 @@ pub fn init(rdr: Reader, decomp: *DecompMgr) This {
.buffer = &[0]u8{},
.end = 0,
.seek = 0,
.vtable = &{
.vtable = &.{
.stream = stream,
},
},
};
}
fn stream(rdr: *Reader, wrt: *Writer, limit: Limit) StreamError!usize{
fn advance(self: *This) !void {}
fn stream(rdr: *Reader, wrt: *Writer, limit: Limit) StreamError!usize {
const this: *This = @fieldParentPtr("interface", rdr);
if (rdr.end == rdr.seek) try this.advance();
}