mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-18 23:35:25 +00:00
Estimated hours taken: 1 library/string.m: Fix a bug in string__base_string_to_int: it was handling MININT incorrectly. tests/hard_coded/Mmakefile: tests/hard_coded/minint_bug.m: tests/hard_coded/minint_bug.exp: Regression test.
27 lines
643 B
Mathematica
27 lines
643 B
Mathematica
% regression test: versions 0.7.3 and earlier failed this test.
|
|
|
|
:- module minint_bug.
|
|
|
|
:- interface.
|
|
|
|
:- import_module io.
|
|
|
|
:- pred main(io__state::di, io__state::uo) is det.
|
|
|
|
:- implementation.
|
|
|
|
:- import_module int, list, string.
|
|
|
|
main -->
|
|
{ string__int_to_string(-2147483648, S) }, print(S), nl,
|
|
print(-2147483648), nl,
|
|
format("%d\n", [i(-2147483648)]).
|
|
/*
|
|
We could test the following too, but the correct output is machine-dependent,
|
|
which makes it difficult to validate the results of the test.
|
|
{ int__min_int(MinInt) },
|
|
{ string__int_to_string(MinInt, S2) }, print(S2), nl,
|
|
print(MinInt), nl,
|
|
format("%d\n", [i(MinInt)]), nl.
|
|
*/
|