Files
mercury/tests/hard_coded/minint_bug.m
Fergus Henderson 002ad1c8d8 Fix a bug in string__base_string_to_int:
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.
1998-03-18 14:16:20 +00:00

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.
*/