Skip to content

Commit

Permalink
updated doc example
Browse files Browse the repository at this point in the history
  • Loading branch information
cracked-machine committed Feb 4, 2024
1 parent 1134915 commit 6f23538
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 12 deletions.
8 changes: 5 additions & 3 deletions doc/example/report.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
![memory map diagram](report.png)
|name|origin|size|remaining|collisions
|:-|:-|:-|:-|:-|
|<span style='color:midnightblue'>dtb</span>|0x90|0x100|0x258|{}|
|<span style='color:aqua'>kernel</span>|0x10|0x60|0x0|{}|
|<span style='color:lime'>rootfs</span>|0x70|0x10|0x10|{'kernel': '0x70'}|
|<span style='color:mediumpurple'>kernel</span>|0x10|0x50|-0x10|{'rootfs': '0x50'}|
|<span style='color:skyblue'>uboot</span>|0xD0|0x50|-0x10|{'uboot-scr': '0x110'}|
|<span style='color:midnightblue'>rootfs</span>|0x50|0x30|0x10|{'kernel': '0x50'}|
|<span style='color:dimgray'>dtb</span>|0x90|0x30|0x10|{}|
|<span style='color:dodgerblue'>uboot-scr</span>|0x110|0x30|0x2a8|{'uboot': '0x110'}|
Binary file modified doc/example/report.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 35 additions & 9 deletions tests/test_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,46 @@


def test_generate_doc_example():
''' should create custom report dir/files '''
""" """
with unittest.mock.patch('sys.argv',
['mmap_digram.diagram',
'kernel',
'0x10',
'0x60',
'0x50',
'rootfs',
'0x70',
'0x10',
'0x50',
'0x30',
'dtb',
'0x90',
'0x100',
'0x30',
'uboot',
'0xD0',
'0x50',
'uboot-scr',
'0x110',
'0x30',
"-o",
"doc/example/report.md"]):
mmdiagram.generator.Diagram()
assert pathlib.Path("doc/example/report.md").exists()
assert pathlib.Path("doc/example/report.png").exists()
"doc/example/report.md"],
mmdiagram.generator.height, 1000):
d = mmdiagram.generator.Diagram()
for region in d._region_list:
if region.name == "kernel":
assert region._origin == "0x10"
assert region._size == "0x50"
assert region.remain == "-0x10"
if region.name == "rootfs":
assert region._origin == "0x50"
assert region._size == "0x30"
assert region.remain == "0x10"
if region.name == "dtb":
assert region._origin == "0x90"
assert region._size == "0x30"
assert region.remain == "0x10"
if region.name == "uboot":
assert region._origin == "0xD0"
assert region._size == "0x50"
assert region.remain == "-0x10"
if region.name == "uboot-scr":
assert region._origin == "0x110"
assert region._size == "0x30"
assert region.remain == "0x2a8"

0 comments on commit 6f23538

Please sign in to comment.