# Minimal HFS+ catalogs written into malloc:// with wx

NAME=hfsplus catalog index node pointing at an empty node
FILE=malloc://24576
TIMEOUT=30
CMDS=<<EOF
wx 482b0004 @ 0x400
wx 10 @ 0x42a
wx 10 @ 0x4c6
wx 010000000500000001 @ 0x4cf
wx 30 @ 0x516
wx 030000000200000003 @ 0x51f
wx 010000030000000100000001 @ 0x2008
wx 1000020400000003 @ 0x2020
wx 0100010000000600000002000000000002 @ 0x3009
wx 1a000e @ 0x3ffd
wx 0100000300000001 @ 0x5008
wx 1000020400000003 @ 0x5020
m /mnt hfsplus 0
m
EOF
EXPECT=<<EOF
hfsplus	0x0	/mnt
EOF
RUN

# the catalog root (node 1) is an index node whose only record points at node 1
NAME=hfsplus catalog index node pointing at itself
FILE=malloc://24576
TIMEOUT=30
CMDS=<<EOF
wx 482b0004 @ 0x400
wx 10 @ 0x42a
wx 10 @ 0x4c6
wx 010000000500000001 @ 0x4cf
wx 30 @ 0x516
wx 030000000200000003 @ 0x51f
wx 010000030000000100000001 @ 0x2008
wx 1000020400000003 @ 0x2020
wx 0100010000000600000002000000000001 @ 0x3009
wx 1a000e @ 0x3ffd
wx 0100000300000001 @ 0x5008
wx 1000020400000003 @ 0x5020
m /mnt hfsplus 0
?v $?
EOF
EXPECT=<<EOF
0x1
EOF
RUN

NAME=hfsplus two level catalog
FILE=malloc://24576
TIMEOUT=30
CMDS=<<EOF
wx 482b0004 @ 0x400
wx 10 @ 0x42a
wx 10 @ 0x4c6
wx 010000000100000001 @ 0x4cf
wx 40 @ 0x516
wx 040000000200000004 @ 0x51f
wx 01000003 @ 0x1008
wx 1000020400000001 @ 0x1020
wx 010000030000000200000001 @ 0x2008
wx 1000020400000004 @ 0x2020
wx 0200010000000600000002000000000002 @ 0x3009
wx 1a000e @ 0x3ffd
wx 0000000300000000ff010003000000060000000200000003000000000002 @ 0x4000
wx 0e00000002000400640069007200310001 @ 0x4117
wx 14 @ 0x4131
wx 1000000002000500660069006c006500310002 @ 0x417f
wx 15 @ 0x419b
wx 81a4 @ 0x41ba
wx 0288017e0116000e @ 0x4ff8
wx ff0100010000001000000002000500660069006c006500320002 @ 0x5008
wx 16 @ 0x502b
wx 81a4 @ 0x504a
wx 0118000e @ 0x5ffc
m /mnt hfsplus 0
md /mnt
EOF
EXPECT=<<EOF
d dir1
f file1
f file2
EOF
RUN

# same catalog with the last leaf chained back to the first one
NAME=hfsplus catalog leaf chain loop
FILE=malloc://24576
TIMEOUT=30
CMDS=<<EOF
wx 482b0004 @ 0x400
wx 10 @ 0x42a
wx 10 @ 0x4c6
wx 010000000100000001 @ 0x4cf
wx 40 @ 0x516
wx 040000000200000004 @ 0x51f
wx 01000003 @ 0x1008
wx 1000020400000001 @ 0x1020
wx 010000030000000200000001 @ 0x2008
wx 1000020400000004 @ 0x2020
wx 0200010000000600000002000000000002 @ 0x3009
wx 1a000e @ 0x3ffd
wx 0000000300000000ff010003000000060000000200000003000000000002 @ 0x4000
wx 0e00000002000400640069007200310001 @ 0x4117
wx 14 @ 0x4131
wx 1000000002000500660069006c006500310002 @ 0x417f
wx 15 @ 0x419b
wx 81a4 @ 0x41ba
wx 0288017e0116000e @ 0x4ff8
wx ff0100010000001000000002000500660069006c006500320002 @ 0x5008
wx 16 @ 0x502b
wx 81a4 @ 0x504a
wx 0118000e @ 0x5ffc
wx 00000002 @ 0x5000
m /mnt hfsplus 0
?v $?
EOF
EXPECT=<<EOF
0x1
EOF
RUN
