NAME=add comment
FILE=malloc://1024
CMDS=<<EOF
CCa 0x123 hello
C*~?
C*~[3]
EOF
EXPECT=<<EOF
1
0x00000123
EOF
RUN

NAME=#3829 remove comment where another meta is already defined
FILE=bins/elf/analysis/main
CMDS=<<EOF
CCu lol @ str.Hello_World
CC- @ str.Hello_World
pd 1 @ str.Hello_World
EOF
EXPECT=<<EOF
            ;-- str.Hello_World:
            0x004005c4     .string "Hello World" ; len=12
EOF
RUN

NAME=add comment
FILE=malloc://1024
CMDS=<<EOF
CC hello
C*~?
EOF
EXPECT=<<EOF
1
EOF
RUN

NAME=add comment at
FILE=malloc://1024
CMDS=<<EOF
CCa 8 hello
C*~?
CC*
EOF
EXPECT=<<EOF
1
CCu base64:aGVsbG8= @ 0x00000008
EOF
RUN

NAME=del comment
FILE=malloc://1024
CMDS=<<EOF
CC hello
CC-hello
C*~?
EOF
EXPECT=<<EOF
0
EOF
RUN

NAME=add two comment
FILE=malloc://1024
CMDS=<<EOF
CC hello @ 0x200
CC world @ 0x400
C*~?
EOF
EXPECT=<<EOF
2
EOF
RUN

NAME=del comment at address
FILE=malloc://1024
CMDS=<<EOF
CC hello @ 0x200
CC world @ 0x400
CC-@0x400
C*~?
EOF
EXPECT=<<EOF
1
EOF
RUN

NAME=multiline comment
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=x86
e asm.bytes=true
e asm.bits=32
CC hello @ 0x200
CC world @ 0x200
CC.@0x200~?
CC~?
e asm.profile=simple
e asm.cmt.right=0
e scr.color=false
pd 2 @ 0x200
EOF
EXPECT=<<EOF
1
1
            ; hello world
            0x00000200      0000           add byte [eax], al
            0x00000202      0000           add byte [eax], al
EOF
RUN

NAME=cmtright
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=x86
e asm.bytes=true
e asm.bits=64
CC hello
e scr.color=false
wx 90
e asm.cmt.right=1
pd 1
e asm.cmt.right=0
pd 1
EOF
EXPECT=<<EOF
            0x00000000      90             nop                         ; hello
            ; hello
            0x00000000      90             nop
EOF
RUN

NAME=cmtrefs
FILE=bins/elf/analysis/main
CMDS=<<EOF
aaa
e asm.cmt.refs=true
e asm.bytes=true
f test.flag @ 0x004003e0
CC test comment @ 0x004003e0
pd 1 @ 0x0040050f
EOF
EXPECT=<<EOF
|           0x0040050f      e8ccfeffff     call  sym.imp.puts          ; int puts(const char *s) ; (sym.imp.puts) ; (test.flag) ; (test comment)
EOF
RUN
