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.
the integer is int.min_int. The previous behaviour seems unintuitive and means
we can't use the literal -2147483648 in Mercury programs on 32 bit machines,
even though that number can be represented in 32 bits.
library/string.m:
If the integer to be parsed is negative, then use a negative accumulator,
so that if the number is int.min_int it doesn't cause an overflow.
tests/general/base_string_to_int_test.exp:
tests/general/base_string_to_int_test.m:
Test it.
Estimated hours taken: 0.2
Branches: main
tests/general/Mmakefile:
tests/general/base_string_to_int.m:
tests/general/base_string_to_int.exp:
Added a test case for string.base_string_to_int/3.