diff --git a/README.md b/README.md index d5eb3d2..75af0f8 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ Example code and its outputs: ```python import pelfy -elf = pelfy.open_elf_file('obj/test-c-riscv64-linux-gnu-gcc-12-O3.o') +elf = pelfy.open_elf_file('tests/obj/test-c-riscv64-linux-gnu-gcc-12-O3.o') elf.sections ``` | index | name | type | description | @@ -58,7 +58,7 @@ elf.functions | 14 | mul_float_float | STT_FUNC | 12 | STB_GLOBAL | Symbol is a code object | | 15 | read_float | STT_FUNC | 16 | STB_GLOBAL | Symbol is a code object | ```python -elf.symbols['read_float'].get_relocations() +elf.symbols['read_float'].relocations ``` | index | symbol name | type | calculation | |------:|--------------------|----------------------|-------------| diff --git a/tests/test_readme_example.py b/tests/test_readme_example.py new file mode 100644 index 0000000..2a77956 --- /dev/null +++ b/tests/test_readme_example.py @@ -0,0 +1,8 @@ +import pelfy + +def test_readme_example(): + elf = pelfy.open_elf_file('tests/obj/test-c-riscv64-linux-gnu-gcc-12-O3.o') + + assert ' description ' in elf.sections.to_markdown() + assert ' stb ' in elf.functions.to_markdown() + assert ' symbol name ' in elf.symbols['read_float'].relocations.to_markdown() \ No newline at end of file