mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-22 12:29:23 +02:00
merge r17554 from cpstrnew branch by inoussa:
new tests. git-svn-id: trunk@19119 -
This commit is contained in:
parent
005795495d
commit
1d2778af24
3
.gitattributes
vendored
3
.gitattributes
vendored
@ -9948,6 +9948,9 @@ tests/test/tcpstr7.pp svneol=native#text/plain
|
|||||||
tests/test/tcpstr8.pp svneol=native#text/pascal
|
tests/test/tcpstr8.pp svneol=native#text/pascal
|
||||||
tests/test/tcpstransistrcompare.pp svneol=native#text/plain
|
tests/test/tcpstransistrcompare.pp svneol=native#text/plain
|
||||||
tests/test/tcpstransistrcompareequal.pp svneol=native#text/plain
|
tests/test/tcpstransistrcompareequal.pp svneol=native#text/plain
|
||||||
|
tests/test/tcpstrconcat.pp svneol=native#text/plain
|
||||||
|
tests/test/tcpstrconcat2.pp svneol=native#text/plain
|
||||||
|
tests/test/tcpstrconcat3.pp svneol=native#text/plain
|
||||||
tests/test/tcpstrconcatmulti.pp svneol=native#text/plain
|
tests/test/tcpstrconcatmulti.pp svneol=native#text/plain
|
||||||
tests/test/tcpstrconcatmulti2.pp svneol=native#text/plain
|
tests/test/tcpstrconcatmulti2.pp svneol=native#text/plain
|
||||||
tests/test/tcpstrsetlength.pp svneol=native#text/plain
|
tests/test/tcpstrsetlength.pp svneol=native#text/plain
|
||||||
|
36
tests/test/tcpstrconcat.pp
Normal file
36
tests/test/tcpstrconcat.pp
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
{$APPTYPE CONSOLE}
|
||||||
|
uses
|
||||||
|
{$ifdef unix}
|
||||||
|
cwstring,
|
||||||
|
{$endif unix}
|
||||||
|
SysUtils;
|
||||||
|
|
||||||
|
type
|
||||||
|
ts866 = type string<866>;
|
||||||
|
var
|
||||||
|
a, b, c : ts866;
|
||||||
|
begin
|
||||||
|
a := 'al';
|
||||||
|
b := 'b2';
|
||||||
|
c := '';
|
||||||
|
|
||||||
|
//without "DestS" in the array
|
||||||
|
c := a + b;
|
||||||
|
if (StringCodePage(c) <> 866) then
|
||||||
|
halt(1);
|
||||||
|
//with empty "DestS" in the array
|
||||||
|
c := '';
|
||||||
|
c := c + a ;
|
||||||
|
if (StringCodePage(c) <> 866) then
|
||||||
|
halt(2);
|
||||||
|
//with "DestS" in the array at the start
|
||||||
|
c := c + a ;
|
||||||
|
if (StringCodePage(c) <> 866) then
|
||||||
|
halt(3);
|
||||||
|
//with "DestS" in the array, not at the start
|
||||||
|
c := a + c;
|
||||||
|
if (StringCodePage(c) <> 866) then
|
||||||
|
halt(4);
|
||||||
|
|
||||||
|
WriteLn('ok');
|
||||||
|
end.
|
42
tests/test/tcpstrconcat2.pp
Normal file
42
tests/test/tcpstrconcat2.pp
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
{$APPTYPE CONSOLE}
|
||||||
|
uses
|
||||||
|
{$ifdef unix}
|
||||||
|
cwstring,
|
||||||
|
{$endif unix}
|
||||||
|
SysUtils;
|
||||||
|
|
||||||
|
type
|
||||||
|
ts866 = type string<866>;
|
||||||
|
var
|
||||||
|
a, b, c : ts866;
|
||||||
|
begin
|
||||||
|
a := '';
|
||||||
|
b := 'b2';
|
||||||
|
c := '';
|
||||||
|
c := a + b;
|
||||||
|
if (StringCodePage(c) <> 866) then
|
||||||
|
halt(1);
|
||||||
|
|
||||||
|
a := '';
|
||||||
|
b := 'b2';
|
||||||
|
c := 'azerty';
|
||||||
|
c := a + b;
|
||||||
|
if (StringCodePage(c) <> 866) then
|
||||||
|
halt(1);
|
||||||
|
|
||||||
|
a := 'x';
|
||||||
|
b := '';
|
||||||
|
c := '';
|
||||||
|
c := a + b;
|
||||||
|
if (StringCodePage(c) <> 866) then
|
||||||
|
halt(2);
|
||||||
|
|
||||||
|
a := 'x';
|
||||||
|
b := '';
|
||||||
|
c := '123';
|
||||||
|
c := a + b;
|
||||||
|
if (StringCodePage(c) <> 866) then
|
||||||
|
halt(2);
|
||||||
|
|
||||||
|
WriteLn('ok');
|
||||||
|
end.
|
53
tests/test/tcpstrconcat3.pp
Normal file
53
tests/test/tcpstrconcat3.pp
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
{$APPTYPE CONSOLE}
|
||||||
|
uses
|
||||||
|
{$ifdef unix}
|
||||||
|
cwstring,
|
||||||
|
{$endif unix}
|
||||||
|
SysUtils;
|
||||||
|
|
||||||
|
type
|
||||||
|
ts866 = type string<866>;
|
||||||
|
ts850 = type string<850>;
|
||||||
|
ts1251 = type string<1251>;
|
||||||
|
var
|
||||||
|
a : ts1251;
|
||||||
|
b : ts850;
|
||||||
|
c, d : ts866;
|
||||||
|
begin
|
||||||
|
a := 'al';
|
||||||
|
b := 'b2';
|
||||||
|
d := 'd4';
|
||||||
|
|
||||||
|
//without "DestS" in the array
|
||||||
|
c := '';
|
||||||
|
c := a + b;
|
||||||
|
if (StringCodePage(c) <> 866) then
|
||||||
|
halt(1);
|
||||||
|
c := '';
|
||||||
|
c := a + d;
|
||||||
|
if (StringCodePage(c) <> 866) then
|
||||||
|
halt(2);
|
||||||
|
c := '';
|
||||||
|
c := d + b;
|
||||||
|
if (StringCodePage(c) <> 866) then
|
||||||
|
halt(3);
|
||||||
|
//with empty "DestS" in the array
|
||||||
|
c := '';
|
||||||
|
c := c + a ;
|
||||||
|
if (StringCodePage(c) <> 866) then
|
||||||
|
halt(4);
|
||||||
|
c := '';
|
||||||
|
c := c + d ;
|
||||||
|
if (StringCodePage(c) <> 866) then
|
||||||
|
halt(5);
|
||||||
|
//with "DestS" in the array at the start
|
||||||
|
c := c + a ;
|
||||||
|
if (StringCodePage(c) <> 866) then
|
||||||
|
halt(6);
|
||||||
|
//with "DestS" in the array, not at the start
|
||||||
|
c := a + c;
|
||||||
|
if (StringCodePage(c) <> 866) then
|
||||||
|
halt(7);
|
||||||
|
|
||||||
|
WriteLn('ok');
|
||||||
|
end.
|
Loading…
Reference in New Issue
Block a user