mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-20 11:54:02 +00:00
runtime/mercury_string.h:
As above. Valid code points in the ranges [1D800, 1DFFF] and
[10D800, 10DFFF] were treated like invalid surrogates because the
high bits were masked away.
tests/hard_coded/Mmakefile:
tests/hard_coded/char_not_surrogate.exp:
tests/hard_coded/char_not_surrogate.m:
tests/hard_coded/string_not_surrogate.exp:
tests/hard_coded/string_not_surrogate.m:
Add test cases.
41 lines
1.0 KiB
Mathematica
41 lines
1.0 KiB
Mathematica
%---------------------------------------------------------------------------%
|
|
% vim: ts=4 sw=4 et ft=mercury
|
|
%---------------------------------------------------------------------------%
|
|
|
|
:- module char_not_surrogate.
|
|
:- interface.
|
|
|
|
:- import_module io.
|
|
|
|
:- pred main(io::di, io::uo) is det.
|
|
|
|
%---------------------------------------------------------------------------%
|
|
%---------------------------------------------------------------------------%
|
|
|
|
:- implementation.
|
|
|
|
:- import_module char.
|
|
:- import_module list.
|
|
:- import_module string.
|
|
|
|
%---------------------------------------------------------------------------%
|
|
|
|
main(!IO) :-
|
|
Chars = [
|
|
'\U0001D800',
|
|
'\U0001DFFF',
|
|
'\U0010D800',
|
|
'\U0010DFFF'
|
|
],
|
|
list.foldl(test, Chars, !IO).
|
|
|
|
:- pred test(char::in, io::di, io::uo) is det.
|
|
|
|
test(Char, !IO) :-
|
|
io.write_string("code point: ", !IO),
|
|
Int = char.to_int(Char),
|
|
io.format("0x%06x", [i(Int)], !IO),
|
|
io.nl(!IO).
|
|
|
|
%---------------------------------------------------------------------------%
|