- add hex and octal parsers to the Curl_str_* family - make curlx_strtoofft use these parsers - remove all use of strtol() and strtoul() in library code - generally use Curl_str_* more than strtoofft, for stricter parsing - supports 64-bit universally, instead of 'long' which differs in size between platforms Extended the unit test 1664 to verify hex and octal parsing. Closes #16336
153 lines
3.6 KiB
Plaintext
153 lines
3.6 KiB
Plaintext
<testcase>
|
|
<info>
|
|
<keywords>
|
|
unittest
|
|
strparse
|
|
</keywords>
|
|
</info>
|
|
|
|
#
|
|
# Client-side
|
|
<client>
|
|
<server>
|
|
none
|
|
</server>
|
|
<features>
|
|
unittest
|
|
large-size
|
|
</features>
|
|
<name>
|
|
unit tests for strparse.c string parsing functions
|
|
</name>
|
|
</client>
|
|
|
|
<verify>
|
|
<stdout>
|
|
Curl_str_word
|
|
0: ("word") 0, "word" [4], line 4
|
|
1: ("word ") 0, "word" [4], line 4
|
|
2: (" word ") 2, "" [0], line 0
|
|
3: ("wo rd") 0, "wo" [2], line 2
|
|
4: ("word(") 0, "word(" [5], line 5
|
|
5: ("wor(d") 0, "wor(d" [5], line 5
|
|
6: ("perfect") 0, "perfect" [7], line 7
|
|
7: ("") 2, "" [0], line 0
|
|
8: ("longerth") 1, "" [0], line 0
|
|
Curl_str_until
|
|
0: ("word") 0, "wor" [3], line 3
|
|
1: ("word ") 0, "wor" [3], line 3
|
|
2: (" word ") 0, " wor" [4], line 4
|
|
3: ("wo rd") 0, "wo r" [4], line 4
|
|
4: ("word(") 0, "wor" [3], line 3
|
|
5: ("wor(d") 0, "wor(" [4], line 4
|
|
6: ("perfect") 0, "perfect" [7], line 7
|
|
7: ("") 2, "" [0], line 0
|
|
8: ("longerth") 1, "" [0], line 0
|
|
Curl_str_quotedword
|
|
0: (""word"") 0, "word" [4], line 6
|
|
1: (""word") 4, "" [0], line 0
|
|
2: ("word"") 3, "" [0], line 0
|
|
3: (""word""") 0, "word" [4], line 6
|
|
4: (""word" ") 0, "word" [4], line 6
|
|
5: (" "word"") 3, "" [0], line 0
|
|
6: (""perfect"") 0, "perfect" [7], line 9
|
|
7: (""p r e t"") 0, "p r e t" [7], line 9
|
|
8: (""perfec\"") 0, "perfec\" [7], line 9
|
|
9: ("""") 0, "" [0], line 2
|
|
10: ("") 3, "" [0], line 0
|
|
11: (""longerth"") 1, "" [0], line 0
|
|
Curl_str_single
|
|
0: ("a") 0, line 1
|
|
1: ("aa") 0, line 1
|
|
2: ("A") 5, line 0
|
|
3: ("b") 5, line 0
|
|
4: ("\") 5, line 0
|
|
5: (" ") 5, line 0
|
|
6: ("") 5, line 0
|
|
Curl_str_singlespace
|
|
0: ("a") 5, line 0
|
|
1: ("aa") 5, line 0
|
|
2: ("A") 5, line 0
|
|
3: ("b") 5, line 0
|
|
4: ("\") 5, line 0
|
|
5: (" ") 0, line 1
|
|
6: (" ") 5, line 0
|
|
7: ("
|
|
") 5, line 0
|
|
8: ("") 5, line 0
|
|
Curl_str_single
|
|
0: ("a") 0, line 1
|
|
1: ("aa") 0, line 1
|
|
2: ("A") 5, line 0
|
|
3: ("b") 5, line 0
|
|
4: ("\") 5, line 0
|
|
5: (" ") 5, line 0
|
|
6: ("") 5, line 0
|
|
Curl_str_number
|
|
0: ("1") 0, [1] line 1
|
|
1: ("10000") 1, [0] line 4
|
|
2: ("1234") 0, [1234] line 4
|
|
3: ("1235") 0, [1235] line 4
|
|
4: ("1236") 1, [0] line 3
|
|
5: ("01234") 0, [1234] line 5
|
|
6: ("00000000000000000000000000001234") 0, [1234] line 32
|
|
7: ("0123 345") 0, [123] line 4
|
|
8: ("0123O345") 0, [123] line 4
|
|
9: ("-12") 8, [0] line 0
|
|
10: (" 123") 8, [0] line 0
|
|
11: ("") 8, [0] line 0
|
|
Curl_str_number / max
|
|
0: ("9223372036854775807") 0, [9223372036854775807] line 19
|
|
1: ("9223372036854775808") 7, [0] line 18
|
|
2: ("18446744073709551615") 7, [0] line 19
|
|
3: ("18446744073709551616") 7, [0] line 19
|
|
4: ("18446744073709551617") 7, [0] line 19
|
|
Curl_str_newline
|
|
0: ("a") 6, line 0
|
|
1: ("aa") 6, line 0
|
|
2: ("A") 6, line 0
|
|
3: ("b") 6, line 0
|
|
4: ("\") 6, line 0
|
|
5: (" ") 6, line 0
|
|
6: ("
|
|
") 0, line 1
|
|
7: ("
|
|
") 0, line 1
|
|
8: ("
|
|
") 0, line 1
|
|
9: ("") 6, line 0
|
|
Curl_str_hex
|
|
0: ("1") 0, [1] line 1
|
|
1: ("1000") 0, [4096] line 4
|
|
2: ("1234") 0, [4660] line 4
|
|
3: ("1235") 0, [4661] line 4
|
|
4: ("1236") 1, [0] line 3
|
|
5: ("01234") 0, [4660] line 5
|
|
6: ("00000000000000000000000000001234") 0, [4660] line 32
|
|
7: ("0123 345") 0, [291] line 4
|
|
8: ("0123O345") 0, [291] line 4
|
|
9: ("-12") 8, [0] line 0
|
|
10: (" 123") 8, [0] line 0
|
|
11: ("") 8, [0] line 0
|
|
Curl_str_octal
|
|
0: ("1") 0, [1] line 1
|
|
1: ("1000") 0, [512] line 4
|
|
2: ("1234") 0, [668] line 4
|
|
3: ("1235") 0, [669] line 4
|
|
4: ("1236") 1, [0] line 3
|
|
5: ("01234") 0, [668] line 5
|
|
6: ("00000000000000000000000000001234") 0, [668] line 32
|
|
7: ("0123 345") 0, [83] line 4
|
|
8: ("0123O345") 0, [83] line 4
|
|
9: ("-12") 8, [0] line 0
|
|
10: (" 123") 8, [0] line 0
|
|
11: ("") 8, [0] line 0
|
|
Curl_str_octal / max
|
|
0: ("777777777777777777777") 0, [9223372036854775807] line 21
|
|
1: ("1000000000000000000000") 7, [0] line 21
|
|
Curl_str_hex / max
|
|
0: ("7FFFFFFFFFFFFFFF") 0, [9223372036854775807] line 16
|
|
1: ("8000000000000000") 7, [0] line 15
|
|
</stdout>
|
|
</verify>
|
|
</testcase>
|