tcpstrconcatmulti.pp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. {$APPTYPE CONSOLE}
  2. // test "fpc_AnsiStr_Concat_multi" with a same type(same encoding)
  3. {$ifdef go32v2}
  4. {$define USE_INTERNAL_UNICODE}
  5. {$endif}
  6. {$ifdef USE_INTERNAL_UNICODE}
  7. {$define USE_FPWIDESTRING_UNIT}
  8. {$define USE_UNICODEDUCET_UNIT}
  9. {$define USE_CPALL_UNIT}
  10. {$endif}
  11. uses
  12. {$ifdef unix}
  13. {$ifdef darwin}iosxwstr{$else}cwstring{$endif},
  14. {$endif unix}
  15. {$ifdef USE_UNICODEDUCET_UNIT}
  16. unicodeducet,
  17. {$endif}
  18. {$ifdef USE_FPWIDESTRING_UNIT}
  19. fpwidestring,
  20. {$endif}
  21. {$ifdef USE_CPALL_UNIT}
  22. cpall,
  23. {$endif}
  24. sysutils;
  25. const
  26. {$ifdef android}
  27. cp = 1251;
  28. {$else}
  29. cp = 866;
  30. {$endif android}
  31. type
  32. ts866 = type AnsiString(cp);
  33. var
  34. a, b, c, d : ts866;
  35. begin
  36. a := 'al';
  37. b := 'b2';
  38. c := 'c3';
  39. //without "DestS" in the array
  40. d := a + b + c;
  41. if (StringCodePage(d) <> cp) then
  42. halt(1);
  43. //with empty "DestS" in the array
  44. d := '';
  45. d := d + a + b + c;
  46. if (StringCodePage(d) <> cp) then
  47. halt(2);
  48. //with "DestS" in the array at the start
  49. d := d + b + c;
  50. if (StringCodePage(d) <> cp) then
  51. halt(3);
  52. //with "DestS" in the array, not at the start
  53. d := a + b + d + c;
  54. if (StringCodePage(d) <> cp) then
  55. halt(4);
  56. WriteLn('ok');
  57. end.