mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-15 17:33:38 +00:00
string.base_string_to_int would incorrectly succeed on an input string containing a code point of multiple code units. string.foldl_between expects the length of the string in code units, but was passed the length of the string in code points. library/string.m: As above. tests/general/base_string_to_int_test.exp: tests/general/base_string_to_int_test.m: Extend test case.
16 lines
671 B
Plaintext
16 lines
671 B
Plaintext
string.base_string_to_int(10, "123", 123).
|
|
string.base_string_to_int(10, "+123", 123).
|
|
string.base_string_to_int(10, "-123", -123).
|
|
string.base_string_to_int(10, "", _) failed.
|
|
string.base_string_to_int(10, "+", _) failed.
|
|
string.base_string_to_int(10, "-", _) failed.
|
|
string.base_string_to_int(10, "123abc", _) failed.
|
|
string.base_string_to_int(10, "abc", _) failed.
|
|
string.base_string_to_int(10, "+abc", _) failed.
|
|
string.base_string_to_int(10, "-abc", _) failed.
|
|
string.base_string_to_int(10, "Σ", _) failed.
|
|
string.base_string_to_int(10, "-Σ", _) failed.
|
|
string.base_string_to_int(10, "+Σ", _) failed.
|
|
string.base_string_to_int(10, "123Σ", _) failed.
|
|
min_int ok.
|