aboutsummaryrefslogtreecommitdiff
path: root/elf/test.lua
diff options
context:
space:
mode:
authorSunil Nimmagadda <sunil@nimmagadda.net>2026-11-09 12:05:54 +0530
committerSunil Nimmagadda <sunil@nimmagadda.net>2026-11-09 12:05:54 +0530
commitb12a3a53ec1258e4d815e491b0169977bbfa4444 (patch)
treef9525eb2e6a9a5bfb1417d4f7c2d945f6e7c0e98 /elf/test.lua
parent4cbe6844594b41db870e793c968b5653626dc436 (diff)
Indent properly.
Diffstat (limited to 'elf/test.lua')
-rw-r--r--elf/test.lua82
1 files changed, 41 insertions, 41 deletions
diff --git a/elf/test.lua b/elf/test.lua
index c906fed..6c555a5 100644
--- a/elf/test.lua
+++ b/elf/test.lua
@@ -125,27 +125,27 @@ test("header.pack 64_le_x86-64", function ()
machine = ec.Machine.x86_64,
}
local expected = hex_to_bytes(table.concat({
- -- "BBBBBBBBBxxxxxxx"
- "7f454c46020101000000000000000000",
- -- "I2I2I4"
- "02003e0001000000",
- -- string.rep(fmt.word(hdr.class), 3), where I8 is selected
- table.concat({
- "0000000000000000", -- entry
- "4000000000000000", -- phoff
- "0000000000000000", -- shoff
- }),
- -- "I4I2I2I2I2I2I2"
- table.concat({
- "00000000", -- flags
- "4000", -- ehsize
- "3800", -- phentsize
- "0000", -- phnum
- "4000", -- shentsize
- "0000", -- shnum
- "0000", -- shstrndx
- })
- }))
+ -- "BBBBBBBBBxxxxxxx"
+ "7f454c46020101000000000000000000",
+ -- "I2I2I4"
+ "02003e0001000000",
+ -- string.rep(fmt.word(hdr.class), 3), where I8 is selected
+ table.concat({
+ "0000000000000000", -- entry
+ "4000000000000000", -- phoff
+ "0000000000000000", -- shoff
+ }),
+ -- "I4I2I2I2I2I2I2"
+ table.concat({
+ "00000000", -- flags
+ "4000", -- ehsize
+ "3800", -- phentsize
+ "0000", -- phnum
+ "4000", -- shentsize
+ "0000", -- shnum
+ "0000", -- shstrndx
+ })
+ }))
local actual = elf_header.pack(elf_header.normalize(h))
assert(#actual == 64, "invalid ELF64 header size")
assert(actual == expected, "mismatch")
@@ -169,26 +169,26 @@ test("header.pack 32_le_i386", function ()
shstrndx = 0x3e3f,
}
local expected = hex_to_bytes(table.concat({
- -- "BBBBBBBBBxxxxxxx"
- "7f454c46010101000000000000000000",
- -- "I2I2I4"
- "0200030001000000",
- -- string.rep(fmt.word(hdr.class), 3), where I4 is selected
- table.concat({
- "04030201", -- entry
- "14131211", -- phoff
- "24232221", -- shoff
- }),
- -- "I4I2I2I2I2I2I2"
- table.concat({
- "34333231", -- flags
- "3534", -- ehsize
- "3736", -- phentsize
- "3938", -- phnum
- "3b3a", -- shentsize
- "3d3c", -- shnum
- "3f3e", -- shstrndx
- }),
+ -- "BBBBBBBBBxxxxxxx"
+ "7f454c46010101000000000000000000",
+ -- "I2I2I4"
+ "0200030001000000",
+ -- string.rep(fmt.word(hdr.class), 3), where I4 is selected
+ table.concat({
+ "04030201", -- entry
+ "14131211", -- phoff
+ "24232221", -- shoff
+ }),
+ -- "I4I2I2I2I2I2I2"
+ table.concat({
+ "34333231", -- flags
+ "3534", -- ehsize
+ "3736", -- phentsize
+ "3938", -- phnum
+ "3b3a", -- shentsize
+ "3d3c", -- shnum
+ "3f3e", -- shstrndx
+ }),
}))
local actual = elf_header.pack(elf_header.normalize(header))
assert(#actual == 52, "invalid ELF32 header size")