NAME=partial address modifiers trim cipher names
FILE=malloc://128
ARGS=-a x86 -b 64 -e search.in=io.maps
CMDS=<<EOF
/ca aes @..0
/ca sm4   @..0
/ca aes @...80
/ca sm4   @...80
EOF
EXPECT=
EXPECT_ERR=
RUN

NAME=partial address modifiers trim calling convention names
FILE=malloc://128
ARGS=-a x86 -b 64
CMDS=<<EOF
tcc void customcc (rax);
tcc customcc @..0
tcc customcc   @...80
tcc- customcc @..0
tcc~customcc
tcc void customcc (rax);
tcc- customcc   @...80
tcc~customcc
EOF
EXPECT=<<EOF
void customcc (rax);
void customcc (rax);
EOF
EXPECT_ERR=
RUN

NAME=partial address modifiers trim visual mark and flag space deletion
FILE=malloc://128
CMDS=<<EOF
fv a 1
fv b 2
fv-* @..0
fvj
fv a 1
fv b 2
fv-*   @...80
fvj
fs foo
f test 1 1
fs *
fs-foo @..0
fsj~foo
fs foo
f test 1 1
fs *
fs-foo   @...80
fsj~foo
EOF
EXPECT=<<EOF
[]
[]
EOF
EXPECT_ERR=
RUN

NAME=partial address modifiers trim exported type names
FILE=malloc://128
CMDS=<<EOF
'td struct Foo { int x; };
'td enum E { A=1 };
tsc Foo @..0
tsc Foo   @...80
tec E @..0
tec E   @...80
EOF
EXPECT=<<EOF
struct Foo {
  int x;
};
struct Foo {
  int x;
};
enum E {
	A = 1
};
enum E {
	A = 1
};
EOF
EXPECT_ERR=
RUN

NAME=partial address modifiers trim instruction families and register names
FILE=malloc://2
ARGS=-a x86 -b 64 -e search.in=io.maps
CMDS=<<EOF
wx 90c3
/af cpu @..0
/af cpu   @...2
aer rax @..0
aer rax   @...2
EOF
EXPECT=<<EOF
0x00000000 cpu nop 1 nop
0x00000001 cpu ret 1 ret
0x00000000 cpu nop 1 nop
0x00000001 cpu ret 1 ret
0x00000000
0x00000000
EOF
EXPECT_ERR=
RUN

NAME=@c:
FILE=--
CMDS=<<EOF
?v $$ @c:?e 123
?v $$ @c:?e 0
EOF
EXPECT=<<EOF
0x7b
0x0
EOF
RUN

NAME=@ addr
FILE=--
CMDS=<<EOF
s 0
s @ 0x42
EOF
EXPECT=<<EOF
0x42
EOF
RUN

NAME=@e:
FILE=-
CMDS=<<EOF
e scr.color=false
e scr.color @e:scr.color=true
EOF
EXPECT=<<EOF
1
EOF
RUN

NAME=@a:
FILE=-
CMDS=<<EOF
e asm.arch=x86
e asm.arch @a:arm
EOF
EXPECT=<<EOF
arm
EOF
RUN

NAME=@e: @ addr
FILE=-
CMDS=<<EOF
e scr.color=false
s 0
e scr.color @e:scr.color=true @ 0x1337
s @e:scr.color=true @ 0x1337
EOF
EXPECT=<<EOF
1
0x1337
EOF
RUN

NAME=@ addr @e
FILE=-
CMDS=<<EOF
e scr.color @ 0x42 @e:scr.color=false 
e scr.color @ 0x1337 @e:scr.color=true
s @ 0x42 @e:scr.color=false 
s @ 0x1337 @e:scr.color=true 
EOF
EXPECT=<<EOF
0
1
0x42
0x1337
EOF
RUN

NAME=@a: @ addr @e:
FILE=-
CMDS=<<EOF
e asm.arch @a:x86 @ 0x42 @e:scr.color=false
e asm.arch @a:arm @ 0x1337 @e:scr.color=true
s @a:x86 @ 0x42 @e:scr.color=false
s @a:arm @ 0x1337 @e:scr.color=true
e scr.color @a:x86 @ 0x42 @e:scr.color=false
e scr.color @a:arm @ 0x1337 @e:scr.color=true
EOF
EXPECT=<<EOF
x86
arm
0x42
0x1337
0
1
EOF
RUN

NAME=@e:a=b,c=d with a==c
FILE=-
CMDS=<<EOF
e asm.pseudo=false
e asm.pseudo @e:asm.pseudo=true,asm.pseudo=true
e asm.pseudo
EOF
EXPECT=<<EOF
true
false
EOF
RUN

NAME=@e:a=b @e:c=d with a==c
FILE=-
CMDS=<<EOF
e asm.pseudo=false
e asm.pseudo @e:asm.pseudo=true @e:asm.pseudo=true
e asm.pseudo
EOF
EXPECT=<<EOF
true
false
EOF
RUN
