NAME=search count
FILE=malloc://1024
CMDS=<<EOF
wx 2f @ 0x100
wx 2f @ 0x110
wx 2f @ 0x120
/x 2f > /dev/null
s hit.bytes.0
%vi $?
EOF
EXPECT=<<EOF
256
EOF
RUN

NAME=search count
FILE=malloc://1024
CMDS=<<EOF
wx 01020304 @ 0x100
/x 01020304
s hit.bytes.0
%v hit.bytes.0
EOF
EXPECT=<<EOF
0x00000100 4 hit.bytes.0
0x100
EOF
RUN

NAME=spaces
FILE=malloc://1024
CMDS=<<EOF
wx 01020304 @ 0x100
/x 01020304
s hit.bytes.0
%v hit.bytes.0
EOF
EXPECT=<<EOF
0x00000100 4 hit.bytes.0
0x100
EOF
RUN

NAME=binmask
FILE=malloc://1024
CMDS=<<EOF
wx 01020304 @ 0x100
/x 01020304:ffffffff
s hit.bytes.0
%v hit.bytes.0
EOF
EXPECT=<<EOF
0x00000100 4 hit.bytes.0
0x100
EOF
RUN

NAME=binmask seek search (mips)
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=mips
e scr.color=false
wx 2080998f00000000d4a22527
e search.from=0
e search.to=12
/x 00002027:0000f0ff
s hit.bytes.0
%v $$
q
EOF
EXPECT=<<EOF
0x00000008 4 hit.bytes.0
0x8
EOF
RUN

NAME=binmask seek search (mips)
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=mips
e scr.color=false
wx 2080998f00000000d4a22527
e search.from=0
e search.to=12
/x 2027:f0ff
s hit.bytes.0
%v $$
q
EOF
EXPECT=<<EOF
0x0000000a 2 hit.bytes.0
0xa
EOF
RUN

NAME=overlapped matches
FILE=malloc://1024
CMDS=<<EOF
e search.overlap=true
w AAAA @ 0x100
/x 4141
EOF
EXPECT=<<EOF
0x00000100 2 hit.bytes.0
0x00000101 2 hit.bytes.1
0x00000102 2 hit.bytes.2
EOF
RUN

NAME=non-overlapped matches
FILE=malloc://1024
CMDS=<<EOF
e search.overlap=false
w AAAA @ 0x100
/x 4141
EOF
EXPECT=<<EOF
0x00000100 2 hit.bytes.0
0x00000102 2 hit.bytes.1
EOF
RUN

NAME=any-match with small block size
FILE=malloc://1024
CMDS=<<EOF
w ABCD @ 0x100
b 2
/x .1.2.3.4
EOF
EXPECT=<<EOF
0x00000100 4 hit.bytes.0
EOF
RUN

NAME=invalid @x: hexpair
FILE==
CMDS=px @x:abcdefgh
EXPECT=
EXPECT_ERR=<<EOF
ERROR: core: Invalid hexpair for @x:
ERROR: core: Error while executing command: px @x:abcdefgh
EOF
RUN
