| ... | ... | @@ -432,7 +432,7 @@ const HexWriter = struct { |
| 432 | 432 | } |
| 433 | 433 | } |
| 434 | 434 | |
| 435 | | fn getPayloadBytes(self: Record) []const u8 { |
| 435 | fn getPayloadBytes(self: *const Record) []const u8 { |
| 436 | 436 | return switch (self.payload) { |
| 437 | 437 | .Data => |d| d, |
| 438 | 438 | .EOF => @as([]const u8, &.{}), |
| ... | ... | @@ -518,6 +518,16 @@ fn padFile(f: File, opt_size: ?u64) !void { |
| 518 | 518 | try f.setEndPos(size); |
| 519 | 519 | } |
| 520 | 520 | |
| 521 | test "HexWriter.Record.Address has correct payload and checksum" { |
| 522 | const record = HexWriter.Record.Address(0x0800_0000); |
| 523 | const payload = record.getPayloadBytes(); |
| 524 | const sum = record.checksum(); |
| 525 | try std.testing.expect(sum == 0xF2); |
| 526 | try std.testing.expect(payload.len == 2); |
| 527 | try std.testing.expect(payload[0] == 8); |
| 528 | try std.testing.expect(payload[1] == 0); |
| 529 | } |
| 530 | |
| 521 | 531 | test "containsValidAddressRange" { |
| 522 | 532 | var segment = BinaryElfSegment{ |
| 523 | 533 | .physicalAddress = 0, |