NAME=tenum ut64
FILE=--
CMDS=<<EOF
td enum test{ullnum=0x800000ULL }
te test
EOF
EXPECT_ERR=<<EOF
EOF
EXPECT=<<EOF
ullnum = 0x800000
EOF
RUN

NAME=tenum ut64 second edition
FILE=--
CMDS=<<EOF
td enum test{ullnum=0x800000ULL,ullnum2=0x8000123480000000ULL }
te test
EOF
EXPECT_ERR=
EXPECT=<<EOF
ullnum = 0x800000
ullnum2 = 0x8000123480000000
EOF
RUN

NAME=tv xrefs shown before type
FILE=bins/elf/tcache
CMDS=<<EOF
e log.level=0
aaa
te-elf_machine
te-elf_s_type
tf-*
tv
EOF
EXPECT=<<EOF
0x00000000 enum elf_class {
0x00000000   ELFCLASSNONE = 0x0;
0x00000001   ELFCLASS32 = 0x1;
0x00000002   ELFCLASS64 = 0x2;
0x00000000 };
0x00000000 enum elf_data {
0x00000000   ELFDATANONE = 0x0;
0x00000001   ELFDATA2LSB = 0x1;
0x00000002   ELFDATA2MSB = 0x2;
0x00000000 };
0x00000000 enum elf_hdr_version {
0x00000000   EV_NONE = 0x0;
0x00000001   EV_CURRENT = 0x1;
0x00000000 };
0x00000000 enum elf_obj_version {
0x00000000   EV_NONE = 0x0;
0x00000001   EV_CURRENT = 0x1;
0x00000000 };
0x00000000 enum elf_p_flags {
0x00000000   PF_None = 0x0;
0x00000001   PF_Exec = 0x1;
0x00000002   PF_Write = 0x2;
0x00000003   PF_Write_Exec = 0x3;
0x00000004   PF_Read = 0x4;
0x00000005   PF_Read_Exec = 0x5;
0x00000006   PF_Read_Write = 0x6;
0x00000007   PF_Read_Write_Exec = 0x7;
0x00000000 };
0x00000000 enum elf_p_type {
0x00000000   PT_NULL = 0x0;
0x00000001   PT_LOAD = 0x1;
0x00000002   PT_DYNAMIC = 0x2;
0x00000003   PT_INTERP = 0x3;
0x00000004   PT_NOTE = 0x4;
0x00000005   PT_SHLIB = 0x5;
0x00000006   PT_PHDR = 0x6;
0x60000000   PT_LOOS = 0x60000000;
0x6fffffff   PT_HIOS = 0x6fffffff;
0x70000000   PT_LOPROC = 0x70000000;
0x7fffffff   PT_HIPROC = 0x7fffffff;
0x00000000 };
0x00000000 enum elf_s_flags_64 {
0x00000000   SF64_None = 0x0;
0x00000001   SF64_Exec = 0x1;
0x00000002   SF64_Alloc = 0x2;
0x00000003   SF64_Alloc_Exec = 0x3;
0x00000004   SF64_Write = 0x4;
0x00000005   SF64_Write_Exec = 0x5;
0x00000006   SF64_Write_Alloc = 0x6;
0x00000007   SF64_Write_Alloc_Exec = 0x7;
0x00000000 };
0x00000000 enum elf_type {
0x00000000   ET_NONE = 0x0;
0x00000001   ET_REL = 0x1;
0x00000002   ET_EXEC = 0x2;
0x00000003   ET_DYN = 0x3;
0x00000004   ET_CORE = 0x4;
0x0000fe00   ET_LOOS = 0xfe00;
0x0000feff   ET_HIOS = 0xfeff;
0x0000ff00   ET_LOPROC = 0xff00;
0x0000ffff   ET_HIPROC = 0xffff;
0x00000000 };
0x00000000 type FILE; // size=1
0x00000001
             ; XREF[r] 0x00401151 main
             ; XREF[w] 0x00401151 main
0x00000000 type char; // size=1
0x00000001
0x00000000 type char *; // size=8
0x00000008
             ; XREF[r] 0x00401151 main
             ; XREF[w] 0x00401151 main
0x00000000 type char **; // size=0
0x00000000
0x00000000 type double; // size=8
0x00000008
0x00000000 type float; // size=4
0x00000004
0x00000000 type func; // size=1
0x00000001
0x00000000 type gid_t; // size=0
0x00000000
             ; XREF[r] 0x0040114e main
