tests.generics.bugs.pas 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. {
  2. This file is part of the Free Pascal run time library.
  3. Copyright (c) 2018 by Maciej Izak (hnb),
  4. member of the Free Pascal development team
  5. It contains tests for the Free Pascal generics library
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. Acknowledgment
  12. Thanks to Sphere 10 Software (http://sphere10.com) for sponsoring
  13. many new types, tests and major refactoring of entire library
  14. **********************************************************************}
  15. unit tests.generics.bugs;
  16. {$mode delphi}
  17. interface
  18. uses
  19. fpcunit, testregistry, testutils,
  20. Classes, SysUtils, Generics.Collections, Generics.Defaults;
  21. type
  22. { TTestBugs }
  23. TTestBugs = class(TTestCase)
  24. published
  25. procedure Test_QuadraticProbing_InfinityLoop;
  26. end;
  27. implementation
  28. { TTestBugs }
  29. procedure TTestBugs.Test_QuadraticProbing_InfinityLoop;
  30. // https://github.com/maciej-izak/generics.collections/issues/4
  31. var
  32. LMap: TOpenAddressingQP<string, pointer, TDelphiHashFactory>;
  33. begin
  34. LMap := TOpenAddressingQP<string, pointer, TDelphiHashFactory>.Create();
  35. LMap.Add(#178#178#107#141#143#151#168#39#172#38#83#194#130#90#101, nil);
  36. LMap.Add(#193#190#172#41#144#231#52#62#45#117#108#45#217#71#77, nil);
  37. LMap.Add(#49#116#202#160#38#131#41#37#217#171#227#215#122#151#71, nil);
  38. LMap.Add(#148#159#199#71#198#97#69#201#116#45#195#184#178#129#200, nil);
  39. CheckEquals(false, LMap.ContainsKey(#$E6'h=fzb'#$E5#$B4#$A0#$C4#$E6'B6r>'));
  40. LMap.Free;
  41. end;
  42. begin
  43. RegisterTest(TTestBugs);
  44. end.