Add tests for pf.write

This commit is contained in:
pancake 2021-01-30 01:18:48 +01:00
parent 569f1f2fb0
commit ae0a733d5e
2 changed files with 104 additions and 0 deletions

View File

@ -1,2 +1,3 @@
MKDIR %MESON_INSTALL_PREFIX%\bin
@echo @"%%~dp0\radare2" %%*> %MESON_INSTALL_PREFIX%\bin\r2.bat
EXIT 0

103
test/db/cmd/cmd_pf_write Normal file
View File

@ -0,0 +1,103 @@
NAME=pf xxd=123
FILE=-
CMDS=<<EOF
pf foo=xxd foo bar cow
pf.foo
pf.foo.foo
.pf.foo.foo=123
pf.foo.foo
pf.foo
EOF
EXPECT=<<EOF
foo : 0x00000000 = 0x00000000
bar : 0x00000004 = 0x00000000
cow : 0x00000008 = 0
foo : 0x00000000 = 0x00000000
foo : 0x00000000 = 0x0000007b
foo : 0x00000000 = 0x0000007b
bar : 0x00000004 = 0x00000000
cow : 0x00000008 = 0
EOF
RUN
NAME=pf xxd.cow=123
FILE=-
CMDS=<<EOF
pf foo=[2]xxd foo bar cow
pf.foo.cow
.pf.foo.cow=123
pf.foo.cow
EOF
EXPECT=<<EOF
cow : 0x0000000c = 0
cow : 0x0000000c = 123
EOF
RUN
NAME=pf array with one write
FILE=-
CMDS=<<EOF
pf foo=[3]x foo
.pf.foo.foo=1
pf.foo
EOF
EXPECT=<<EOF
foo : 0x00000000 = [ 0x00000001, 0x00000000, 0x00000000 ]
EOF
RUN
NAME=pf array not in meta
FILE=-
BROKEN=1
CMDS=<<EOF
pf foo=[3]x foo
.pf.foo.foo=1
.pf*.foo
e asm.lines=0
pd 1
EOF
EXPECT=<<EOF
0x00000000 foo : 0x00000000 = [ 0x00000001, 0x00000000, 0x00000000 ]
EOF
RUN
NAME=pf xxd print happy
FILE=-
CMDS=<<EOF
pf foo=xxd foo bar cow
w hello happy world
e asm.lines=0
.pf*.foo
pd 3
EOF
EXPECT=<<EOF
;-- foo:
0x00000000 .dword 0x6c6c6568
;-- bar:
0x00000004 .dword 0x6168206f
;-- cow:
0x00000008 .dword 0x20797070
EOF
RUN
NAME=pf xxd print
BROKEN=1
FILE=-
CMDS=<<EOF
pf foo=[2]xxd foo bar cow
w hello happy world
e asm.lines=0
e asm.flags.inbytes=1
.pf*.foo
pd 3
EOF
EXPECT=<<EOF
;-- foo:
0x00000000 .qword 0x6168206f6c6c6568
;-- bar:
0x00000008 .dword 0x20797070
;-- cow:
0x0000000c .dword 0x6c726f77
EOF
RUN