0x00000000 type int; // size=4
0x00000004
0x00000000 type int16_t; // size=2
0x00000002
0x00000000 type int32_t; // size=4
0x00000004
             ; XREF[r] 0x00401066 entry0
             ; XREF[r] 0x0040123f sym.__libc_csu_init
             ; XREF[r] 0x00401244 sym.__libc_csu_init
             ; XREF[r] 0x00401249 sym.__libc_csu_init
             ; XREF[w] 0x0040114e main
             ; XREF[w] 0x0040115e main
             ; XREF[r] 0x00401213 main
0x00000000 type int64_t; // size=8
0x00000008
0x00000000 type int8_t; // size=1
0x00000001
0x00000000 type long; // size=8
0x00000008
0x00000000 type long long; // size=8
0x00000008
0x00000000 type pid_t; // size=4
0x00000004
0x00000000 type short; // size=2
0x00000002
0x00000000 type size_t; // size=8
0x00000008
0x00000000 type time_t; // size=8
0x00000008
0x00000000 type uid_t; // size=8
0x00000008
0x00000000 type uint16_t; // size=2
0x00000002
0x00000000 type uint32_t; // size=4
0x00000004
0x00000000 type uint64_t; // size=8
0x00000008
0x00000000 type uint8_t; // size=1
0x00000001
0x00000000 type unsigned char; // size=1
0x00000001
0x00000000 type unsigned int; // size=4
0x00000004
0x00000000 type unsigned short; // size=2
0x00000002
             ; XREF[w] 0x00401164 main
             ; XREF[r] 0x0040117a main
             ; XREF[r] 0x00401184 main
             ; XREF[r] 0x0040118e main
             ; XREF[r] 0x00401193 main
             ; XREF[r] 0x00401197 main
             ; XREF[w] 0x0040119d main
             ; XREF[r] 0x004011a6 main
             ; XREF[r] 0x004011b8 main
             ; XREF[r] 0x004011bc main
             ; XREF[w] 0x004011c2 main
             ; XREF[r] 0x004011d8 main
             ; XREF[r] 0x004011e2 main
             ; XREF[r] 0x004011ec main
             ; XREF[r] 0x004011f1 main
             ; XREF[r] 0x004011f5 main
             ; XREF[w] 0x004011fb main
             ; XREF[r] 0x00401204 main
             ; XREF[r] 0x00401208 main
             ; XREF[r] 0x00401189 main
             ; XREF[r] 0x004011ab main
             ; XREF[r] 0x004011e7 main
0x00000000 type void *; // size=8
0x00000008
EOF
RUN

NAME=ts- glob deletion
FILE=--
CMDS=<<EOF
"td struct foo {int x;}"
"td struct foo2 {int y;}"
"td struct foobar {int z;}"
"td struct bar {int w;}"
ts~bar,foo
?e ---
ts- foo*
ts~bar,foo
EOF
EXPECT=<<EOF
bar
foo
foo2
foobar
---
bar
EOF
RUN

NAME=ts- multiple names deletion
FILE=--
CMDS=<<EOF
"td struct foo {int x;}"
"td struct bar {int y;}"
"td struct baz {int z;}"
ts~bar,baz,foo
?e ---
ts- foo baz
ts~bar,baz,foo
EOF
EXPECT=<<EOF
bar
baz
foo
---
bar
EOF
RUN

NAME=te- glob deletion
FILE=--
CMDS=<<EOF
"td enum myenum {A=1,B=2}"
"td enum myenum2 {C=3,D=4}"
"td enum other {E=5}"
te
?e ---
te- myenum*
te
EOF
EXPECT=<<EOF
myenum
myenum2
other
---
other
EOF
RUN

NAME=tu- glob deletion
FILE=--
CMDS=<<EOF
"td union myunion {int i;float f;}"
"td union myunion2 {int i;double d;}"
"td union other {int i;char c;}"
tu
?e ---
tu- myunion*
tu
EOF
EXPECT=<<EOF
myunion
myunion2
other
---
other
EOF
RUN

NAME=t- glob deletion any type
FILE=--
CMDS=<<EOF
"td struct sfoo {int x;}"
"td struct sfoo2 {int y;}"
"td enum efoo {A=1}"
"td union ufoo {int i;}"
ts~sfoo
te~efoo
tu~ufoo
?e ---
t- *foo*
ts~sfoo
te~efoo
tu~ufoo
EOF
EXPECT=<<EOF
sfoo
sfoo2
efoo
ufoo
---
EOF
RUN

