tascii85.pp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. {$mode objfpc}
  2. {$H+}
  3. Program tidea;
  4. Uses Classes,Ascii85;
  5. const
  6. EncodedString =
  7. '<~9jqo^BlbD-BleB1DJ+*+F(f,q/0JhKF<GL>[email protected]$d7F!,L7@<6@)/0JDEF<G%<+EV:2F!,'+LineEnding+
  8. 'O<DJ+*.@<*K0@<6L(Df-\0Ec5e;DffZ(EZee.Bl.9pF"AGXBPCsi+DGm>@3BB/F*&OCAfu2/AKY'+LineEnding+
  9. 'i(DIb:@FD,*)+C]U=@3BN#EcYf8ATD3s@q?d$AftVqCh[NqF<G:8+EV:.+Cf>-FD5W8ARlolDIa'+LineEnding+
  10. 'l(DId<j@<?3r@:F%a+D58''ATD4$Bl@l3De:,-DJs`8ARoFb/0JMK@qB4^F!,R<AKZ&-DfTqBG%G'+LineEnding+
  11. '>uD.RTpAKYo''+CT/5+Cei#DII?(E,9)oF*2M7/c~>';
  12. ExpectedResult = 'Man is distinguished, not only by his reason, but by this singular passion from other animals, which is a lust of the mind, that by a perseverance of delight'+
  13. ' in the continued and indefatigable generation of knowledge, exceeds the short vehemence of any carnal pleasure.';
  14. Var M : TMemorystream;
  15. DS : TASCII85DecoderStream;
  16. I,J : longint;
  17. s : string;
  18. c : char;
  19. begin
  20. M:=TMemoryStream.create;
  21. For i:=1 to Length(EncodedString) do
  22. M.Write(EncodedString[i],1);
  23. M.Seek(0,soBeginning);
  24. DS:=TASCII85DecoderStream.Create(M);
  25. While DS.Read(c,SizeOf(c))=1 do
  26. begin
  27. write(c);
  28. s:=s+c;
  29. end;
  30. writeln;
  31. DS.Free;
  32. M.Free;
  33. if s<>ExpectedResult then
  34. halt(1)
  35. else
  36. writeln('ok');
  37. end.