mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-16 18:03:36 +00:00
34 lines
988 B
Mathematica
34 lines
988 B
Mathematica
%---------------------------------------------------------------------------%
|
|
% vim: ts=4 sw=4 et ft=mercury
|
|
%---------------------------------------------------------------------------%
|
|
%
|
|
% Test the x, X specifiers of string.format with ints.
|
|
%
|
|
% The .exp file is for when int is 32-bit.
|
|
% The .exp2 file is for when int is 64-bit.
|
|
%
|
|
%---------------------------------------------------------------------------%
|
|
|
|
:- module string_format_x.
|
|
:- interface.
|
|
|
|
:- import_module io.
|
|
|
|
:- pred main(io::di, io::uo) is det.
|
|
|
|
%---------------------------------------------------------------------------%
|
|
|
|
:- implementation.
|
|
|
|
:- import_module int.
|
|
:- import_module list.
|
|
:- import_module string.
|
|
:- import_module string_format_lib.
|
|
|
|
main(!IO) :-
|
|
Ints = [i(0), i(1), i(10), i(100), i(max_int)],
|
|
list.foldl(output_list(Ints), format_strings("x"), !IO),
|
|
list.foldl(output_list(Ints), format_strings("X"), !IO).
|
|
|
|
%---------------------------------------------------------------------------%
|