testrep.pp 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. {
  2. This file is part of the Free Pascal Utilities
  3. Copyright (c) 1999-2000 by the Free Pascal development team
  4. See the file COPYING.FPC, included in this distribution,
  5. for details about the copyright.
  6. This program is distributed in the hope that it will be useful,
  7. but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  9. **********************************************************************}
  10. unit reptest;
  11. {$mode objfpc}{$H+}
  12. interface
  13. uses
  14. Classes, SysUtils, fprepos;
  15. // Num restricted to 1 2 3. 4 will create package with unsatisfied dependency.
  16. Function CreateTestRep(Num : Integer) : TFPRepository;
  17. Procedure FillFirstPackage(P : TFPPackage);
  18. Procedure FillSecondPackage(P : TFPPackage);
  19. Procedure FillThirdPackage(P : TFPPackage);
  20. Procedure FillFourthPackage(P : TFPPackage);
  21. implementation
  22. Procedure FillFirstPackage(P : TFPPackage);
  23. begin
  24. P.Author:='Michael Van Canneyt';
  25. P.URL:='http://www.freepascal.org/packages/firstpackage.zip';
  26. P.Email:='[email protected]';
  27. P.Version.AsString:='1.2.3';
  28. P.Description:='First package in the repository. Provides basic information.';
  29. P.OSes:=[Win32,linux];
  30. P.CPUs:=[i386,x86_64];
  31. end;
  32. Procedure FillSecondPackage(P : TFPPackage);
  33. begin
  34. P.Author:='Peter Vreman';
  35. P.URL:='http://www.freepascal.org/packages/secondpackage.zip';
  36. P.Email:='[email protected]';
  37. P.Version.AsString:='1.1.0';
  38. P.Description:='Second package in the repository. Provides extended information. Needs basic information.';
  39. P.AddDependency('FirstPackage','1.2.3');
  40. P.OSes:=[linux];
  41. P.CPUs:=[x86_64];
  42. end;
  43. Procedure FillThirdPackage(P : TFPPackage);
  44. begin
  45. P.Author:='Florian Klaempfl';
  46. P.URL:='http://www.freepascal.org/packages/thirdpackage.zip';
  47. P.Email:='[email protected]';
  48. P.Version.AsString:='2.1.0';
  49. P.Description:='Third package in the repository. Needs basic and extended information.';
  50. P.AddDependency('FirstPackage','1.0.0');
  51. P.AddDependency('SecondPackage','1.1.0');
  52. P.OSes:=[Win32];
  53. P.CPUs:=[i386];
  54. end;
  55. Procedure FillFourthPackage(P : TFPPackage);
  56. begin
  57. P.Author:='Bad guy';
  58. P.URL:='http://www.freepascal.org/packages/bad.zip';
  59. P.Email:='[email protected]';
  60. P.Version.AsString:='6.6.6';
  61. P.Description:='Fourth package in the repository. Random dependency.';
  62. P.AddDependency('FirstPackage','1.0.0');
  63. P.AddDependency('NonExistingPackage','3.2.1-?');
  64. end;
  65. Function CreateTestRep(Num : integer) : TFPRepository;
  66. begin
  67. Result:=TFPRepository.Create(Nil);
  68. FillFirstPackage(Result.AddPackage('FirstPackage'));
  69. If (Num>1) then
  70. FillSecondPackage(Result.AddPackage('SecondPackage'));
  71. If (Num>2) then
  72. FillThirdPackage(Result.AddPackage('ThirdPackage'));
  73. If (Num>3) then
  74. FillFourthPackage(Result.AddPackage('FourthPackage'));
  75. end;
  76. end.