mirror of
https://github.com/AdaCore/VSS.git
synced 2026-02-12 13:06:25 -08:00
49 lines
1.0 KiB
Ada
49 lines
1.0 KiB
Ada
--
|
|
-- Copyright (C) 2020, AdaCore
|
|
--
|
|
-- SPDX-License-Identifier: Apache-2.0
|
|
--
|
|
|
|
with VSS.Characters;
|
|
with VSS.Strings;
|
|
|
|
procedure Test_String_Buffer is
|
|
|
|
use type VSS.Strings.Virtual_String;
|
|
|
|
begin
|
|
-- Few append operations to null string.
|
|
|
|
declare
|
|
Buffer : VSS.Strings.Virtual_String;
|
|
|
|
begin
|
|
Buffer.Append ('A');
|
|
Buffer.Append ('ะ');
|
|
Buffer.Append ('เค');
|
|
Buffer.Append ('๐');
|
|
|
|
if Buffer /= VSS.Strings.To_Virtual_String ("Aะเค๐") then
|
|
raise Program_Error;
|
|
end if;
|
|
end;
|
|
|
|
-- Few append operations to small initial string, enough to overlow
|
|
-- "in place" data buffer.
|
|
|
|
declare
|
|
Buffer : VSS.Strings.Virtual_String :=
|
|
VSS.Strings.To_Virtual_String ("********");
|
|
|
|
begin
|
|
Buffer.Append ('A');
|
|
Buffer.Append ('ะ');
|
|
Buffer.Append ('เค');
|
|
Buffer.Append ('๐');
|
|
|
|
if Buffer /= VSS.Strings.To_Virtual_String ("********Aะเค๐") then
|
|
raise Program_Error;
|
|
end if;
|
|
end;
|
|
end Test_String_Buffer;
|