1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
|
### Empty
{
type => "tfn",
name => "escapeSeqDecode",
input => "",
output => "",
ret => 0,
},
### Nothing
{
type => "tfn",
name => "escapeSeqDecode",
input => "TestCase",
output => "TestCase",
ret => 0,
},
{
type => "tfn",
name => "escapeSeqDecode",
input => "Test\0Case",
output => "Test\0Case",
ret => 0,
},
### Valid Sequences
{
type => "tfn",
name => "escapeSeqDecode",
input => "\\a\\b\\f\\n\\r\\t\\v\\?\\'\\\"\\0\\12\\123\\x00\\xff",
output => "\a\b\f\x0a\x0d\t\x0b?'\"\x00\x0a\x53\x00\xff",
ret => 1,
},
{
type => "tfn",
name => "escapeSeqDecode",
input => "\\a\\b\\f\\n\\r\\t\\v\0\\?\\'\\\"\\0\\12\\123\\x00\\xff",
output => "\a\b\f\x0a\x0d\t\x0b\0?'\"\x00\x0a\x53\x00\xff",
ret => 1,
},
### Invalid Sequences
# \8 and \9 are not octal
# \666 is a byte overflow (0x1b6) and should be truncated to a byte as 0xb6
# \xag and \xga are not hex,
# \0123 is \012 + '3'
{
type => "tfn",
name => "escapeSeqDecode",
input => "\\8\\9\\666\\xag\\xga\\0123",
output => "89\xb6xagxga\x0a3",
ret => 1,
},
# \x, \x0 lack enough hex digits
{
type => "tfn",
name => "escapeSeqDecode",
input => "\\x",
output => "x",
ret => 1,
},
{
type => "tfn",
name => "escapeSeqDecode",
input => "\\x\\x0",
output => "xx0",
ret => 1,
},
{
type => "tfn",
name => "escapeSeqDecode",
input => "\\x\\x0\0",
output => "xx0\0",
ret => 1,
},
# Octal at end
{
type => "tfn",
name => "escapeSeqDecode",
input => "\\0",
output => "\x00",
ret => 1,
},
{
type => "tfn",
name => "escapeSeqDecode",
input => "\\01",
output => "\x01",
ret => 1,
},
{
type => "tfn",
name => "escapeSeqDecode",
input => "\\012",
output => "\x0a",
ret => 1,
},
# A forward slash with nothing after
{
type => "tfn",
name => "escapeSeqDecode",
input => "\\",
output => "\\",
ret => 0,
},
# A forward slash with NUL after
{
type => "tfn",
name => "escapeSeqDecode",
input => "\\\0",
output => "\0",
ret => 1,
},
|