summaryrefslogtreecommitdiff
path: root/fpcsrc/tests/webtbs/tw15500.pp
blob: 2c025c58e7a99bef4a04f4fd8a671fff7c94305e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
{$mode objfpc}{$H+}

uses
  SysUtils, fgl;

type
  TMap = specialize TFPGMap<String, String>;

var
  map: TMap;

const
  strings: array[0..4] of string =
    ('BaseDir', 'OutputDir', 'ModelName', 'Unit', 'SimSoftware');
var
  i, j: integer;
begin
  map := TMap.Create;
  map.Sorted := True;

  for i := low(strings) to high(strings) do
    map.add(strings[i], inttostr(i));

  for i := low(strings) to high(strings) do
  begin
    if not map.Find(strings[i], j) then
    begin
      writeln('not found: "', strings[i], '"');
      halt(1);
    end;
    if map.data[j] <> inttostr(i) then
    begin
      writeln('not matched: ', map.data[j], ' <> ', i);
      halt(1);
    end;
  end;

  map.Free;
end.