program fjf395b;

uses GPC;

type
  ta = ByteBool;
  tb = ShortBool;
  tc = WordBool;
  td = MedBool;
  te = LongBool;
  tf = LongestBool;
  tg = Boolean (1);
  th = Boolean (15);
  ti = Boolean (42);
  tj = Boolean (64);

  ca = ByteCard;
  cb = ShortCard;
  cc = Cardinal;
  cd = MedCard;
  ce = LongCard;
  cf = LongestCard;
  cg = Cardinal (1);
  ch = Cardinal (15);
  ci = Cardinal (42);
  cj = Cardinal (64);

var
  aa : ByteInt;
  ab : ShortInt;
  ac : Integer;
  ad : MedInt;
  ae : LongInt;
  af : LongestInt;
  ag : Integer (1);
  ah : Integer (15);
  ai : Integer (42);
  aj : Integer (64);
  t  : Integer = 42;

procedure Error (const Msg : String);
begin
  WriteLn (Msg);
  Halt
end;

{$define TEST(x)
  var b##x : t##x;
  if (SizeOf (b##x) <> SizeOf (a##x))
    or (BitSizeOf (b##x) <> BitSizeOf (a##x))
    or (AlignOf (b##x) <> AlignOf (a##x)) then Error (#x + ' Size');
  b##x := False;  if Ord (b##x) <> 0 then Error (#x + ' False 1');
  b##x := t < 42; if Ord (b##x) <> 0 then Error (#x + ' False 2');
  b##x := True;   if Ord (b##x) <> 1 then Error (#x + ' True 1');
  b##x := t = 42; if Ord (b##x) <> 1 then Error (#x + ' True 2');
  for a##x := Max (-999, Low (a##x)) to Min (999, High (a##x)) do
    begin
      b##x := t##x (a##x);
      if b##x xor (a##x <> 0) then Error (#x + ' Value ' + Integer2String (a##x));
      if Ord (b##x) <> c##x (a##x) then Error (#x + ' Ord ' + Integer2String (a##x))
    end;
}

begin
  TEST (a);
  TEST (b);
  TEST (c);
  TEST (d);
  TEST (e);
  TEST (f);
  TEST (g);
  TEST (h);
  TEST (i);
  TEST (j);
  WriteLn ('OK')
end.
