
(********************************************************************)
(*                                                                  *)
(*  chkarr.sd7    Checks arrays and array operations                *)
(*  Copyright (C) 2005, 2020  Thomas Mertes                         *)
(*                                                                  *)
(*  This program is free software; you can redistribute it and/or   *)
(*  modify it under the terms of the GNU General Public License as  *)
(*  published by the Free Software Foundation; either version 2 of  *)
(*  the License, or (at your option) any later version.             *)
(*                                                                  *)
(*  This program is distributed in the hope that it will be useful, *)
(*  but WITHOUT ANY WARRANTY; without even the implied warranty of  *)
(*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the   *)
(*  GNU General Public License for more details.                    *)
(*                                                                  *)
(*  You should have received a copy of the GNU General Public       *)
(*  License along with this program; if not, write to the           *)
(*  Free Software Foundation, Inc., 51 Franklin Street,             *)
(*  Fifth Floor, Boston, MA  02110-1301, USA.                       *)
(*                                                                  *)
(********************************************************************)


$ include "seed7_05.s7i";
  include "bigint.s7i";
  include "float.s7i";
  include "complex.s7i";


const array integer: testNumArr is [] (1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
const array string: testStriArr is [] ("1", "2", "3", "4", "5", "6", "7", "8", "9", "10");

const array float: fltArr1 is [] (3.14);
const array float: fltArr2 is [] (6.28, 9.42);
const array float: fltArr3 is [] (9.42, 6.28, 3.14);
const array float: fltArr4 is [] (12.56, 9.42, 6.28, 3.14);

const array integer: arr1 is [] (1, 2, 3, 4, 5, 6, 7, 8, 9, 10);

var array integer: arr2 is arr1;

var array [boolean] string: arr3 is [boolean] ("False", "True");

var array integer: arr4 is [5] (5, 6, 7, 8, 9, 10, 11, 12);


const func integer: intExpr (in integer: number) is
  return number + length(str(rand(1, 9))[2 ..]);


const func bigInteger: bigintExpr (in bigInteger: number) is func
  result
    var bigInteger: exprResult is 0_;
  begin
    exprResult := number;
  end func;


const func float: floatExpr (in float: number) is
  return number;


const func complex: complexExpr (in complex: number) is
  return number;


const func char: charExpr (in char: ch) is
  return chr(ord(ch) + length(str(rand(1, 9))[2 ..]));


const func string: striExpr (in string: stri) is
  return stri & str(rand(1, 9))[2 ..];


const func boolean: boolExpr (ref boolean: value) is
  return value and str(rand(1, 9))[2 ..] = "";


const func boolean: raisesIndexError (ref proc: statement) is func
  result
    var boolean: raisesIndexError is FALSE;
  begin
    block
      statement;
    exception
      catch INDEX_ERROR:
        raisesIndexError := TRUE;
    end block;
  end func;


const func boolean: raisesIndexError (ref func integer: expression) is func
  result
    var boolean: raisesIndexError is FALSE;
  local
    var integer: exprResult is 0;
  begin
    block
      exprResult := expression;
    exception
      catch INDEX_ERROR:
        raisesIndexError := TRUE;
    end block;
  end func;


const func boolean: raisesIndexError (ref func bigInteger: expression) is func
  result
    var boolean: raisesIndexError is FALSE;
  local
    var bigInteger: exprResult is 0_;
  begin
    block
      exprResult := expression;
    exception
      catch INDEX_ERROR:
        raisesIndexError := TRUE;
    end block;
  end func;


const func boolean: raisesIndexError (ref func float: expression) is func
  result
    var boolean: raisesIndexError is FALSE;
  local
    var float: exprResult is 0.0;
  begin
    block
      exprResult := expression;
    exception
      catch INDEX_ERROR:
        raisesIndexError := TRUE;
    end block;
  end func;


const func boolean: raisesIndexError (ref func complex: expression) is func
  result
    var boolean: raisesIndexError is FALSE;
  local
    var complex: exprResult is complex.value;
  begin
    block
      exprResult := expression;
    exception
      catch INDEX_ERROR:
        raisesIndexError := TRUE;
    end block;
  end func;


const func boolean: raisesIndexError (ref func char: expression) is func
  result
    var boolean: raisesIndexError is FALSE;
  local
    var char: exprResult is ' ';
  begin
    block
      exprResult := expression;
    exception
      catch INDEX_ERROR:
        raisesIndexError := TRUE;
    end block;
  end func;


const func boolean: raisesIndexError (ref func string: expression) is func
  result
    var boolean: raisesIndexError is FALSE;
  local
    var string: exprResult is "";
  begin
    block
      exprResult := expression;
    exception
      catch INDEX_ERROR:
        raisesIndexError := TRUE;
    end block;
  end func;


const func boolean: raisesIndexError (ref varfunc integer: expression) is func
  result
    var boolean: raisesIndexError is FALSE;
  local
    var integer: exprResult is 0;
  begin
    block
      exprResult := expression;
    exception
      catch INDEX_ERROR:
        raisesIndexError := TRUE;
    end block;
  end func;


const func boolean: raisesIndexError (ref varfunc bigInteger: expression) is func
  result
    var boolean: raisesIndexError is FALSE;
  local
    var bigInteger: exprResult is 0_;
  begin
    block
      exprResult := expression;
    exception
      catch INDEX_ERROR:
        raisesIndexError := TRUE;
    end block;
  end func;


const func boolean: raisesIndexError (ref varfunc float: expression) is func
  result
    var boolean: raisesIndexError is FALSE;
  local
    var float: exprResult is 0.0;
  begin
    block
      exprResult := expression;
    exception
      catch INDEX_ERROR:
        raisesIndexError := TRUE;
    end block;
  end func;


const func boolean: raisesIndexError (ref varfunc complex: expression) is func
  result
    var boolean: raisesIndexError is FALSE;
  local
    var complex: exprResult is complex.value;
  begin
    block
      exprResult := expression;
    exception
      catch INDEX_ERROR:
        raisesIndexError := TRUE;
    end block;
  end func;


const func boolean: raisesIndexError (ref varfunc char: expression) is func
  result
    var boolean: raisesIndexError is FALSE;
  local
    var char: exprResult is ' ';
  begin
    block
      exprResult := expression;
    exception
      catch INDEX_ERROR:
        raisesIndexError := TRUE;
    end block;
  end func;


const func boolean: raisesIndexError (ref varfunc string: expression) is func
  result
    var boolean: raisesIndexError is FALSE;
  local
    var string: exprResult is "";
  begin
    block
      exprResult := expression;
    exception
      catch INDEX_ERROR:
        raisesIndexError := TRUE;
    end block;
  end func;


const func boolean: raisesIndexError (ref func array integer: expression) is func
  result
    var boolean: raisesIndexError is FALSE;
  local
    var array integer: exprResult is 0 times 0;
  begin
    block
      exprResult := expression;
    exception
      catch INDEX_ERROR:
        raisesIndexError := TRUE;
    end block;
  end func;


const func boolean: raisesIndexError (ref func array bigInteger: expression) is func
  result
    var boolean: raisesIndexError is FALSE;
  local
    var array bigInteger: exprResult is 0 times 0_;
  begin
    block
      exprResult := expression;
    exception
      catch INDEX_ERROR:
        raisesIndexError := TRUE;
    end block;
  end func;


const func boolean: raisesIndexError (ref func array float: expression) is func
  result
    var boolean: raisesIndexError is FALSE;
  local
    var array float: exprResult is 0 times 0.0;
  begin
    block
      exprResult := expression;
    exception
      catch INDEX_ERROR:
        raisesIndexError := TRUE;
    end block;
  end func;


const func boolean: raisesIndexError (ref func array complex: expression) is func
  result
    var boolean: raisesIndexError is FALSE;
  local
    var array complex: exprResult is 0 times complex.value;
  begin
    block
      exprResult := expression;
    exception
      catch INDEX_ERROR:
        raisesIndexError := TRUE;
    end block;
  end func;


const func boolean: raisesIndexError (ref func array char: expression) is func
  result
    var boolean: raisesIndexError is FALSE;
  local
    var array char: exprResult is 0 times ' ';
  begin
    block
      exprResult := expression;
    exception
      catch INDEX_ERROR:
        raisesIndexError := TRUE;
    end block;
  end func;


const func boolean: raisesIndexError (ref func array string: expression) is func
  result
    var boolean: raisesIndexError is FALSE;
  local
    var array string: exprResult is 0 times "";
  begin
    block
      exprResult := expression;
    exception
      catch INDEX_ERROR:
        raisesIndexError := TRUE;
    end block;
  end func;


const proc: subprog1 is func
  local
    var array integer: arr3 is 0 times 0;
  begin
    arr3 &:= arr1;
  end func;


const proc: testSpecial is func
  begin
    arr2 &:= arr2;
    arr2 &:= arr2;
    arr2 := arr2 & arr2;
    subprog1;
    arr2 := arr1;
    write("arr3[FALSE]=");
    writeln(arr3[FALSE]);
    write("arr3[TRUE]=");
    writeln(arr3[TRUE]);
    writeln;
    arr3[FALSE] := "*F*";
    write("arr3[FALSE]=");
    writeln(arr3[FALSE]);
    write("arr3[TRUE]=");
    writeln(arr3[TRUE]);
    writeln;
    arr3[TRUE] := "*T*";
    write("arr3[FALSE]=");
    writeln(arr3[FALSE]);
    write("arr3[TRUE]=");
    writeln(arr3[TRUE]);
    writeln;
    writeln(minIdx(arr4) <& " .. " <& maxIdx(arr4));
    arr2 := arr4[5 .. 7];
    writeln(minIdx(arr2) <& " .. " <& maxIdx(arr2));
    writeln(arr2[5] <& " " <& arr2[6] <& " " <& arr2[7]);
    arr2 := arr4[7 .. 10];
    writeln(minIdx(arr2) <& " .. " <& maxIdx(arr2));
    writeln(arr2[5] <& " " <& arr2[6] <& " " <& arr2[7] <& " " <& arr2[8]);
    arr2 := arr4[8 ..];
    writeln(minIdx(arr2) <& " .. " <& maxIdx(arr2));
    writeln(arr2[5] <& " " <& arr2[6] <& " " <& arr2[7] <& " " <& arr2[8] <& " " <& arr2[9]);
  end func;


const func string: striRand (in integer: maxLen) is func
  result
    var string: randStri is "";
  local
    var integer: length is 0;
    var integer: index is 0;
  begin
    length := rand(0, maxLen);
    randStri := " " mult length;
    for index range 1 to length do
      randStri @:= [index] rand('!', '~');
    end for;
  end func;


const proc: testArraySort is func
  local
    var integer: striLen is 0;
    var integer: testNumber is 0;
    var integer: arraySize is 0;
    var integer: number is 0;
    var array string: stringArray is 0 times "";
    var string: symbol is "";
    var array string: sortedArray is 0 times "";
  begin
    for striLen range 1 to 20 do
      writeln("striLen=" <& striLen);
      for testNumber range 1 to 5 do
        writeln("testNumber=" <& testNumber);
        for arraySize range 0 to 500 do
          # writeln("arraySize=" <& arraySize);
          stringArray := 0 times "";
          for number range 1 to arraySize do
            stringArray &:= [] (striRand(striLen));
          end for;
          sortedArray := sort(stringArray);
          for number range 2 to length(sortedArray) do
            if sortedArray[pred(number)] > sortedArray[number] then
              writeln("*** " <& literal(sortedArray[pred(number)]) <&
                  ">" <& literal(sortedArray[number]));
            end if;
          end for;
        end for;
      end for;
    end for;
  end func;


const proc: testArrayCopy is func
  local
    var integer: striLen is 0;
    var integer: testNumber is 0;
    var integer: arraySize is 0;
    var integer: number is 0;
    var integer: count is 0;
    var array string: stringArray is 0 times "";
    var string: symbol is "";
    var array string: destArray is 0 times "";
  begin
    for striLen range 1 to 20 do
      writeln("striLen=" <& striLen);
      for testNumber range 1 to 5 do
        writeln("testNumber=" <& testNumber);
        for arraySize range 0 to 500 do
          # writeln("arraySize=" <& arraySize);
          stringArray := 0 times "";
          for number range 1 to arraySize do
            stringArray &:= [] (striRand(striLen));
          end for;
          for count range 1 to 5 do
            destArray := stringArray;
          end for;
        end for;
      end for;
    end for;
  end func;


const proc: testCompare is func
  local
    var boolean: okay is TRUE;
    var array integer: intArr is [] (1, 2, 3, 4, 5, 6, 7);
    var array bigInteger: bigArr is [] (1_, 2_, 3_, 4_, 5_, 6_, 7_);
    var array float: fltArr is [] (1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0);
    var array complex: cpxArr is [] (complex(1.0, 1.0), complex(2.0, 2.0), complex(3.0, 3.0),
        complex(4.0, 4.0), complex(5.0, 5.0), complex(6.0, 6.0), complex(7.0, 7.0));
    var array char: chrArr is [] ('a', 'b', 'c', 'd', 'e', 'f', 'g');
    var array string: strArr is [] ("one", "two", "three", "four", "five", "six", "seven");
    var array integer: intArr2 is [] (1, 2, 3, 4, 5, 6, 7);
    var array bigInteger: bigArr2 is [] (1_, 2_, 3_, 4_, 5_, 6_, 7_);
    var array float: fltArr2 is [] (1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0);
    var array complex: cpxArr2 is [] (complex(1.0, 1.0), complex(2.0, 2.0), complex(3.0, 3.0),
        complex(4.0, 4.0), complex(5.0, 5.0), complex(6.0, 6.0), complex(7.0, 7.0));
    var array char: chrArr2 is [] ('a', 'b', 'c', 'd', 'e', 'f', 'g');
    var array string: strArr2 is [] ("one", "two", "three", "four", "five", "six", "seven");
    const array integer: intArrConst is [] (1, 2, 3, 4, 5, 6, 7);
    const array bigInteger: bigArrConst is [] (1_, 2_, 3_, 4_, 5_, 6_, 7_);
    const array float: fltArrConst is [] (1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0);
    const array complex: cpxArrConst is [] (complex(1.0, 1.0), complex(2.0, 2.0), complex(3.0, 3.0),
        complex(4.0, 4.0), complex(5.0, 5.0), complex(6.0, 6.0), complex(7.0, 7.0));
    const array char: chrArrConst is [] ('a', 'b', 'c', 'd', 'e', 'f', 'g');
    const array string: strArrConst is [] ("one", "two", "three", "four", "five", "six", "seven");
  begin
    if intArr <> intArr then
      writeln(" ***** Comparison of integer arrays failed. (1)");
      okay := FALSE;
    end if;
    if intArr <> [] (1, 2, 3, 4, 5, 6, 7) then
      writeln(" ***** Comparison of integer arrays failed. (2)");
      okay := FALSE;
    end if;
    if [] (1, 2, 3, 4, 5, 6, 7) <> intArr then
      writeln(" ***** Comparison of integer arrays failed. (3)");
      okay := FALSE;
    end if;
    if [] (1, 2, 3, 4, 5, 6, 7) <> [] (1, 2, 3, 4, 5, 6, 7) then
      writeln(" ***** Comparison of integer arrays failed. (4)");
      okay := FALSE;
    end if;
    if intArr <> intArr2 then
      writeln(" ***** Comparison of integer arrays failed. (5)");
      okay := FALSE;
    end if;
    if intArr <> intArrConst then
      writeln(" ***** Comparison of integer arrays failed. (6)");
      okay := FALSE;
    end if;
    if intArrConst <> intArr then
      writeln(" ***** Comparison of integer arrays failed. (7)");
      okay := FALSE;
    end if;
    if intArrConst <> intArrConst then
      writeln(" ***** Comparison of integer arrays failed. (8)");
      okay := FALSE;
    end if;

    if bigArr <> bigArr then
      writeln(" ***** Comparison of bigInteger arrays failed. (1)");
      okay := FALSE;
    end if;
    if bigArr <> [] (1_, 2_, 3_, 4_, 5_, 6_, 7_) then
      writeln(" ***** Comparison of bigInteger arrays failed. (2)");
      okay := FALSE;
    end if;
    if [] (1_, 2_, 3_, 4_, 5_, 6_, 7_) <> bigArr then
      writeln(" ***** Comparison of bigInteger arrays failed. (3)");
      okay := FALSE;
    end if;
    if [] (1_, 2_, 3_, 4_, 5_, 6_, 7_) <> [] (1_, 2_, 3_, 4_, 5_, 6_, 7_) then
      writeln(" ***** Comparison of bigInteger arrays failed. (4)");
      okay := FALSE;
    end if;
    if bigArr <> bigArr2 then
      writeln(" ***** Comparison of bigInteger arrays failed. (5)");
      okay := FALSE;
    end if;
    if bigArr <> bigArrConst then
      writeln(" ***** Comparison of bigInteger arrays failed. (6)");
      okay := FALSE;
    end if;
    if bigArrConst <> bigArr then
      writeln(" ***** Comparison of bigInteger arrays failed. (7)");
      okay := FALSE;
    end if;
    if bigArrConst <> bigArrConst then
      writeln(" ***** Comparison of bigInteger arrays failed. (8)");
      okay := FALSE;
    end if;

    if fltArr <> fltArr then
      writeln(" ***** Comparison of float arrays failed. (1)");
      okay := FALSE;
    end if;
    if fltArr <> [] (1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0) then
      writeln(" ***** Comparison of float arrays failed. (2)");
      okay := FALSE;
    end if;
    if [] (1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0) <> fltArr then
      writeln(" ***** Comparison of float arrays failed. (3)");
      okay := FALSE;
    end if;
    if [] (1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0) <> [] (1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0) then
      writeln(" ***** Comparison of float arrays failed. (4)");
      okay := FALSE;
    end if;
    if fltArr <> fltArr2 then
      writeln(" ***** Comparison of float arrays failed. (5)");
      okay := FALSE;
    end if;
    if fltArr <> fltArrConst then
      writeln(" ***** Comparison of float arrays failed. (6)");
      okay := FALSE;
    end if;
    if fltArrConst <> fltArr then
      writeln(" ***** Comparison of float arrays failed. (7)");
      okay := FALSE;
    end if;
    if fltArrConst <> fltArrConst then
      writeln(" ***** Comparison of float arrays failed. (8)");
      okay := FALSE;
    end if;

    if cpxArr <> cpxArr then
      writeln(" ***** Comparison of complex arrays failed. (1)");
      okay := FALSE;
    end if;
    if cpxArr <> [] (complex(1.0, 1.0), complex(2.0, 2.0), complex(3.0, 3.0),
                     complex(4.0, 4.0), complex(5.0, 5.0), complex(6.0, 6.0),
                     complex(7.0, 7.0)) then
      writeln(" ***** Comparison of complex arrays failed. (2)");
      okay := FALSE;
    end if;
    if [] (complex(1.0, 1.0), complex(2.0, 2.0), complex(3.0, 3.0),
           complex(4.0, 4.0), complex(5.0, 5.0), complex(6.0, 6.0),
           complex(7.0, 7.0)) <> cpxArr then
      writeln(" ***** Comparison of complex arrays failed. (3)");
      okay := FALSE;
    end if;
    if  [] (complex(1.0, 1.0), complex(2.0, 2.0), complex(3.0, 3.0),
            complex(4.0, 4.0), complex(5.0, 5.0), complex(6.0, 6.0),
            complex(7.0, 7.0)) <>
        [] (complex(1.0, 1.0), complex(2.0, 2.0), complex(3.0, 3.0),
            complex(4.0, 4.0), complex(5.0, 5.0), complex(6.0, 6.0),
            complex(7.0, 7.0)) then
      writeln(" ***** Comparison of complex arrays failed. (4)");
      okay := FALSE;
    end if;
    if cpxArr <> cpxArr2 then
      writeln(" ***** Comparison of complex arrays failed. (5)");
      okay := FALSE;
    end if;
    if cpxArr <> cpxArrConst then
      writeln(" ***** Comparison of complex arrays failed. (6)");
      okay := FALSE;
    end if;
    if cpxArrConst <> cpxArr then
      writeln(" ***** Comparison of complex arrays failed. (7)");
      okay := FALSE;
    end if;
    if cpxArrConst <> cpxArrConst then
      writeln(" ***** Comparison of complex arrays failed. (8)");
      okay := FALSE;
    end if;

    if chrArr <> chrArr then
      writeln(" ***** Comparison of char arrays failed. (1)");
      okay := FALSE;
    end if;
    if chrArr <> [] ('a', 'b', 'c', 'd', 'e', 'f', 'g') then
      writeln(" ***** Comparison of char arrays failed. (2)");
      okay := FALSE;
    end if;
    if [] ('a', 'b', 'c', 'd', 'e', 'f', 'g') <> chrArr then
      writeln(" ***** Comparison of char arrays failed. (3)");
      okay := FALSE;
    end if;
    if [] ('a', 'b', 'c', 'd', 'e', 'f', 'g') <> [] ('a', 'b', 'c', 'd', 'e', 'f', 'g') then
      writeln(" ***** Comparison of char arrays failed. (4)");
      okay := FALSE;
    end if;
    if chrArr <> chrArr2 then
      writeln(" ***** Comparison of char arrays failed. (5)");
      okay := FALSE;
    end if;
    if chrArr <> chrArrConst then
      writeln(" ***** Comparison of char arrays failed. (6)");
      okay := FALSE;
    end if;
    if chrArrConst <> chrArr then
      writeln(" ***** Comparison of char arrays failed. (7)");
      okay := FALSE;
    end if;
    if chrArrConst <> chrArrConst then
      writeln(" ***** Comparison of char arrays failed. (8)");
      okay := FALSE;
    end if;

    if strArr <> strArr then
      writeln(" ***** Comparison of string arrays failed. (1)");
      okay := FALSE;
    end if;
    if strArr <> [] ("one", "two", "three", "four", "five", "six", "seven") then
      writeln(" ***** Comparison of string arrays failed. (2)");
      okay := FALSE;
    end if;
    if [] ("one", "two", "three", "four", "five", "six", "seven") <> strArr then
      writeln(" ***** Comparison of string arrays failed. (3)");
      okay := FALSE;
    end if;
    if  [] ("one", "two", "three", "four", "five", "six", "seven") <>
        [] ("one", "two", "three", "four", "five", "six", "seven") then
      writeln(" ***** Comparison of string arrays failed. (4)");
      okay := FALSE;
    end if;
    if strArr <> strArr2 then
      writeln(" ***** Comparison of string arrays failed. (5)");
      okay := FALSE;
    end if;
    if strArr <> strArrConst then
      writeln(" ***** Comparison of string arrays failed. (6)");
      okay := FALSE;
    end if;
    if strArrConst <> strArr then
      writeln(" ***** Comparison of string arrays failed. (7)");
      okay := FALSE;
    end if;
    if strArrConst <> strArrConst then
      writeln(" ***** Comparison of string arrays failed. (8)");
      okay := FALSE;
    end if;

    if okay then
      writeln("Array comparison works correct.");
    end if;
  end func;


const proc: testAssign is func
  local
    var boolean: okay is TRUE;
    var array integer: intArr is [] (1, 2, 3, 4, 5, 6, 7);
    var array bigInteger: bigArr is [] (1_, 2_, 3_, 4_, 5_, 6_, 7_);
    var array float: fltArr is [] (1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0);
    var array complex: cpxArr is [] (complex(1.0, 1.0), complex(2.0, 2.0), complex(3.0, 3.0),
        complex(4.0, 4.0), complex(5.0, 5.0), complex(6.0, 6.0), complex(7.0, 7.0));
    var array char: chrArr is [] ('a', 'b', 'c', 'd', 'e', 'f', 'g');
    var array string: strArr is [] ("one", "two", "three", "four", "five", "six", "seven");
  begin
    intArr := intArr;
    if intArr <> [] (1, 2, 3, 4, 5, 6, 7) then
      writeln(" ***** array assignment for 'array integer' does not work correct");
      okay := FALSE;
    end if;

    bigArr := bigArr;
    if bigArr <> [] (1_, 2_, 3_, 4_, 5_, 6_, 7_) then
      writeln(" ***** array assignment for 'array bigInteger' does not work correct");
      okay := FALSE;
    end if;

    fltArr := fltArr;
    if fltArr <> [] (1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0) then
      writeln(" ***** array assignment for 'array float' does not work correct");
      okay := FALSE;
    end if;

    cpxArr := cpxArr;
    if cpxArr <> [] (complex(1.0, 1.0), complex(2.0, 2.0), complex(3.0, 3.0),
                     complex(4.0, 4.0), complex(5.0, 5.0), complex(6.0, 6.0),
                     complex(7.0, 7.0)) then
      writeln(" ***** array assignment for 'array complex' does not work correct");
      okay := FALSE;
    end if;

    chrArr := chrArr;
    if chrArr <> [] ('a', 'b', 'c', 'd', 'e', 'f', 'g') then
      writeln(" ***** array assignment for 'array char' does not work correct");
      okay := FALSE;
    end if;

    strArr := strArr;
    if strArr <> [] ("one", "two", "three", "four", "five", "six", "seven") then
      writeln(" ***** array assignment for 'array string' does not work correct");
      okay := FALSE;
    end if;

    if okay then
      writeln("Array assignment works correct.");
    end if;
  end func;


const proc: testAppend is func
  local
    var boolean: okay is TRUE;
    var array integer: intArr is [] (1, 2, 3, 4);
    var array bigInteger: bigArr is [] (1_, 2_, 3_, 4_);
    var array float: fltArr is [] (1.0, 2.0, 3.0, 4.0);
    var array complex: cpxArr is [] (complex(1.0, 1.0), complex(2.0, 2.0), complex(3.0, 3.0),
        complex(4.0, 4.0));
    var array char: chrArr is [] ('a', 'b', 'c', 'd');
    var array string: strArr is [] ("one", "two", "three", "four");
  begin
    intArr &:= intArr;
    if intArr <> [] (1, 2, 3, 4, 1, 2, 3, 4) then
      writeln(" ***** array append ( &:= ) for 'array integer' does not work correct");
      okay := FALSE;
    end if;

    bigArr &:= bigArr;
    if bigArr <> [] (1_, 2_, 3_, 4_, 1_, 2_, 3_, 4_) then
      writeln(" ***** array append ( &:= ) for 'array bigInteger' does not work correct");
      okay := FALSE;
    end if;

    fltArr &:= fltArr;
    if fltArr <> [] (1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0) then
      writeln(" ***** array append ( &:= ) for 'array float' does not work correct");
      okay := FALSE;
    end if;

    cpxArr &:= cpxArr;
    if cpxArr <> [] (complex(1.0, 1.0), complex(2.0, 2.0), complex(3.0, 3.0),
                     complex(4.0, 4.0), complex(1.0, 1.0), complex(2.0, 2.0),
                     complex(3.0, 3.0), complex(4.0, 4.0)) then
      writeln(" ***** array append ( &:= ) for 'array complex' does not work correct");
      okay := FALSE;
    end if;

    chrArr &:= chrArr;
    if chrArr <> [] ('a', 'b', 'c', 'd', 'a', 'b', 'c', 'd') then
      writeln(" ***** array append ( &:= ) for 'array char' does not work correct");
      okay := FALSE;
    end if;

    strArr &:= strArr;
    if strArr <> [] ("one", "two", "three", "four", "one", "two", "three", "four") then
      writeln(" ***** array append ( &:= ) for 'array string' does not work correct");
      okay := FALSE;
    end if;

    if okay then
      writeln("Array append ( &:= ) works correct.");
    end if;
  end func;


const proc: testIndex is func
  local
    var boolean: okay is TRUE;
    var array integer: intArr is [] (1, 2, 3, 4, 5, 6, 7);
    var array bigInteger: bigArr is [] (1_, 2_, 3_, 4_, 5_, 6_, 7_);
    var array float: fltArr is [] (1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0);
    var array complex: cpxArr is [] (complex(1.0, 1.0), complex(2.0, 2.0), complex(3.0, 3.0),
        complex(4.0, 4.0), complex(5.0, 5.0), complex(6.0, 6.0), complex(7.0, 7.0));
    var array char: chrArr is [] ('a', 'b', 'c', 'd', 'e', 'f', 'g');
    var array string: strArr is [] ("one", "two", "three", "four", "five", "six", "seven");
    var integer: intElem is 0;
    var bigInteger: bigElem is 0_;
    var float: fltElem is 0.0;
    var complex: cpxElem is complex(0.0, 0.0);
    var char: chrElem is ' ';
    var string: strElem is "";
  begin
    if length(intArr) <> 7 or intArr[1] <> 1 or intArr[2] <> 2 or intArr[3] <> 3 or
            intArr[4] <> 4 or intArr[5] <> 5 or intArr[6] <> 6 or intArr[7] <> 7 then
      writeln(" ***** ARRAY [ INDEX ] for integer array failed. (1)");
      okay := FALSE;
    end if;
    intElem := (intArr & intArr)[8];
    if intElem <> 1 then
      writeln(" ***** ARRAY [ INDEX ] for integer array failed. (2)");
      okay := FALSE;
    end if;

    if length(bigArr) <> 7 or bigArr[1] <> 1_ or bigArr[2] <> 2_ or bigArr[3] <> 3_ or
           bigArr[4] <> 4_ or bigArr[5] <> 5_ or bigArr[6] <> 6_ or bigArr[7] <> 7_ then
      writeln(" ***** ARRAY [ INDEX ] for bigInteger array failed. (1)");
      okay := FALSE;
    end if;
    bigElem := (bigArr & bigArr)[8];
    if bigElem <> 1_ then
      writeln(" ***** ARRAY [ INDEX ] for bigInteger array failed. (2)");
      okay := FALSE;
    end if;

    if length(fltArr) <> 7 or fltArr[1] <> 1.0 or fltArr[2] <> 2.0 or fltArr[3] <> 3.0 or
          fltArr[4] <> 4.0 or fltArr[5] <> 5.0 or fltArr[6] <> 6.0 or fltArr[7] <> 7.0 then
      writeln(" ***** ARRAY [ INDEX ] for float array failed. (1)");
      okay := FALSE;
    end if;
    fltElem := (fltArr & fltArr)[8];
    if fltElem <> 1.0 then
      writeln(" ***** ARRAY [ INDEX ] for float array failed. (2)");
      okay := FALSE;
    end if;

    if length(cpxArr) <> 7 or cpxArr[1] <> complex(1.0, 1.0) or cpxArr[2] <> complex(2.0, 2.0) or
                              cpxArr[3] <> complex(3.0, 3.0) or cpxArr[4] <> complex(4.0, 4.0) or
                              cpxArr[5] <> complex(5.0, 5.0) or cpxArr[6] <> complex(6.0, 6.0) or
                              cpxArr[7] <> complex(7.0, 7.0) then
      writeln(" ***** ARRAY [ INDEX ] for complex array failed. (1)");
      okay := FALSE;
    end if;
    cpxElem := (cpxArr & cpxArr)[8];
    if cpxElem <> complex(1.0, 1.0) then
      writeln(" ***** ARRAY [ INDEX ] for complex array failed. (2)");
      okay := FALSE;
    end if;

    if length(chrArr) <> 7 or chrArr[1] <> 'a' or chrArr[2] <> 'b' or chrArr[3] <> 'c' or
          chrArr[4] <> 'd' or chrArr[5] <> 'e' or chrArr[6] <> 'f' or chrArr[7] <> 'g' then
      writeln(" ***** ARRAY [ INDEX ] for char array failed. (1)");
      okay := FALSE;
    end if;
    chrElem := (chrArr & chrArr)[8];
    if chrElem <> 'a' then
      writeln(" ***** ARRAY [ INDEX ] for char array failed. (2)");
      okay := FALSE;
    end if;

    if length(strArr) <> 7 or strArr[1] <> "one"  or strArr[2] <> "two"  or strArr[3] <> "three" or
                              strArr[4] <> "four" or strArr[5] <> "five" or strArr[6] <> "six"   or
                              strArr[7] <> "seven" then
      writeln(" ***** ARRAY [ INDEX ] for string array failed. (1)");
      okay := FALSE;
    end if;
    strElem := (strArr & strArr)[8];
    if strElem <> "one" then
      writeln(" ***** ARRAY [ INDEX ] for string array failed. (2)");
      okay := FALSE;
    end if;

    if  not raisesIndexError(intArr[integer.first]) or
        not raisesIndexError(bigArr[integer.first]) or
        not raisesIndexError(fltArr[integer.first]) or
        not raisesIndexError(cpxArr[integer.first]) or
        not raisesIndexError(chrArr[integer.first]) or
        not raisesIndexError(strArr[integer.first]) or
        not raisesIndexError(intArr[0]) or
        not raisesIndexError(bigArr[0]) or
        not raisesIndexError(fltArr[0]) or
        not raisesIndexError(cpxArr[0]) or
        not raisesIndexError(chrArr[0]) or
        not raisesIndexError(strArr[0]) or
        not raisesIndexError(intArr[8]) or
        not raisesIndexError(bigArr[8]) or
        not raisesIndexError(fltArr[8]) or
        not raisesIndexError(cpxArr[8]) or
        not raisesIndexError(chrArr[8]) or
        not raisesIndexError(strArr[8]) or
        not raisesIndexError(intArr[integer.last]) or
        not raisesIndexError(bigArr[integer.last]) or
        not raisesIndexError(fltArr[integer.last]) or
        not raisesIndexError(cpxArr[integer.last]) or
        not raisesIndexError(chrArr[integer.last]) or
        not raisesIndexError(strArr[integer.last]) then
      writeln(" ***** Index access with index out of range does not raise INDEX_ERROR. (1)");
      okay := FALSE;
    end if;

    if  not raisesIndexError((intArr & intArr)[integer.first]) or
        not raisesIndexError((bigArr & bigArr)[integer.first]) or
        not raisesIndexError((fltArr & fltArr)[integer.first]) or
        not raisesIndexError((cpxArr & cpxArr)[integer.first]) or
        not raisesIndexError((chrArr & chrArr)[integer.first]) or
        not raisesIndexError((strArr & strArr)[integer.first]) or
        not raisesIndexError((intArr & intArr)[0]) or
        not raisesIndexError((bigArr & bigArr)[0]) or
        not raisesIndexError((fltArr & fltArr)[0]) or
        not raisesIndexError((cpxArr & cpxArr)[0]) or
        not raisesIndexError((chrArr & chrArr)[0]) or
        not raisesIndexError((strArr & strArr)[0]) or
        not raisesIndexError((intArr & intArr)[15]) or
        not raisesIndexError((bigArr & bigArr)[15]) or
        not raisesIndexError((fltArr & fltArr)[15]) or
        not raisesIndexError((cpxArr & cpxArr)[15]) or
        not raisesIndexError((chrArr & chrArr)[15]) or
        not raisesIndexError((strArr & strArr)[15]) or
        not raisesIndexError((intArr & intArr)[integer.last]) or
        not raisesIndexError((bigArr & bigArr)[integer.last]) or
        not raisesIndexError((fltArr & fltArr)[integer.last]) or
        not raisesIndexError((cpxArr & cpxArr)[integer.last]) or
        not raisesIndexError((chrArr & chrArr)[integer.last]) or
        not raisesIndexError((strArr & strArr)[integer.last]) then
      writeln(" ***** Index access with index out of range does not raise INDEX_ERROR. (2)");
      okay := FALSE;
    end if;

    if okay then
      writeln("Index access of array element works correct.");
    end if;
  end func;


const proc: testHeadAndTail is func
  local
    var boolean: okay is TRUE;
    var array integer: numArr is testNumArr;
    var array string: striArr is testStriArr;
    var integer: num1 is 0;
    var integer: num2 is 0;
  begin
    for num1 range 1 to 10 do
      numArr := numArr[.. pred(num1)] & [] (num1) & numArr[succ(num1) ..];
    end for;
    if numArr <> testNumArr then
      writeln(" ***** array head and tail operations do not work correct");
      okay := FALSE;
    end if;
    for num1 range 1 to 10 do
      for num2 range pred(num1) to 11 do
        if numArr[.. num2][num1 ..] <> numArr[num1 .. num2] then
          writeln(" ***** Error head, tail or range");
          okay := FALSE;
        end if;
      end for;
    end for;
    for num1 range 1 to 10 do
      for num2 range pred(num1) to 11 do
        if numArr[num1 ..][.. succ(num2 - num1)] <> numArr[num1 .. num2] then
          writeln(" ***** Error head, tail or range");
          okay := FALSE;
        end if;
      end for;
    end for;
    for num1 range 1 to 10 do
      striArr := striArr[.. pred(num1)] & [] (str(num1)) & striArr[succ(num1) ..];
    end for;
    if striArr <> testStriArr then
      writeln(" ***** array head and tail operations do not work correct");
      okay := FALSE;
    end if;
    for num1 range 1 to 10 do
      for num2 range pred(num1) to 11 do
        if striArr[.. num2][num1 ..] <> striArr[num1 .. num2] then
          writeln(" ***** Error head, tail or range");
          okay := FALSE;
        end if;
      end for;
    end for;
    for num1 range 1 to 10 do
      for num2 range pred(num1) to 11 do
        if striArr[num1 ..][.. succ(num2 - num1)] <> striArr[num1 .. num2] then
          writeln(" ***** Error head, tail or range");
          okay := FALSE;
        end if;
      end for;
    end for;
    if okay then
      writeln("Array head and tail operations work correct.");
    end if;
  end func;


const proc: testHead is func
  local
    var boolean: okay is TRUE;
    var array integer: intArr is [] (1, 2, 3, 4, 5, 6, 7);
    var array bigInteger: bigArr is [] (1_, 2_, 3_, 4_, 5_, 6_, 7_);
    var array float: fltArr is [] (1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0);
    var array complex: cpxArr is [] (complex(1.0, 1.0), complex(2.0, 2.0), complex(3.0, 3.0),
        complex(4.0, 4.0), complex(5.0, 5.0), complex(6.0, 6.0), complex(7.0, 7.0));
    var array char: chrArr is [] ('a', 'b', 'c', 'd', 'e', 'f', 'g');
    var array string: strArr is [] ("one", "two", "three", "four", "five", "six", "seven");
    var array integer: intHead is 0 times 0;
    var array bigInteger: bigHead is 0 times 0_;
    var array float: fltHead is 0 times 0.0;
    var array complex: cpxHead is 0 times complex(0.0, 0.0);
    var array char: chrHead is 0 times ' ';
    var array string: strHead is 0 times "";
  begin
    intHead := intArr[.. 7];
    if length(intHead) <> 7 or intHead[1] <> 1 or intHead[2] <> 2 or intHead[3] <> 3 or
            intHead[4] <> 4 or intHead[5] <> 5 or intHead[6] <> 6 or intHead[7] <> 7 then
      writeln(" ***** ARRAY [ INDEX .. ] for integer array failed. (1)");
      okay := FALSE;
    end if;
    intHead := intArr[.. intExpr(7)];
    if length(intHead) <> 7 or intHead[1] <> 1 or intHead[2] <> 2 or intHead[3] <> 3 or
            intHead[4] <> 4 or intHead[5] <> 5 or intHead[6] <> 6 or intHead[7] <> 7 then
      writeln(" ***** ARRAY [ INDEX .. ] for integer array failed. (2)");
      okay := FALSE;
    end if;
    intHead := intArr[.. intExpr(6)];
    if length(intHead) <> 6 or intHead[1] <> 1 or intHead[2] <> 2 or intHead[3] <> 3 or
                               intHead[4] <> 4 or intHead[5] <> 5 or intHead[6] <> 6 then
      writeln(" ***** ARRAY [ INDEX .. ] for integer array failed. (3)");
      okay := FALSE;
    end if;
    intHead := intArr[.. 0];
    if length(intHead) <> 0 then
      writeln(" ***** ARRAY [ INDEX .. ] for integer array failed. (4)");
      okay := FALSE;
    end if;
    intHead := intArr[.. intExpr(0)];
    if length(intHead) <> 0 then
      writeln(" ***** ARRAY [ INDEX .. ] for integer array failed. (5)");
      okay := FALSE;
    end if;
    intHead := intArr[.. intExpr(1)];
    if length(intHead) <> 1 or intHead[1] <> 1 then
      writeln(" ***** ARRAY [ INDEX .. ] for integer array failed. (6)");
      okay := FALSE;
    end if;
    intHead := intArr[.. intExpr(2)];
    if length(intHead) <> 2 or intHead[1] <> 1 or intHead[2] <> 2 then
      writeln(" ***** ARRAY [ INDEX .. ] for integer array failed. (7)");
      okay := FALSE;
    end if;
    intHead := (intHead & [](3, 4))[.. 3];
    if length(intHead) <> 3 or intHead[1] <> 1 or intHead[2] <> 2 or intHead[3] <> 3 then
      writeln(" ***** ARRAY [ INDEX .. ] for integer array failed. (8)");
      okay := FALSE;
    end if;
    intHead := ([](1, 2) & [](3, 4))[.. 3];
    if length(intHead) <> 3 or intHead[1] <> 1 or intHead[2] <> 2 or intHead[3] <> 3 then
      writeln(" ***** ARRAY [ INDEX .. ] for integer array failed. (9)");
      okay := FALSE;
    end if;
    intArr := intArr[.. 7];
    if length(intArr) <> 7 or intArr[1] <> 1 or intArr[2] <> 2 or intArr[3] <> 3 or
            intArr[4] <> 4 or intArr[5] <> 5 or intArr[6] <> 6 or intArr[7] <> 7 then
      writeln(" ***** ARRAY [ INDEX .. ] for integer array failed. (10)");
      okay := FALSE;
    end if;
    intArr := intArr[.. intExpr(7)];
    if length(intArr) <> 7 or intArr[1] <> 1 or intArr[2] <> 2 or intArr[3] <> 3 or
            intArr[4] <> 4 or intArr[5] <> 5 or intArr[6] <> 6 or intArr[7] <> 7 then
      writeln(" ***** ARRAY [ INDEX .. ] for integer array failed. (11)");
      okay := FALSE;
    end if;
    intArr := intArr[.. intExpr(6)];
    if length(intArr) <> 6 or intArr[1] <> 1 or intArr[2] <> 2 or intArr[3] <> 3 or
                              intArr[4] <> 4 or intArr[5] <> 5 or intArr[6] <> 6 then
      writeln(" ***** ARRAY [ INDEX .. ] for integer array failed. (12)");
      okay := FALSE;
    end if;

    bigHead := bigArr[.. 7];
    if length(bigHead) <> 7 or bigHead[1] <> 1_ or bigHead[2] <> 2_ or bigHead[3] <> 3_ or
           bigHead[4] <> 4_ or bigHead[5] <> 5_ or bigHead[6] <> 6_ or bigHead[7] <> 7_ then
      writeln(" ***** ARRAY [ INDEX .. ] for bigInteger array failed. (1)");
      okay := FALSE;
    end if;
    bigHead := bigArr[.. intExpr(7)];
    if length(bigHead) <> 7 or bigHead[1] <> 1_ or bigHead[2] <> 2_ or bigHead[3] <> 3_ or
           bigHead[4] <> 4_ or bigHead[5] <> 5_ or bigHead[6] <> 6_ or bigHead[7] <> 7_ then
      writeln(" ***** ARRAY [ INDEX .. ] for bigInteger array failed. (2)");
      okay := FALSE;
    end if;
    bigHead := bigArr[.. intExpr(6)];
    if length(bigHead) <> 6 or bigHead[1] <> 1_ or bigHead[2] <> 2_ or bigHead[3] <> 3_ or
                               bigHead[4] <> 4_ or bigHead[5] <> 5_ or bigHead[6] <> 6_ then
      writeln(" ***** ARRAY [ INDEX .. ] for bigInteger array failed. (3)");
      okay := FALSE;
    end if;
    bigHead := bigArr[.. 0];
    if length(bigHead) <> 0 then
      writeln(" ***** ARRAY [ INDEX .. ] for bigInteger array failed. (4)");
      okay := FALSE;
    end if;
    bigHead := bigArr[.. intExpr(0)];
    if length(bigHead) <> 0 then
      writeln(" ***** ARRAY [ INDEX .. ] for bigInteger array failed. (5)");
      okay := FALSE;
    end if;
    bigHead := bigArr[.. intExpr(1)];
    if length(bigHead) <> 1 or bigHead[1] <> 1_ then
      writeln(" ***** ARRAY [ INDEX .. ] for bigInteger array failed. (6)");
      okay := FALSE;
    end if;
    bigHead := bigArr[.. intExpr(2)];
    if length(bigHead) <> 2 or bigHead[1] <> 1_ or bigHead[2] <> 2_ then
      writeln(" ***** ARRAY [ INDEX .. ] for bigInteger array failed. (7)");
      okay := FALSE;
    end if;
    bigHead := (bigHead & [](3_, 4_))[.. 3];
    if length(bigHead) <> 3 or bigHead[1] <> 1_ or bigHead[2] <> 2_ or bigHead[3] <> 3_ then
      writeln(" ***** ARRAY [ INDEX .. ] for bigInteger array failed. (8)");
      okay := FALSE;
    end if;
    bigHead := ([](1_, 2_) & [](3_, 4_))[.. 3];
    if length(bigHead) <> 3 or bigHead[1] <> 1_ or bigHead[2] <> 2_ or bigHead[3] <> 3_ then
      writeln(" ***** ARRAY [ INDEX .. ] for bigInteger array failed. (9)");
      okay := FALSE;
    end if;
    bigArr := bigArr[.. 7];
    if length(bigArr) <> 7 or bigArr[1] <> 1_ or bigArr[2] <> 2_ or bigArr[3] <> 3_ or
           bigArr[4] <> 4_ or bigArr[5] <> 5_ or bigArr[6] <> 6_ or bigArr[7] <> 7_ then
      writeln(" ***** ARRAY [ INDEX .. ] for bigInteger array failed. (10)");
      okay := FALSE;
    end if;
    bigArr := bigArr[.. intExpr(7)];
    if length(bigArr) <> 7 or bigArr[1] <> 1_ or bigArr[2] <> 2_ or bigArr[3] <> 3_ or
           bigArr[4] <> 4_ or bigArr[5] <> 5_ or bigArr[6] <> 6_ or bigArr[7] <> 7_ then
      writeln(" ***** ARRAY [ INDEX .. ] for bigInteger array failed. (11)");
      okay := FALSE;
    end if;
    bigArr := bigArr[.. intExpr(6)];
    if length(bigArr) <> 6 or bigArr[1] <> 1_ or bigArr[2] <> 2_ or bigArr[3] <> 3_ or
                              bigArr[4] <> 4_ or bigArr[5] <> 5_ or bigArr[6] <> 6_ then
      writeln(" ***** ARRAY [ INDEX .. ] for bigInteger array failed. (12)");
      okay := FALSE;
    end if;

    fltHead := fltArr[.. 7];
    if length(fltHead) <> 7 or fltHead[1] <> 1.0 or fltHead[2] <> 2.0 or fltHead[3] <> 3.0 or
          fltHead[4] <> 4.0 or fltHead[5] <> 5.0 or fltHead[6] <> 6.0 or fltHead[7] <> 7.0 then
      writeln(" ***** ARRAY [ INDEX .. ] for float array failed. (1)");
      okay := FALSE;
    end if;
    fltHead := fltArr[.. intExpr(7)];
    if length(fltHead) <> 7 or fltHead[1] <> 1.0 or fltHead[2] <> 2.0 or fltHead[3] <> 3.0 or
          fltHead[4] <> 4.0 or fltHead[5] <> 5.0 or fltHead[6] <> 6.0 or fltHead[7] <> 7.0 then
      writeln(" ***** ARRAY [ INDEX .. ] for float array failed. (2)");
      okay := FALSE;
    end if;
    fltHead := fltArr[.. intExpr(6)];
    if length(fltHead) <> 6 or fltHead[1] <> 1.0 or fltHead[2] <> 2.0 or fltHead[3] <> 3.0 or
                               fltHead[4] <> 4.0 or fltHead[5] <> 5.0 or fltHead[6] <> 6.0 then
      writeln(" ***** ARRAY [ INDEX .. ] for float array failed. (3)");
      okay := FALSE;
    end if;
    fltHead := fltArr[.. 0];
    if length(fltHead) <> 0 then
      writeln(" ***** ARRAY [ INDEX .. ] for float array failed. (4)");
      okay := FALSE;
    end if;
    fltHead := fltArr[.. intExpr(0)];
    if length(fltHead) <> 0 then
      writeln(" ***** ARRAY [ INDEX .. ] for float array failed. (5)");
      okay := FALSE;
    end if;
    fltHead := fltArr[.. intExpr(1)];
    if length(fltHead) <> 1 or fltHead[1] <> 1.0 then
      writeln(" ***** ARRAY [ INDEX .. ] for float array failed. (6)");
      okay := FALSE;
    end if;
    fltHead := fltArr[.. intExpr(2)];
    if length(fltHead) <> 2 or fltHead[1] <> 1.0 or fltHead[2] <> 2.0 then
      writeln(" ***** ARRAY [ INDEX .. ] for float array failed. (7)");
      okay := FALSE;
    end if;
    fltHead := (fltHead & [](3.0, 4.0))[.. 3];
    if length(fltHead) <> 3 or fltHead[1] <> 1.0 or fltHead[2] <> 2.0 or fltHead[3] <> 3.0 then
      writeln(" ***** ARRAY [ INDEX .. ] for float array failed. (8)");
      okay := FALSE;
    end if;
    fltHead := ([](1.0, 2.0) & [](3.0, 4.0))[.. 3];
    if length(fltHead) <> 3 or fltHead[1] <> 1.0 or fltHead[2] <> 2.0 or fltHead[3] <> 3.0 then
      writeln(" ***** ARRAY [ INDEX .. ] for float array failed. (9)");
      okay := FALSE;
    end if;
    fltArr := fltArr[.. 7];
    if length(fltArr) <> 7 or fltArr[1] <> 1.0 or fltArr[2] <> 2.0 or fltArr[3] <> 3.0 or
          fltArr[4] <> 4.0 or fltArr[5] <> 5.0 or fltArr[6] <> 6.0 or fltArr[7] <> 7.0 then
      writeln(" ***** ARRAY [ INDEX .. ] for float array failed. (10)");
      okay := FALSE;
    end if;
    fltArr := fltArr[.. intExpr(7)];
    if length(fltArr) <> 7 or fltArr[1] <> 1.0 or fltArr[2] <> 2.0 or fltArr[3] <> 3.0 or
          fltArr[4] <> 4.0 or fltArr[5] <> 5.0 or fltArr[6] <> 6.0 or fltArr[7] <> 7.0 then
      writeln(" ***** ARRAY [ INDEX .. ] for float array failed. (11)");
      okay := FALSE;
    end if;
    fltArr := fltArr[.. intExpr(6)];
    if length(fltArr) <> 6 or fltArr[1] <> 1.0 or fltArr[2] <> 2.0 or fltArr[3] <> 3.0 or
                              fltArr[4] <> 4.0 or fltArr[5] <> 5.0 or fltArr[6] <> 6.0 then
      writeln(" ***** ARRAY [ INDEX .. ] for float array failed. (12)");
      okay := FALSE;
    end if;

    cpxHead := cpxArr[.. 7];
    if length(cpxHead) <> 7 or cpxHead[1] <> complex(1.0, 1.0) or cpxHead[2] <> complex(2.0, 2.0) or
                               cpxHead[3] <> complex(3.0, 3.0) or cpxHead[4] <> complex(4.0, 4.0) or
                               cpxHead[5] <> complex(5.0, 5.0) or cpxHead[6] <> complex(6.0, 6.0) or
                               cpxHead[7] <> complex(7.0, 7.0) then
      writeln(" ***** ARRAY [ INDEX .. ] for complex array failed. (1)");
      okay := FALSE;
    end if;
    cpxHead := cpxArr[.. intExpr(7)];
    if length(cpxHead) <> 7 or cpxHead[1] <> complex(1.0, 1.0) or cpxHead[2] <> complex(2.0, 2.0) or
                               cpxHead[3] <> complex(3.0, 3.0) or cpxHead[4] <> complex(4.0, 4.0) or
                               cpxHead[5] <> complex(5.0, 5.0) or cpxHead[6] <> complex(6.0, 6.0) or
                               cpxHead[7] <> complex(7.0, 7.0) then
      writeln(" ***** ARRAY [ INDEX .. ] for complex array failed. (2)");
      okay := FALSE;
    end if;
    cpxHead := cpxArr[.. intExpr(6)];
    if length(cpxHead) <> 6 or cpxHead[1] <> complex(1.0, 1.0) or cpxHead[2] <> complex(2.0, 2.0) or
                               cpxHead[3] <> complex(3.0, 3.0) or cpxHead[4] <> complex(4.0, 4.0) or
                               cpxHead[5] <> complex(5.0, 5.0) or cpxHead[6] <> complex(6.0, 6.0) then
      writeln(" ***** ARRAY [ INDEX .. ] for complex array failed. (3)");
      okay := FALSE;
    end if;
    cpxHead := cpxArr[.. 0];
    if length(cpxHead) <> 0 then
      writeln(" ***** ARRAY [ INDEX .. ] for complex array failed. (4)");
      okay := FALSE;
    end if;
    cpxHead := cpxArr[.. intExpr(0)];
    if length(cpxHead) <> 0 then
      writeln(" ***** ARRAY [ INDEX .. ] for complex array failed. (5)");
      okay := FALSE;
    end if;
    cpxHead := cpxArr[.. intExpr(1)];
    if length(cpxHead) <> 1 or cpxHead[1] <> complex(1.0, 1.0) then
      writeln(" ***** ARRAY [ INDEX .. ] for complex array failed. (6)");
      okay := FALSE;
    end if;
    cpxHead := cpxArr[.. intExpr(2)];
    if length(cpxHead) <> 2 or cpxHead[1] <> complex(1.0, 1.0) or cpxHead[2] <> complex(2.0, 2.0) then
      writeln(" ***** ARRAY [ INDEX .. ] for complex array failed. (7)");
      okay := FALSE;
    end if;
    cpxHead := (cpxHead & [](complex(3.0, 3.0), complex(4.0, 4.0)))[.. 3];
    if length(cpxHead) <> 3 or cpxHead[1] <> complex(1.0, 1.0) or cpxHead[2] <> complex(2.0, 2.0) or
                               cpxHead[3] <> complex(3.0, 3.0) then
      writeln(" ***** ARRAY [ INDEX .. ] for complex array failed. (8)");
      okay := FALSE;
    end if;
    cpxHead := ([](complex(1.0, 1.0), complex(2.0, 2.0)) &
                [](complex(3.0, 3.0), complex(4.0, 4.0)))[.. 3];
    if length(cpxHead) <> 3 or cpxHead[1] <> complex(1.0, 1.0) or cpxHead[2] <> complex(2.0, 2.0) or
                               cpxHead[3] <> complex(3.0, 3.0) then
      writeln(" ***** ARRAY [ INDEX .. ] for complex array failed. (9)");
      okay := FALSE;
    end if;
    cpxArr := cpxArr[.. 7];
    if length(cpxArr) <> 7 or cpxArr[1] <> complex(1.0, 1.0) or cpxArr[2] <> complex(2.0, 2.0) or
                              cpxArr[3] <> complex(3.0, 3.0) or cpxArr[4] <> complex(4.0, 4.0) or
                              cpxArr[5] <> complex(5.0, 5.0) or cpxArr[6] <> complex(6.0, 6.0) or
                              cpxArr[7] <> complex(7.0, 7.0) then
      writeln(" ***** ARRAY [ INDEX .. ] for complex array failed. (10)");
      okay := FALSE;
    end if;
    cpxArr := cpxArr[.. intExpr(7)];
    if length(cpxArr) <> 7 or cpxArr[1] <> complex(1.0, 1.0) or cpxArr[2] <> complex(2.0, 2.0) or
                              cpxArr[3] <> complex(3.0, 3.0) or cpxArr[4] <> complex(4.0, 4.0) or
                              cpxArr[5] <> complex(5.0, 5.0) or cpxArr[6] <> complex(6.0, 6.0) or
                              cpxArr[7] <> complex(7.0, 7.0) then
      writeln(" ***** ARRAY [ INDEX .. ] for complex array failed. (11)");
      okay := FALSE;
    end if;
    cpxArr := cpxArr[.. intExpr(6)];
    if length(cpxArr) <> 6 or cpxArr[1] <> complex(1.0, 1.0) or cpxArr[2] <> complex(2.0, 2.0) or
                              cpxArr[3] <> complex(3.0, 3.0) or cpxArr[4] <> complex(4.0, 4.0) or
                              cpxArr[5] <> complex(5.0, 5.0) or cpxArr[6] <> complex(6.0, 6.0) then
      writeln(" ***** ARRAY [ INDEX .. ] for complex array failed. (12)");
      okay := FALSE;
    end if;

    chrHead := chrArr[.. 7];
    if length(chrHead) <> 7 or chrHead[1] <> 'a' or chrHead[2] <> 'b' or chrHead[3] <> 'c' or
            chrHead[4] <> 'd' or chrHead[5] <> 'e' or chrHead[6] <> 'f' or chrHead[7] <> 'g' then
      writeln(" ***** ARRAY [ INDEX .. ] for char array failed. (1)");
      okay := FALSE;
    end if;
    chrHead := chrArr[.. intExpr(7)];
    if length(chrHead) <> 7 or chrHead[1] <> 'a' or chrHead[2] <> 'b' or chrHead[3] <> 'c' or
            chrHead[4] <> 'd' or chrHead[5] <> 'e' or chrHead[6] <> 'f' or chrHead[7] <> 'g' then
      writeln(" ***** ARRAY [ INDEX .. ] for char array failed. (2)");
      okay := FALSE;
    end if;
    chrHead := chrArr[.. intExpr(6)];
    if length(chrHead) <> 6 or chrHead[1] <> 'a' or chrHead[2] <> 'b' or chrHead[3] <> 'c' or
                               chrHead[4] <> 'd' or chrHead[5] <> 'e' or chrHead[6] <> 'f' then
      writeln(" ***** ARRAY [ INDEX .. ] for char array failed. (3)");
      okay := FALSE;
    end if;
    chrHead := chrArr[.. 0];
    if length(chrHead) <> 0 then
      writeln(" ***** ARRAY [ INDEX .. ] for char array failed. (4)");
      okay := FALSE;
    end if;
    chrHead := chrArr[.. intExpr(0)];
    if length(chrHead) <> 0 then
      writeln(" ***** ARRAY [ INDEX .. ] for char array failed. (5)");
      okay := FALSE;
    end if;
    chrHead := chrArr[.. intExpr(1)];
    if length(chrHead) <> 1 or chrHead[1] <> 'a' then
      writeln(" ***** ARRAY [ INDEX .. ] for char array failed. (6)");
      okay := FALSE;
    end if;
    chrHead := chrArr[.. intExpr(2)];
    if length(chrHead) <> 2 or chrHead[1] <> 'a' or chrHead[2] <> 'b' then
      writeln(" ***** ARRAY [ INDEX .. ] for char array failed. (7)");
      okay := FALSE;
    end if;
    chrHead := (chrHead & []('c', 'd'))[.. 3];
    if length(chrHead) <> 3 or chrHead[1] <> 'a' or chrHead[2] <> 'b' or chrHead[3] <> 'c' then
      writeln(" ***** ARRAY [ INDEX .. ] for char array failed. (8)");
      okay := FALSE;
    end if;
    chrHead := ([]('a', 'b') & []('c', 'd'))[.. 3];
    if length(chrHead) <> 3 or chrHead[1] <> 'a' or chrHead[2] <> 'b' or chrHead[3] <> 'c' then
      writeln(" ***** ARRAY [ INDEX .. ] for char array failed. (9)");
      okay := FALSE;
    end if;
    chrArr := chrArr[.. 7];
    if length(chrArr) <> 7 or chrArr[1] <> 'a' or chrArr[2] <> 'b' or chrArr[3] <> 'c' or
            chrArr[4] <> 'd' or chrArr[5] <> 'e' or chrArr[6] <> 'f' or chrArr[7] <> 'g' then
      writeln(" ***** ARRAY [ INDEX .. ] for char array failed. (10)");
      okay := FALSE;
    end if;
    chrArr := chrArr[.. intExpr(7)];
    if length(chrArr) <> 7 or chrArr[1] <> 'a' or chrArr[2] <> 'b' or chrArr[3] <> 'c' or
            chrArr[4] <> 'd' or chrArr[5] <> 'e' or chrArr[6] <> 'f' or chrArr[7] <> 'g' then
      writeln(" ***** ARRAY [ INDEX .. ] for char array failed. (11)");
      okay := FALSE;
    end if;
    chrArr := chrArr[.. intExpr(6)];
    if length(chrArr) <> 6 or chrArr[1] <> 'a' or chrArr[2] <> 'b' or chrArr[3] <> 'c' or
                              chrArr[4] <> 'd' or chrArr[5] <> 'e' or chrArr[6] <> 'f' then
      writeln(" ***** ARRAY [ INDEX .. ] for char array failed. (12)");
      okay := FALSE;
    end if;

    strHead := strArr[.. 7];
    if length(strHead) <> 7 or strHead[1] <> "one" or strHead[2] <> "two" or strHead[3] <> "three" or
            strHead[4] <> "four" or strHead[5] <> "five" or strHead[6] <> "six" or strHead[7] <> "seven" then
      writeln(" ***** ARRAY [ INDEX .. ] for string array failed. (1)");
      okay := FALSE;
    end if;
    strHead := strArr[.. intExpr(7)];
    if length(strHead) <> 7 or strHead[1] <> "one" or strHead[2] <> "two" or strHead[3] <> "three" or
            strHead[4] <> "four" or strHead[5] <> "five" or strHead[6] <> "six" or strHead[7] <> "seven" then
      writeln(" ***** ARRAY [ INDEX .. ] for string array failed. (2)");
      okay := FALSE;
    end if;
    strHead := strArr[.. intExpr(6)];
    if length(strHead) <> 6 or strHead[1] <> "one" or strHead[2] <> "two" or strHead[3] <> "three" or
                               strHead[4] <> "four" or strHead[5] <> "five" or strHead[6] <> "six" then
      writeln(" ***** ARRAY [ INDEX .. ] for string array failed. (3)");
      okay := FALSE;
    end if;
    strHead := strArr[.. 0];
    if length(strHead) <> 0 then
      writeln(" ***** ARRAY [ INDEX .. ] for string array failed. (4)");
      okay := FALSE;
    end if;
    strHead := strArr[.. intExpr(0)];
    if length(strHead) <> 0 then
      writeln(" ***** ARRAY [ INDEX .. ] for string array failed. (5)");
      okay := FALSE;
    end if;
    strHead := strArr[.. intExpr(1)];
    if length(strHead) <> 1 or strHead[1] <> "one" then
      writeln(" ***** ARRAY [ INDEX .. ] for string array failed. (6)");
      okay := FALSE;
    end if;
    strHead := strArr[.. intExpr(2)];
    if length(strHead) <> 2 or strHead[1] <> "one" or strHead[2] <> "two" then
      writeln(" ***** ARRAY [ INDEX .. ] for string array failed. (7)");
      okay := FALSE;
    end if;
    strHead := ([]("one", "two") & []("three", "four"))[.. 3];
    if length(strHead) <> 3 or strHead[1] <> "one" or strHead[2] <> "two" or strHead[3] <> "three" then
      writeln(" ***** ARRAY [ INDEX .. ] for string array failed. (8)");
      okay := FALSE;
    end if;
    strHead := (strHead & []("three", "four"))[.. 3];
    if length(strHead) <> 3 or strHead[1] <> "one" or strHead[2] <> "two" or strHead[3] <> "three" then
      writeln(" ***** ARRAY [ INDEX .. ] for string array failed. (9)");
      okay := FALSE;
    end if;
    strArr := strArr[.. 7];
    if length(strArr) <> 7 or strArr[1] <> "one" or strArr[2] <> "two" or strArr[3] <> "three" or
            strArr[4] <> "four" or strArr[5] <> "five" or strArr[6] <> "six" or strArr[7] <> "seven" then
      writeln(" ***** ARRAY [ INDEX .. ] for string array failed. (10)");
      okay := FALSE;
    end if;
    strArr := strArr[.. intExpr(7)];
    if length(strArr) <> 7 or strArr[1] <> "one" or strArr[2] <> "two" or strArr[3] <> "three" or
            strArr[4] <> "four" or strArr[5] <> "five" or strArr[6] <> "six" or strArr[7] <> "seven" then
      writeln(" ***** ARRAY [ INDEX .. ] for string array failed. (11)");
      okay := FALSE;
    end if;
    strArr := strArr[.. intExpr(6)];
    if length(strArr) <> 6 or strArr[1] <> "one" or strArr[2] <> "two" or strArr[3] <> "three" or
                              strArr[4] <> "four" or strArr[5] <> "five" or strArr[6] <> "six" then
      writeln(" ***** ARRAY [ INDEX .. ] for string array failed. (12)");
      okay := FALSE;
    end if;

    if  not raisesIndexError(intArr[.. integer.first]) or
        not raisesIndexError(bigArr[.. integer.first]) or
        not raisesIndexError(fltArr[.. integer.first]) or
        not raisesIndexError(cpxArr[.. integer.first]) or
        not raisesIndexError(chrArr[.. integer.first]) or
        not raisesIndexError(strArr[.. integer.first]) or
        not raisesIndexError(intArr[.. -1]) or
        not raisesIndexError(bigArr[.. -1]) or
        not raisesIndexError(fltArr[.. -1]) or
        not raisesIndexError(cpxArr[.. -1]) or
        not raisesIndexError(chrArr[.. -1]) or
        not raisesIndexError(strArr[.. -1]) (* or
        not raisesIndexError(intArr[.. 7]) or
        not raisesIndexError(bigArr[.. 7]) or
        not raisesIndexError(fltArr[.. 7]) or
        not raisesIndexError(cpxArr[.. 7]) or
        not raisesIndexError(chrArr[.. 7]) or
        not raisesIndexError(strArr[.. 7]) or
        not raisesIndexError(intArr[.. integer.last]) or
        not raisesIndexError(bigArr[.. integer.last]) or
        not raisesIndexError(fltArr[.. integer.last]) or
        not raisesIndexError(cpxArr[.. integer.last]) or
        not raisesIndexError(chrArr[.. integer.last]) or
        not raisesIndexError(strArr[.. integer.last]) *) then
      writeln(" ***** ARRAY [ INDEX .. ] with index out of range does not raise INDEX_ERROR. (1)");
      okay := FALSE;
    end if;

    if  not raisesIndexError(([] (1, 2) & [] (3, 4))                    [.. integer.first]) or
        not raisesIndexError(([] (1_, 2_) & [] (3_, 4_))                [.. integer.first]) or
        not raisesIndexError(([] (1.0, 2.0) & [] (3.0, 4.0))            [.. integer.first]) or
        not raisesIndexError(([] (complex(1.0, 1.0), complex(2.0, 2.0)) &
                              [] (complex(3.0, 3.0), complex(4.0, 4.0)))[.. integer.first]) or
        not raisesIndexError(([] ('a', 'b') & [] ('c', 'd'))            [.. integer.first]) or
        not raisesIndexError(([] ("one", "two") & [] ("three", "four")) [.. integer.first]) or
        not raisesIndexError(([] (1, 2) & [] (3, 4))                    [.. -1]) or
        not raisesIndexError(([] (1_, 2_) & [] (3_, 4_))                [.. -1]) or
        not raisesIndexError(([] (1.0, 2.0) & [] (3.0, 4.0))            [.. -1]) or
        not raisesIndexError(([] (complex(1.0, 1.0), complex(2.0, 2.0)) &
                              [] (complex(3.0, 3.0), complex(4.0, 4.0)))[.. -1]) or
        not raisesIndexError(([] ('a', 'b') & [] ('c', 'd'))            [.. -1]) or
        not raisesIndexError(([] ("one", "two") & [] ("three", "four")) [.. -1]) (* or
        not raisesIndexError(([] (1, 2) & [] (3, 4))                    [.. 7]) or
        not raisesIndexError(([] (1_, 2_) & [] (3_, 4_))                [.. 7]) or
        not raisesIndexError(([] (1.0, 2.0) & [] (3.0, 4.0))            [.. 7]) or
        not raisesIndexError(([] (complex(1.0, 1.0), complex(2.0, 2.0)) &
                              [] (complex(3.0, 3.0), complex(4.0, 4.0)))[.. 7]) or
        not raisesIndexError(([] ('a', 'b') & [] ('c', 'd'))            [.. 7]) or
        not raisesIndexError(([] ("one", "two") & [] ("three", "four")) [.. 7]) or
        not raisesIndexError(([] (1, 2) & [] (3, 4))                    [.. integer.last]) or
        not raisesIndexError(([] (1_, 2_) & [] (3_, 4_))                [.. integer.last]) or
        not raisesIndexError(([] (1.0, 2.0) & [] (3.0, 4.0))            [.. integer.last]) or
        not raisesIndexError(([] (complex(1.0, 1.0), complex(2.0, 2.0)) &
                              [] (complex(3.0, 3.0), complex(4.0, 4.0)))[.. integer.last]) or
        not raisesIndexError(([] ('a', 'b') & [] ('c', 'd'))            [.. integer.last]) or
        not raisesIndexError(([] ("one", "two") & [] ("three", "four")) [.. integer.last]) *) then
      writeln(" ***** ARRAY [ INDEX .. ] with index out of range does not raise INDEX_ERROR. (2)");
      okay := FALSE;
    end if;

    if okay then
      writeln("Head of array works correct.");
    end if;
  end func;


const proc: testTail is func
  local
    var boolean: okay is TRUE;
    var array integer: intArr is [] (1, 2, 3, 4, 5, 6, 7);
    var array bigInteger: bigArr is [] (1_, 2_, 3_, 4_, 5_, 6_, 7_);
    var array float: fltArr is [] (1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0);
    var array complex: cpxArr is [] (complex(1.0, 1.0), complex(2.0, 2.0), complex(3.0, 3.0),
        complex(4.0, 4.0), complex(5.0, 5.0), complex(6.0, 6.0), complex(7.0, 7.0));
    var array char: chrArr is [] ('a', 'b', 'c', 'd', 'e', 'f', 'g');
    var array string: strArr is [] ("one", "two", "three", "four", "five", "six", "seven");
    var array integer: intTail is 0 times 0;
    var array bigInteger: bigTail is 0 times 0_;
    var array float: fltTail is 0 times 0.0;
    var array complex: cpxTail is 0 times complex(0.0, 0.0);
    var array char: chrTail is 0 times ' ';
    var array string: strTail is 0 times "";
  begin
    intTail := intArr[1 ..];
    if length(intTail) <> 7 or intTail[1] <> 1 or intTail[2] <> 2 or intTail[3] <> 3 or
            intTail[4] <> 4 or intTail[5] <> 5 or intTail[6] <> 6 or intTail[7] <> 7 then
      writeln(" ***** ARRAY [ .. INDEX ] for integer array failed. (1)");
      okay := FALSE;
    end if;
    intTail := intArr[intExpr(1) ..];
    if length(intTail) <> 7 or intTail[1] <> 1 or intTail[2] <> 2 or intTail[3] <> 3 or
            intTail[4] <> 4 or intTail[5] <> 5 or intTail[6] <> 6 or intTail[7] <> 7 then
      writeln(" ***** ARRAY [ .. INDEX ] for integer array failed. (2)");
      okay := FALSE;
    end if;
    intTail := intArr[intExpr(2) ..];
    if length(intTail) <> 6 or intTail[1] <> 2 or intTail[2] <> 3 or intTail[3] <> 4 or
                               intTail[4] <> 5 or intTail[5] <> 6 or intTail[6] <> 7 then
      writeln(" ***** ARRAY [ .. INDEX ] for integer array failed. (3)");
      okay := FALSE;
    end if;
    intTail := intArr[intExpr(7) ..];
    if length(intTail) <> 1 or intTail[1] <> 7 then
      writeln(" ***** ARRAY [ .. INDEX ] for integer array failed. (4)");
      okay := FALSE;
    end if;
    intTail := ([] (1, 2) & [] (3, 4))[2 ..];
    if length(intTail) <> 3 or intTail[1] <> 2 or intTail[2] <> 3 or intTail[3] <> 4 then
      writeln(" ***** ARRAY [ .. INDEX ] for integer array failed. (5)");
      okay := FALSE;
    end if;
    intArr := intArr[1 ..];
    if length(intArr) <> 7 or intArr[1] <> 1 or intArr[2] <> 2 or intArr[3] <> 3 or
            intArr[4] <> 4 or intArr[5] <> 5 or intArr[6] <> 6 or intArr[7] <> 7 then
      writeln(" ***** ARRAY [ .. INDEX ] for integer array failed. (6)");
      okay := FALSE;
    end if;
    intArr := intArr[intExpr(1) ..];
    if length(intArr) <> 7 or intArr[1] <> 1 or intArr[2] <> 2 or intArr[3] <> 3 or
            intArr[4] <> 4 or intArr[5] <> 5 or intArr[6] <> 6 or intArr[7] <> 7 then
      writeln(" ***** ARRAY [ .. INDEX ] for integer array failed. (7)");
      okay := FALSE;
    end if;
    intArr := intArr[intExpr(2) ..];
    if length(intArr) <> 6 or intArr[1] <> 2 or intArr[2] <> 3 or intArr[3] <> 4 or
                              intArr[4] <> 5 or intArr[5] <> 6 or intArr[6] <> 7 then
      writeln(" ***** ARRAY [ .. INDEX ] for integer array failed. (8)");
      okay := FALSE;
    end if;

    bigTail := bigArr[1 ..];
    if length(bigTail) <> 7 or bigTail[1] <> 1_ or bigTail[2] <> 2_ or bigTail[3] <> 3_ or
           bigTail[4] <> 4_ or bigTail[5] <> 5_ or bigTail[6] <> 6_ or bigTail[7] <> 7_ then
      writeln(" ***** ARRAY [ .. INDEX ] for bigInteger array failed. (1)");
      okay := FALSE;
    end if;
    bigTail := bigArr[intExpr(1) ..];
    if length(bigTail) <> 7 or bigTail[1] <> 1_ or bigTail[2] <> 2_ or bigTail[3] <> 3_ or
           bigTail[4] <> 4_ or bigTail[5] <> 5_ or bigTail[6] <> 6_ or bigTail[7] <> 7_ then
      writeln(" ***** ARRAY [ .. INDEX ] for bigInteger array failed. (2)");
      okay := FALSE;
    end if;
    bigTail := bigArr[intExpr(2) ..];
    if length(bigTail) <> 6 or bigTail[1] <> 2_ or bigTail[2] <> 3_ or bigTail[3] <> 4_ or
                               bigTail[4] <> 5_ or bigTail[5] <> 6_ or bigTail[6] <> 7_ then
      writeln(" ***** ARRAY [ .. INDEX ] for bigInteger array failed. (3)");
      okay := FALSE;
    end if;
    bigTail := bigArr[intExpr(7) ..];
    if length(bigTail) <> 1 or bigTail[1] <> 7_ then
      writeln(" ***** ARRAY [ .. INDEX ] for bigInteger array failed. (4)");
      okay := FALSE;
    end if;
    bigTail := ([] (1_, 2_) & [] (3_, 4_))[2 ..];
    if length(bigTail) <> 3 or bigTail[1] <> 2_ or bigTail[2] <> 3_ or bigTail[3] <> 4_ then
      writeln(" ***** ARRAY [ .. INDEX ] for bigInteger array failed. (5)");
      okay := FALSE;
    end if;
    bigArr := bigArr[1 ..];
    if length(bigArr) <> 7 or bigArr[1] <> 1_ or bigArr[2] <> 2_ or bigArr[3] <> 3_ or
           bigArr[4] <> 4_ or bigArr[5] <> 5_ or bigArr[6] <> 6_ or bigArr[7] <> 7_ then
      writeln(" ***** ARRAY [ .. INDEX ] for bigInteger array failed. (6)");
      okay := FALSE;
    end if;
    bigArr := bigArr[intExpr(1) ..];
    if length(bigArr) <> 7 or bigArr[1] <> 1_ or bigArr[2] <> 2_ or bigArr[3] <> 3_ or
           bigArr[4] <> 4_ or bigArr[5] <> 5_ or bigArr[6] <> 6_ or bigArr[7] <> 7_ then
      writeln(" ***** ARRAY [ .. INDEX ] for bigInteger array failed. (7)");
      okay := FALSE;
    end if;
    bigArr := bigArr[intExpr(2) ..];
    if length(bigArr) <> 6 or bigArr[1] <> 2_ or bigArr[2] <> 3_ or bigArr[3] <> 4_ or
                              bigArr[4] <> 5_ or bigArr[5] <> 6_ or bigArr[6] <> 7_ then
      writeln(" ***** ARRAY [ .. INDEX ] for bigInteger array failed. (8)");
      okay := FALSE;
    end if;

    fltTail := fltArr[1 ..];
    if length(fltTail) <> 7 or fltTail[1] <> 1.0 or fltTail[2] <> 2.0 or fltTail[3] <> 3.0 or
          fltTail[4] <> 4.0 or fltTail[5] <> 5.0 or fltTail[6] <> 6.0 or fltTail[7] <> 7.0 then
      writeln(" ***** ARRAY [ .. INDEX ] for float array failed. (1)");
      okay := FALSE;
    end if;
    fltTail := fltArr[intExpr(1) ..];
    if length(fltTail) <> 7 or fltTail[1] <> 1.0 or fltTail[2] <> 2.0 or fltTail[3] <> 3.0 or
          fltTail[4] <> 4.0 or fltTail[5] <> 5.0 or fltTail[6] <> 6.0 or fltTail[7] <> 7.0 then
      writeln(" ***** ARRAY [ .. INDEX ] for float array failed. (2)");
      okay := FALSE;
    end if;
    fltTail := fltArr[intExpr(2) ..];
    if length(fltTail) <> 6 or fltTail[1] <> 2.0 or fltTail[2] <> 3.0 or fltTail[3] <> 4.0 or
                               fltTail[4] <> 5.0 or fltTail[5] <> 6.0 or fltTail[6] <> 7.0 then
      writeln(" ***** ARRAY [ .. INDEX ] for float array failed. (3)");
      okay := FALSE;
    end if;
    fltTail := fltArr[intExpr(7) ..];
    if length(fltTail) <> 1 or fltTail[1] <> 7.0 then
      writeln(" ***** ARRAY [ .. INDEX ] for float array failed. (4)");
      okay := FALSE;
    end if;
    fltTail := ([] (1.0, 2.0) & [] (3.0, 4.0))[2 ..];
    if length(fltTail) <> 3 or fltTail[1] <> 2.0 or fltTail[2] <> 3.0 or fltTail[3] <> 4.0 then
      writeln(" ***** ARRAY [ .. INDEX ] for float array failed. (5)");
      okay := FALSE;
    end if;
    fltArr := fltArr[1 ..];
    if length(fltArr) <> 7 or fltArr[1] <> 1.0 or fltArr[2] <> 2.0 or fltArr[3] <> 3.0 or
          fltArr[4] <> 4.0 or fltArr[5] <> 5.0 or fltArr[6] <> 6.0 or fltArr[7] <> 7.0 then
      writeln(" ***** ARRAY [ .. INDEX ] for float array failed. (6)");
      okay := FALSE;
    end if;
    fltArr := fltArr[intExpr(1) ..];
    if length(fltArr) <> 7 or fltArr[1] <> 1.0 or fltArr[2] <> 2.0 or fltArr[3] <> 3.0 or
          fltArr[4] <> 4.0 or fltArr[5] <> 5.0 or fltArr[6] <> 6.0 or fltArr[7] <> 7.0 then
      writeln(" ***** ARRAY [ .. INDEX ] for float array failed. (7)");
      okay := FALSE;
    end if;
    fltArr := fltArr[intExpr(2) ..];
    if length(fltArr) <> 6 or fltArr[1] <> 2.0 or fltArr[2] <> 3.0 or fltArr[3] <> 4.0 or
                              fltArr[4] <> 5.0 or fltArr[5] <> 6.0 or fltArr[6] <> 7.0 then
      writeln(" ***** ARRAY [ .. INDEX ] for float array failed. (8)");
      okay := FALSE;
    end if;

    cpxTail := cpxArr[1 ..];
    if length(cpxTail) <> 7 or cpxTail[1] <> complex(1.0, 1.0) or cpxTail[2] <> complex(2.0, 2.0) or
                               cpxTail[3] <> complex(3.0, 3.0) or cpxTail[4] <> complex(4.0, 4.0) or
                               cpxTail[5] <> complex(5.0, 5.0) or cpxTail[6] <> complex(6.0, 6.0) or
                               cpxTail[7] <> complex(7.0, 7.0) then
      writeln(" ***** ARRAY [ .. INDEX ] for complex array failed. (1)");
      okay := FALSE;
    end if;
    cpxTail := cpxArr[intExpr(1) ..];
    if length(cpxTail) <> 7 or cpxTail[1] <> complex(1.0, 1.0) or cpxTail[2] <> complex(2.0, 2.0) or
                               cpxTail[3] <> complex(3.0, 3.0) or cpxTail[4] <> complex(4.0, 4.0) or
                               cpxTail[5] <> complex(5.0, 5.0) or cpxTail[6] <> complex(6.0, 6.0) or
                               cpxTail[7] <> complex(7.0, 7.0) then
      writeln(" ***** ARRAY [ .. INDEX ] for complex array failed. (2)");
      okay := FALSE;
    end if;
    cpxTail := cpxArr[intExpr(2) ..];
    if length(cpxTail) <> 6 or cpxTail[1] <> complex(2.0, 2.0) or cpxTail[2] <> complex(3.0, 3.0) or
                               cpxTail[3] <> complex(4.0, 4.0) or cpxTail[4] <> complex(5.0, 5.0) or
                               cpxTail[5] <> complex(6.0, 6.0) or cpxTail[6] <> complex(7.0, 7.0) then
      writeln(" ***** ARRAY [ .. INDEX ] for complex array failed. (3)");
      okay := FALSE;
    end if;
    cpxTail := cpxArr[intExpr(7) ..];
    if length(cpxTail) <> 1 or cpxTail[1] <> complex(7.0, 7.0) then
      writeln(" ***** ARRAY [ .. INDEX ] for complex array failed. (4)");
      okay := FALSE;
    end if;
    cpxTail := ([] (complex(1.0, 1.0), complex(2.0, 2.0)) & [] (complex(3.0, 3.0), complex(4.0, 4.0)))[2 ..];
    if length(cpxTail) <> 3 or cpxTail[1] <> complex(2.0, 2.0) or cpxTail[2] <> complex(3.0, 3.0) or
                               cpxTail[3] <> complex(4.0, 4.0) then
      writeln(" ***** ARRAY [ .. INDEX ] for complex array failed. (5)");
      okay := FALSE;
    end if;
    cpxArr := cpxArr[1 ..];
    if length(cpxArr) <> 7 or cpxArr[1] <> complex(1.0, 1.0) or cpxArr[2] <> complex(2.0, 2.0) or
                              cpxArr[3] <> complex(3.0, 3.0) or cpxArr[4] <> complex(4.0, 4.0) or
                              cpxArr[5] <> complex(5.0, 5.0) or cpxArr[6] <> complex(6.0, 6.0) or
                              cpxArr[7] <> complex(7.0, 7.0) then
      writeln(" ***** ARRAY [ .. INDEX ] for complex array failed. (6)");
      okay := FALSE;
    end if;
    cpxArr := cpxArr[intExpr(1) ..];
    if length(cpxArr) <> 7 or cpxArr[1] <> complex(1.0, 1.0) or cpxArr[2] <> complex(2.0, 2.0) or
                              cpxArr[3] <> complex(3.0, 3.0) or cpxArr[4] <> complex(4.0, 4.0) or
                              cpxArr[5] <> complex(5.0, 5.0) or cpxArr[6] <> complex(6.0, 6.0) or
                              cpxArr[7] <> complex(7.0, 7.0) then
      writeln(" ***** ARRAY [ .. INDEX ] for complex array failed. (7)");
      okay := FALSE;
    end if;
    cpxArr := cpxArr[intExpr(2) ..];
    if length(cpxArr) <> 6 or cpxArr[1] <> complex(2.0, 2.0) or cpxArr[2] <> complex(3.0, 3.0) or
                              cpxArr[3] <> complex(4.0, 4.0) or cpxArr[4] <> complex(5.0, 5.0) or
                              cpxArr[5] <> complex(6.0, 6.0) or cpxArr[6] <> complex(7.0, 7.0) then
      writeln(" ***** ARRAY [ .. INDEX ] for complex array failed. (8)");
      okay := FALSE;
    end if;

    chrTail := chrArr[1 ..];
    if length(chrTail) <> 7 or chrTail[1] <> 'a' or chrTail[2] <> 'b' or chrTail[3] <> 'c' or
            chrTail[4] <> 'd' or chrTail[5] <> 'e' or chrTail[6] <> 'f' or chrTail[7] <> 'g' then
      writeln(" ***** ARRAY [ .. INDEX ] for char array failed. (1)");
      okay := FALSE;
    end if;
    chrTail := chrArr[intExpr(1) ..];
    if length(chrTail) <> 7 or chrTail[1] <> 'a' or chrTail[2] <> 'b' or chrTail[3] <> 'c' or
            chrTail[4] <> 'd' or chrTail[5] <> 'e' or chrTail[6] <> 'f' or chrTail[7] <> 'g' then
      writeln(" ***** ARRAY [ .. INDEX ] for char array failed. (2)");
      okay := FALSE;
    end if;
    chrTail := chrArr[intExpr(2) ..];
    if length(chrTail) <> 6 or chrTail[1] <> 'b' or chrTail[2] <> 'c' or chrTail[3] <> 'd' or
                               chrTail[4] <> 'e' or chrTail[5] <> 'f' or chrTail[6] <> 'g' then
      writeln(" ***** ARRAY [ .. INDEX ] for char array failed. (3)");
      okay := FALSE;
    end if;
    chrTail := chrArr[intExpr(7) ..];
    if length(chrTail) <> 1 or chrTail[1] <> 'g' then
      writeln(" ***** ARRAY [ .. INDEX ] for char array failed. (4)");
      okay := FALSE;
    end if;
    chrTail := ([] ('a', 'b') & [] ('c', 'd'))[2 ..];
    if length(chrTail) <> 3 or chrTail[1] <> 'b' or chrTail[2] <> 'c' or chrTail[3] <> 'd' then
      writeln(" ***** ARRAY [ .. INDEX ] for char array failed. (5)");
      okay := FALSE;
    end if;
    chrArr := chrArr[1 ..];
    if length(chrArr) <> 7 or chrArr[1] <> 'a' or chrArr[2] <> 'b' or chrArr[3] <> 'c' or
            chrArr[4] <> 'd' or chrArr[5] <> 'e' or chrArr[6] <> 'f' or chrArr[7] <> 'g' then
      writeln(" ***** ARRAY [ .. INDEX ] for char array failed. (6)");
      okay := FALSE;
    end if;
    chrArr := chrArr[intExpr(1) ..];
    if length(chrArr) <> 7 or chrArr[1] <> 'a' or chrArr[2] <> 'b' or chrArr[3] <> 'c' or
            chrArr[4] <> 'd' or chrArr[5] <> 'e' or chrArr[6] <> 'f' or chrArr[7] <> 'g' then
      writeln(" ***** ARRAY [ .. INDEX ] for char array failed. (7)");
      okay := FALSE;
    end if;
    chrArr := chrArr[intExpr(2) ..];
    if length(chrArr) <> 6 or chrArr[1] <> 'b' or chrArr[2] <> 'c' or chrArr[3] <> 'd' or
                              chrArr[4] <> 'e' or chrArr[5] <> 'f' or chrArr[6] <> 'g' then
      writeln(" ***** ARRAY [ .. INDEX ] for char array failed. (8)");
      okay := FALSE;
    end if;

    strTail := strArr[1 ..];
    if length(strTail) <> 7 or strTail[1] <> "one" or strTail[2] <> "two" or strTail[3] <> "three" or
            strTail[4] <> "four" or strTail[5] <> "five" or strTail[6] <> "six" or strTail[7] <> "seven" then
      writeln(" ***** ARRAY [ .. INDEX ] for string array failed. (1)");
      okay := FALSE;
    end if;
    strTail := strArr[intExpr(1) ..];
    if length(strTail) <> 7 or strTail[1] <> "one" or strTail[2] <> "two" or strTail[3] <> "three" or
            strTail[4] <> "four" or strTail[5] <> "five" or strTail[6] <> "six" or strTail[7] <> "seven" then
      writeln(" ***** ARRAY [ .. INDEX ] for string array failed. (2)");
      okay := FALSE;
    end if;
    strTail := strArr[intExpr(2) ..];
    if length(strTail) <> 6 or strTail[1] <> "two" or strTail[2] <> "three" or strTail[3] <> "four" or
                               strTail[4] <> "five" or strTail[5] <> "six" or strTail[6] <> "seven" then
      writeln(" ***** ARRAY [ .. INDEX ] for string array failed. (3)");
      okay := FALSE;
    end if;
    strTail := strArr[intExpr(7) ..];
    if length(strTail) <> 1 or strTail[1] <> "seven" then
      writeln(" ***** ARRAY [ .. INDEX ] for string array failed. (4)");
      okay := FALSE;
    end if;
    strTail := ([] ("one", "two") & [] ("three", "four"))[2 ..];
    if length(strTail) <> 3 or strTail[1] <> "two" or strTail[2] <> "three" or strTail[3] <> "four" then
      writeln(" ***** ARRAY [ .. INDEX ] for string array failed. (5)");
      okay := FALSE;
    end if;
    strArr := strArr[1 ..];
    if length(strArr) <> 7 or strArr[1] <> "one" or strArr[2] <> "two" or strArr[3] <> "three" or
            strArr[4] <> "four" or strArr[5] <> "five" or strArr[6] <> "six" or strArr[7] <> "seven" then
      writeln(" ***** ARRAY [ .. INDEX ] for string array failed. (6)");
      okay := FALSE;
    end if;
    strArr := strArr[intExpr(1) ..];
    if length(strArr) <> 7 or strArr[1] <> "one" or strArr[2] <> "two" or strArr[3] <> "three" or
            strArr[4] <> "four" or strArr[5] <> "five" or strArr[6] <> "six" or strArr[7] <> "seven" then
      writeln(" ***** ARRAY [ .. INDEX ] for string array failed. (7)");
      okay := FALSE;
    end if;
    strArr := strArr[intExpr(2) ..];
    if length(strArr) <> 6 or strArr[1] <> "two" or strArr[2] <> "three" or strArr[3] <> "four" or
                              strArr[4] <> "five" or strArr[5] <> "six" or strArr[6] <> "seven" then
      writeln(" ***** ARRAY [ .. INDEX ] for string array failed. (8)");
      okay := FALSE;
    end if;

    if  not raisesIndexError(intArr[integer.first ..]) or
        not raisesIndexError(bigArr[integer.first ..]) or
        not raisesIndexError(fltArr[integer.first ..]) or
        not raisesIndexError(cpxArr[integer.first ..]) or
        not raisesIndexError(chrArr[integer.first ..]) or
        not raisesIndexError(strArr[integer.first ..]) or
        not raisesIndexError(intArr[0 ..]) or
        not raisesIndexError(bigArr[0 ..]) or
        not raisesIndexError(fltArr[0 ..]) or
        not raisesIndexError(cpxArr[0 ..]) or
        not raisesIndexError(chrArr[0 ..]) or
        not raisesIndexError(strArr[0 ..]) (* or
        not raisesIndexError(intArr[7 ..]) or
        not raisesIndexError(bigArr[7 ..]) or
        not raisesIndexError(fltArr[7 ..]) or
        not raisesIndexError(cpxArr[7 ..]) or
        not raisesIndexError(chrArr[7 ..]) or
        not raisesIndexError(strArr[7 ..]) or
        not raisesIndexError(intArr[integer.last ..]) or
        not raisesIndexError(bigArr[integer.last ..]) or
        not raisesIndexError(fltArr[integer.last ..]) or
        not raisesIndexError(cpxArr[integer.last ..]) or
        not raisesIndexError(chrArr[integer.last ..]) or
        not raisesIndexError(strArr[integer.last ..]) *) then
      writeln(" ***** ARRAY [ .. INDEX ] with index out of range does not raise INDEX_ERROR. (1)");
      okay := FALSE;
    end if;

    if  not raisesIndexError(([] (1, 2) & [] (3, 4))                    [integer.first ..]) or
        not raisesIndexError(([] (1_, 2_) & [] (3_, 4_))                [integer.first ..]) or
        not raisesIndexError(([] (1.0, 2.0) & [] (3.0, 4.0))            [integer.first ..]) or
        not raisesIndexError(([] (complex(1.0, 1.0), complex(2.0, 2.0)) &
                              [] (complex(3.0, 3.0), complex(4.0, 4.0)))[integer.first ..]) or
        not raisesIndexError(([] ('a', 'b') & [] ('c', 'd'))            [integer.first ..]) or
        not raisesIndexError(([] ("one", "two") & [] ("three", "four")) [integer.first ..]) or
        not raisesIndexError(([] (1, 2) & [] (3, 4))                    [0 ..]) or
        not raisesIndexError(([] (1_, 2_) & [] (3_, 4_))                [0 ..]) or
        not raisesIndexError(([] (1.0, 2.0) & [] (3.0, 4.0))            [0 ..]) or
        not raisesIndexError(([] (complex(1.0, 1.0), complex(2.0, 2.0)) &
                              [] (complex(3.0, 3.0), complex(4.0, 4.0)))[0 ..]) or
        not raisesIndexError(([] ('a', 'b') & [] ('c', 'd'))            [0 ..]) or
        not raisesIndexError(([] ("one", "two") & [] ("three", "four")) [0 ..]) (* or
        not raisesIndexError(([] (1, 2) & [] (3, 4))                    [7 ..]) or
        not raisesIndexError(([] (1_, 2_) & [] (3_, 4_))                [7 ..]) or
        not raisesIndexError(([] (1.0, 2.0) & [] (3.0, 4.0))            [7 ..]) or
        not raisesIndexError(([] (complex(1.0, 1.0), complex(2.0, 2.0)) &
                              [] (complex(3.0, 3.0), complex(4.0, 4.0)))[7 ..]) or
        not raisesIndexError(([] ('a', 'b') & [] ('c', 'd'))            [7 ..]) or
        not raisesIndexError(([] ("one", "two") & [] ("three", "four")) [7 ..]) or
        not raisesIndexError(([] (1, 2) & [] (3, 4))                    [integer.last ..]) or
        not raisesIndexError(([] (1_, 2_) & [] (3_, 4_))                [integer.last ..]) or
        not raisesIndexError(([] (1.0, 2.0) & [] (3.0, 4.0))            [integer.last ..]) or
        not raisesIndexError(([] (complex(1.0, 1.0), complex(2.0, 2.0)) &
                              [] (complex(3.0, 3.0), complex(4.0, 4.0)))[integer.last ..]) or
        not raisesIndexError(([] ('a', 'b') & [] ('c', 'd'))            [integer.last ..]) or
        not raisesIndexError(([] ("one", "two") & [] ("three", "four")) [integer.last ..]) *) then
      writeln(" ***** ARRAY [ .. INDEX ] with index out of range does not raise INDEX_ERROR. (2)");
      okay := FALSE;
    end if;

    if okay then
      writeln("Tail of array works correct.");
    end if;
  end func;


const proc: testRange is func
  local
    var boolean: okay is TRUE;
    var array integer: intArr is [] (1, 2, 3, 4, 5, 6, 7, 8, 9);
    var array bigInteger: bigArr is [] (1_, 2_, 3_, 4_, 5_, 6_, 7_, 8_, 9_);
    var array float: fltArr is [] (1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0);
    var array complex: cpxArr is [] (complex(1.0, 1.0), complex(2.0, 2.0), complex(3.0, 3.0),
        complex(4.0, 4.0), complex(5.0, 5.0), complex(6.0, 6.0), complex(7.0, 7.0),
        complex(8.0, 8.0), complex(9.0, 9.0));
    var array char: chrArr is [] ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i');
    var array string: strArr is [] ("one", "two", "three", "four", "five", "six", "seven",
        "eight", "nine");
    var array integer: intRange is 0 times 0;
    var array bigInteger: bigRange is 0 times 0_;
    var array float: fltRange is 0 times 0.0;
    var array complex: cpxRange is 0 times complex(0.0, 0.0);
    var array char: chrRange is 0 times ' ';
    var array string: strRange is 0 times "";
  begin
    intRange := intArr[1 .. 9];
    if length(intRange) <> 9 or intRange[1] <> 1 or intRange[2] <> 2 or intRange[3] <> 3 or
            intRange[4] <> 4 or intRange[5] <> 5 or intRange[6] <> 6 or intRange[7] <> 7 or
            intRange[8] <> 8 or intRange[9] <> 9 then
      writeln(" ***** ARRAY [ START .. STOP ] for integer array failed. (1)");
      okay := FALSE;
    end if;
    intRange := intArr[intExpr(1) .. 8];
    if length(intRange) <> 8 or intRange[1] <> 1 or intRange[2] <> 2 or intRange[3] <> 3 or
            intRange[4] <> 4 or intRange[5] <> 5 or intRange[6] <> 6 or intRange[7] <> 7 or
            intRange[8] <> 8 then
      writeln(" ***** ARRAY [ START .. STOP ] for integer array failed. (2)");
      okay := FALSE;
    end if;
    intRange := intArr[intExpr(2) .. 7];
    if length(intRange) <> 6 or intRange[1] <> 2 or intRange[2] <> 3 or intRange[3] <> 4 or
                                intRange[4] <> 5 or intRange[5] <> 6 or intRange[6] <> 7 then
      writeln(" ***** ARRAY [ START .. STOP ] for integer array failed. (3)");
      okay := FALSE;
    end if;
    intRange := intArr[intExpr(3) .. 4];
    if length(intRange) <> 2 or intRange[1] <> 3 or intRange[2] <> 4 then
      writeln(" ***** ARRAY [ START .. STOP ] for integer array failed. (4)");
      okay := FALSE;
    end if;
    intRange := ([](1, 2) & intRange)[2 .. 3];
    if length(intRange) <> 2 or intRange[1] <> 2 or intRange[2] <> 3 then
      writeln(" ***** ARRAY [ START .. STOP ] for integer array failed. (5)");
      okay := FALSE;
    end if;
    intRange := ([](1) & intRange)[intExpr(1) .. 3];
    if length(intRange) <> 3 or intRange[1] <> 1 or intRange[2] <> 2 or intRange[3] <> 3 then
      writeln(" ***** ARRAY [ START .. STOP ] for integer array failed. (6)");
      okay := FALSE;
    end if;
    intRange := (intRange & [](1))[4 .. intExpr(3)];
    if length(intRange) <> 0 then
      writeln(" ***** ARRAY [ START .. STOP ] for integer array failed. (7)");
      okay := FALSE;
    end if;
    intRange := (intRange & [](1))[1 .. 0];
    if length(intRange) <> 0 then
      writeln(" ***** ARRAY [ START .. STOP ] for integer array failed. (8)");
      okay := FALSE;
    end if;
    intRange := intArr[intExpr(7) .. 7];
    if length(intRange) <> 1 or intRange[1] <> 7 then
      writeln(" ***** ARRAY [ START .. STOP ] for integer array failed. (9)");
      okay := FALSE;
    end if;
    intRange := intArr[intExpr(1) .. 0];
    if length(intRange) <> 0 then
      writeln(" ***** ARRAY [ START .. STOP ] for integer array failed. (10)");
      okay := FALSE;
    end if;
    intRange := intArr[intExpr(10) .. 9];
    if length(intRange) <> 0 then
      writeln(" ***** ARRAY [ START .. STOP ] for integer array failed. (11)");
      okay := FALSE;
    end if;
    intArr := intArr[1 .. 9];
    if length(intArr) <> 9 or intArr[1] <> 1 or intArr[2] <> 2 or intArr[3] <> 3 or
            intArr[4] <> 4 or intArr[5] <> 5 or intArr[6] <> 6 or intArr[7] <> 7 or
            intArr[8] <> 8 or intArr[9] <> 9 then
      writeln(" ***** ARRAY [ START .. STOP ] for integer array failed. (12)");
      okay := FALSE;
    end if;
    intArr := intArr[intExpr(1) .. 8];
    if length(intArr) <> 8 or intArr[1] <> 1 or intArr[2] <> 2 or intArr[3] <> 3 or
            intArr[4] <> 4 or intArr[5] <> 5 or intArr[6] <> 6 or intArr[7] <> 7 or
            intArr[8] <> 8 then
      writeln(" ***** ARRAY [ START .. STOP ] for integer array failed. (13)");
      okay := FALSE;
    end if;
    intArr := intArr[intExpr(2) .. 7];
    if length(intArr) <> 6 or intArr[1] <> 2 or intArr[2] <> 3 or intArr[3] <> 4 or
                              intArr[4] <> 5 or intArr[5] <> 6 or intArr[6] <> 7 then
      writeln(" ***** ARRAY [ START .. STOP ] for integer array failed. (14)");
      okay := FALSE;
    end if;
    intArr := intArr[intExpr(3) .. 5];
    if length(intArr) <> 3 or intArr[1] <> 4 or intArr[2] <> 5 or intArr[3] <> 6 then
      writeln(" ***** ARRAY [ START .. STOP ] for integer array failed. (15)");
      okay := FALSE;
    end if;

    bigRange := bigArr[1 .. 9];
    if length(bigRange) <> 9 or bigRange[1] <> 1_ or bigRange[2] <> 2_ or bigRange[3] <> 3_ or
           bigRange[4] <> 4_ or bigRange[5] <> 5_ or bigRange[6] <> 6_ or bigRange[7] <> 7_ or
           bigRange[8] <> 8_ or bigRange[9] <> 9_ then
      writeln(" ***** ARRAY [ START .. STOP ] for bigInteger array failed. (1)");
      okay := FALSE;
    end if;
    bigRange := bigArr[intExpr(1) .. 8];
    if length(bigRange) <> 8 or bigRange[1] <> 1_ or bigRange[2] <> 2_ or bigRange[3] <> 3_ or
           bigRange[4] <> 4_ or bigRange[5] <> 5_ or bigRange[6] <> 6_ or bigRange[7] <> 7_ or
           bigRange[8] <> 8_ then
      writeln(" ***** ARRAY [ START .. STOP ] for bigInteger array failed. (2)");
      okay := FALSE;
    end if;
    bigRange := bigArr[intExpr(2) .. 7];
    if length(bigRange) <> 6 or bigRange[1] <> 2_ or bigRange[2] <> 3_ or bigRange[3] <> 4_ or
                                 bigRange[4] <> 5_ or bigRange[5] <> 6_ or bigRange[6] <> 7_ then
      writeln(" ***** ARRAY [ START .. STOP ] for bigInteger array failed. (3)");
      okay := FALSE;
    end if;
    bigRange := bigArr[intExpr(3) .. 4];
    if length(bigRange) <> 2 or bigRange[1] <> 3_ or bigRange[2] <> 4_ then
      writeln(" ***** ARRAY [ START .. STOP ] for bigInteger array failed. (4)");
      okay := FALSE;
    end if;
    bigRange := ([](1_, 2_) & bigRange)[2 .. 3];
    if length(bigRange) <> 2 or bigRange[1] <> 2_ or bigRange[2] <> 3_ then
      writeln(" ***** ARRAY [ START .. STOP ] for bigInteger array failed. (5)");
      okay := FALSE;
    end if;
    bigRange := ([](1_) & bigRange)[intExpr(1) .. 3];
    if length(bigRange) <> 3 or bigRange[1] <> 1_ or bigRange[2] <> 2_ or bigRange[3] <> 3_ then
      writeln(" ***** ARRAY [ START .. STOP ] for bigInteger array failed. (6)");
      okay := FALSE;
    end if;
    bigRange := (bigRange & [](1_))[4 .. intExpr(3)];
    if length(bigRange) <> 0 then
      writeln(" ***** ARRAY [ START .. STOP ] for bigInteger array failed. (7)");
      okay := FALSE;
    end if;
    bigRange := (bigRange & [](1_))[1 .. 0];
    if length(bigRange) <> 0 then
      writeln(" ***** ARRAY [ START .. STOP ] for bigInteger array failed. (8)");
      okay := FALSE;
    end if;
    bigRange := bigArr[intExpr(7) .. 7];
    if length(bigRange) <> 1 or bigRange[1] <> 7_ then
      writeln(" ***** ARRAY [ START .. STOP ] for bigInteger array failed. (9)");
      okay := FALSE;
    end if;
    bigRange := bigArr[intExpr(1) .. 0];
    if length(bigRange) <> 0 then
      writeln(" ***** ARRAY [ START .. STOP ] for bigInteger array failed. (10)");
      okay := FALSE;
    end if;
    bigRange := bigArr[intExpr(10) .. 9];
    if length(bigRange) <> 0 then
      writeln(" ***** ARRAY [ START .. STOP ] for bigInteger array failed. (11)");
      okay := FALSE;
    end if;
    bigArr := bigArr[1 .. 9];
    if length(bigArr) <> 9 or bigArr[1] <> 1_ or bigArr[2] <> 2_ or bigArr[3] <> 3_ or
           bigArr[4] <> 4_ or bigArr[5] <> 5_ or bigArr[6] <> 6_ or bigArr[7] <> 7_ or
           bigArr[8] <> 8_ or bigArr[9] <> 9_ then
      writeln(" ***** ARRAY [ START .. STOP ] for bigInteger array failed. (12)");
      okay := FALSE;
    end if;
    bigArr := bigArr[intExpr(1) .. 8];
    if length(bigArr) <> 8 or bigArr[1] <> 1_ or bigArr[2] <> 2_ or bigArr[3] <> 3_ or
           bigArr[4] <> 4_ or bigArr[5] <> 5_ or bigArr[6] <> 6_ or bigArr[7] <> 7_ or
           bigArr[8] <> 8_ then
      writeln(" ***** ARRAY [ START .. STOP ] for bigInteger array failed. (13)");
      okay := FALSE;
    end if;
    bigArr := bigArr[intExpr(2) .. 7];
    if length(bigArr) <> 6 or bigArr[1] <> 2_ or bigArr[2] <> 3_ or bigArr[3] <> 4_ or
                              bigArr[4] <> 5_ or bigArr[5] <> 6_ or bigArr[6] <> 7_ then
      writeln(" ***** ARRAY [ START .. STOP ] for bigInteger array failed. (14)");
      okay := FALSE;
    end if;
    bigArr := bigArr[intExpr(3) .. 5];
    if length(bigArr) <> 3 or bigArr[1] <> 4_ or bigArr[2] <> 5_ or bigArr[3] <> 6_ then
      writeln(" ***** ARRAY [ START .. STOP ] for bigInteger array failed. (15)");
      okay := FALSE;
    end if;

    fltRange := fltArr[1 .. 9];
    if length(fltRange) <> 9 or fltRange[1] <> 1.0 or fltRange[2] <> 2.0 or fltRange[3] <> 3.0 or
          fltRange[4] <> 4.0 or fltRange[5] <> 5.0 or fltRange[6] <> 6.0 or fltRange[7] <> 7.0 or
          fltRange[8] <> 8.0 or fltRange[9] <> 9.0 then
      writeln(" ***** ARRAY [ START .. STOP ] for float array failed. (1)");
      okay := FALSE;
    end if;
    fltRange := fltArr[intExpr(1) .. 8];
    if length(fltRange) <> 8 or fltRange[1] <> 1.0 or fltRange[2] <> 2.0 or fltRange[3] <> 3.0 or
          fltRange[4] <> 4.0 or fltRange[5] <> 5.0 or fltRange[6] <> 6.0 or fltRange[7] <> 7.0 or
          fltRange[8] <> 8.0 then
      writeln(" ***** ARRAY [ START .. STOP ] for float array failed. (2)");
      okay := FALSE;
    end if;
    fltRange := fltArr[intExpr(2) .. 7];
    if length(fltRange) <> 6 or fltRange[1] <> 2.0 or fltRange[2] <> 3.0 or fltRange[3] <> 4.0 or
                                 fltRange[4] <> 5.0 or fltRange[5] <> 6.0 or fltRange[6] <> 7.0 then
      writeln(" ***** ARRAY [ START .. STOP ] for float array failed. (3)");
      okay := FALSE;
    end if;
    fltRange := fltArr[intExpr(3) .. 4];
    if length(fltRange) <> 2 or fltRange[1] <> 3.0 or fltRange[2] <> 4.0 then
      writeln(" ***** ARRAY [ START .. STOP ] for float array failed. (4)");
      okay := FALSE;
    end if;
    fltRange := ([](1.0, 2.0) & fltRange)[2 .. 3];
    if length(fltRange) <> 2 or fltRange[1] <> 2.0 or fltRange[2] <> 3.0 then
      writeln(" ***** ARRAY [ START .. STOP ] for float array failed. (5)");
      okay := FALSE;
    end if;
    fltRange := ([](1.0) & fltRange)[intExpr(1) .. 3];
    if length(fltRange) <> 3 or fltRange[1] <> 1.0 or fltRange[2] <> 2.0 or fltRange[3] <> 3.0 then
      writeln(" ***** ARRAY [ START .. STOP ] for float array failed. (6)");
      okay := FALSE;
    end if;
    fltRange := (fltRange & [](1.0))[4 .. intExpr(3)];
    if length(fltRange) <> 0 then
      writeln(" ***** ARRAY [ START .. STOP ] for float array failed. (7)");
      okay := FALSE;
    end if;
    fltRange := (fltRange & [](1.0))[1 .. 0];
    if length(fltRange) <> 0 then
      writeln(" ***** ARRAY [ START .. STOP ] for float array failed. (8)");
      okay := FALSE;
    end if;
    fltRange := fltArr[intExpr(7) .. 7];
    if length(fltRange) <> 1 or fltRange[1] <> 7.0 then
      writeln(" ***** ARRAY [ START .. STOP ] for float array failed. (9)");
      okay := FALSE;
    end if;
    fltRange := fltArr[intExpr(1) .. 0];
    if length(fltRange) <> 0 then
      writeln(" ***** ARRAY [ START .. STOP ] for float array failed. (10)");
      okay := FALSE;
    end if;
    fltRange := fltArr[intExpr(10) .. 9];
    if length(fltRange) <> 0 then
      writeln(" ***** ARRAY [ START .. STOP ] for float array failed. (11)");
      okay := FALSE;
    end if;
    fltArr := fltArr[1 .. 9];
    if length(fltArr) <> 9 or fltArr[1] <> 1.0 or fltArr[2] <> 2.0 or fltArr[3] <> 3.0 or
          fltArr[4] <> 4.0 or fltArr[5] <> 5.0 or fltArr[6] <> 6.0 or fltArr[7] <> 7.0 or
          fltArr[8] <> 8.0 or fltArr[9] <> 9.0 then
      writeln(" ***** ARRAY [ START .. STOP ] for float array failed. (12)");
      okay := FALSE;
    end if;
    fltArr := fltArr[intExpr(1) .. 8];
    if length(fltArr) <> 8 or fltArr[1] <> 1.0 or fltArr[2] <> 2.0 or fltArr[3] <> 3.0 or
          fltArr[4] <> 4.0 or fltArr[5] <> 5.0 or fltArr[6] <> 6.0 or fltArr[7] <> 7.0 or
          fltArr[8] <> 8.0 then
      writeln(" ***** ARRAY [ START .. STOP ] for float array failed. (13)");
      okay := FALSE;
    end if;
    fltArr := fltArr[intExpr(2) .. 7];
    if length(fltArr) <> 6 or fltArr[1] <> 2.0 or fltArr[2] <> 3.0 or fltArr[3] <> 4.0 or
                              fltArr[4] <> 5.0 or fltArr[5] <> 6.0 or fltArr[6] <> 7.0 then
      writeln(" ***** ARRAY [ START .. STOP ] for float array failed. (14)");
      okay := FALSE;
    end if;
    fltArr := fltArr[intExpr(3) .. 5];
    if length(fltArr) <> 3 or fltArr[1] <> 4.0 or fltArr[2] <> 5.0 or fltArr[3] <> 6.0 then
      writeln(" ***** ARRAY [ START .. STOP ] for float array failed. (15)");
      okay := FALSE;
    end if;

    cpxRange := cpxArr[1 .. 9];
    if length(cpxRange) <> 9 or cpxRange[1] <> complex(1.0, 1.0) or cpxRange[2] <> complex(2.0, 2.0) or
                                 cpxRange[3] <> complex(3.0, 3.0) or cpxRange[4] <> complex(4.0, 4.0) or
                                 cpxRange[5] <> complex(5.0, 5.0) or cpxRange[6] <> complex(6.0, 6.0) or
                                 cpxRange[7] <> complex(7.0, 7.0) or cpxRange[8] <> complex(8.0, 8.0) or
                                 cpxRange[9] <> complex(9.0, 9.0) then
      writeln(" ***** ARRAY [ START .. STOP ] for complex array failed. (1)");
      okay := FALSE;
    end if;
    cpxRange := cpxArr[intExpr(1) .. 8];
    if length(cpxRange) <> 8 or cpxRange[1] <> complex(1.0, 1.0) or cpxRange[2] <> complex(2.0, 2.0) or
                                 cpxRange[3] <> complex(3.0, 3.0) or cpxRange[4] <> complex(4.0, 4.0) or
                                 cpxRange[5] <> complex(5.0, 5.0) or cpxRange[6] <> complex(6.0, 6.0) or
                                 cpxRange[7] <> complex(7.0, 7.0) or cpxRange[8] <> complex(8.0, 8.0) then
      writeln(" ***** ARRAY [ START .. STOP ] for complex array failed. (2)");
      okay := FALSE;
    end if;
    cpxRange := cpxArr[intExpr(2) .. 7];
    if length(cpxRange) <> 6 or cpxRange[1] <> complex(2.0, 2.0) or cpxRange[2] <> complex(3.0, 3.0) or
                                 cpxRange[3] <> complex(4.0, 4.0) or cpxRange[4] <> complex(5.0, 5.0) or
                                 cpxRange[5] <> complex(6.0, 6.0) or cpxRange[6] <> complex(7.0, 7.0) then
      writeln(" ***** ARRAY [ START .. STOP ] for complex array failed. (3)");
      okay := FALSE;
    end if;
    cpxRange := cpxArr[intExpr(3) .. 4];
    if length(cpxRange) <> 2 or cpxRange[1] <> complex(3.0, 3.0) or cpxRange[2] <> complex(4.0, 4.0) then
      writeln(" ***** ARRAY [ START .. STOP ] for complex array failed. (4)");
      okay := FALSE;
    end if;
    cpxRange := ([](complex(1.0, 1.0), complex(2.0, 2.0)) & cpxRange)[2 .. 3];
    if length(cpxRange) <> 2 or cpxRange[1] <> complex(2.0, 2.0) or cpxRange[2] <> complex(3.0, 3.0) then
      writeln(" ***** ARRAY [ START .. STOP ] for complex array failed. (5)");
      okay := FALSE;
    end if;
    cpxRange := ([](complex(1.0, 1.0)) & cpxRange)[intExpr(1) .. 3];
    if length(cpxRange) <> 3 or cpxRange[1] <> complex(1.0, 1.0) or cpxRange[2] <> complex(2.0, 2.0) or
                                 cpxRange[3] <> complex(3.0, 3.0) then
      writeln(" ***** ARRAY [ START .. STOP ] for complex array failed. (6)");
      okay := FALSE;
    end if;
    cpxRange := (cpxRange & [](complex(1.0, 1.0)))[4 .. intExpr(3)];
    if length(cpxRange) <> 0 then
      writeln(" ***** ARRAY [ START .. STOP ] for complex array failed. (7)");
      okay := FALSE;
    end if;
    cpxRange := (cpxRange & [](complex(1.0, 1.0)))[1 .. 0];
    if length(cpxRange) <> 0 then
      writeln(" ***** ARRAY [ START .. STOP ] for complex array failed. (8)");
      okay := FALSE;
    end if;
    cpxRange := cpxArr[intExpr(7) .. 7];
    if length(cpxRange) <> 1 or cpxRange[1] <> complex(7.0, 7.0) then
      writeln(" ***** ARRAY [ START .. STOP ] for complex array failed. (9)");
      okay := FALSE;
    end if;
    cpxRange := cpxArr[intExpr(1) .. 0];
    if length(cpxRange) <> 0 then
      writeln(" ***** ARRAY [ START .. STOP ] for complex array failed. (10)");
      okay := FALSE;
    end if;
    cpxRange := cpxArr[intExpr(10) .. 9];
    if length(cpxRange) <> 0 then
      writeln(" ***** ARRAY [ START .. STOP ] for complex array failed. (11)");
      okay := FALSE;
    end if;
    cpxArr := cpxArr[1 .. 9];
    if length(cpxArr) <> 9 or cpxArr[1] <> complex(1.0, 1.0) or cpxArr[2] <> complex(2.0, 2.0) or
                              cpxArr[3] <> complex(3.0, 3.0) or cpxArr[4] <> complex(4.0, 4.0) or
                              cpxArr[5] <> complex(5.0, 5.0) or cpxArr[6] <> complex(6.0, 6.0) or
                              cpxArr[7] <> complex(7.0, 7.0) or cpxArr[8] <> complex(8.0, 8.0) or
                              cpxArr[9] <> complex(9.0, 9.0) then
      writeln(" ***** ARRAY [ START .. STOP ] for complex array failed. (12)");
      okay := FALSE;
    end if;
    cpxArr := cpxArr[intExpr(1) .. 8];
    if length(cpxArr) <> 8 or cpxArr[1] <> complex(1.0, 1.0) or cpxArr[2] <> complex(2.0, 2.0) or
                              cpxArr[3] <> complex(3.0, 3.0) or cpxArr[4] <> complex(4.0, 4.0) or
                              cpxArr[5] <> complex(5.0, 5.0) or cpxArr[6] <> complex(6.0, 6.0) or
                              cpxArr[7] <> complex(7.0, 7.0) or cpxArr[8] <> complex(8.0, 8.0) then
      writeln(" ***** ARRAY [ START .. STOP ] for complex array failed. (13)");
      okay := FALSE;
    end if;
    cpxArr := cpxArr[intExpr(2) .. 7];
    if length(cpxArr) <> 6 or cpxArr[1] <> complex(2.0, 2.0) or cpxArr[2] <> complex(3.0, 3.0) or
                              cpxArr[3] <> complex(4.0, 4.0) or cpxArr[4] <> complex(5.0, 5.0) or
                              cpxArr[5] <> complex(6.0, 6.0) or cpxArr[6] <> complex(7.0, 7.0) then
      writeln(" ***** ARRAY [ START .. STOP ] for complex array failed. (14)");
      okay := FALSE;
    end if;
    cpxArr := cpxArr[intExpr(3) .. 5];
    if length(cpxArr) <> 3 or cpxArr[1] <> complex(4.0, 4.0) or cpxArr[2] <> complex(5.0, 5.0) or
                              cpxArr[3] <> complex(6.0, 6.0) then
      writeln(" ***** ARRAY [ START .. STOP ] for complex array failed. (15)");
      okay := FALSE;
    end if;

    chrRange := chrArr[1 .. 9];
    if length(chrRange) <> 9 or chrRange[1] <> 'a' or chrRange[2] <> 'b' or chrRange[3] <> 'c' or
            chrRange[4] <> 'd' or chrRange[5] <> 'e' or chrRange[6] <> 'f' or chrRange[7] <> 'g' or
            chrRange[8] <> 'h' or chrRange[9] <> 'i' then
      writeln(" ***** ARRAY [ START .. STOP ] for char array failed. (1)");
      okay := FALSE;
    end if;
    chrRange := chrArr[intExpr(1) .. 8];
    if length(chrRange) <> 8 or chrRange[1] <> 'a' or chrRange[2] <> 'b' or chrRange[3] <> 'c' or
            chrRange[4] <> 'd' or chrRange[5] <> 'e' or chrRange[6] <> 'f' or chrRange[7] <> 'g' or
            chrRange[8] <> 'h' then
      writeln(" ***** ARRAY [ START .. STOP ] for char array failed. (2)");
      okay := FALSE;
    end if;
    chrRange := chrArr[intExpr(2) .. 7];
    if length(chrRange) <> 6 or chrRange[1] <> 'b' or chrRange[2] <> 'c' or chrRange[3] <> 'd' or
                                 chrRange[4] <> 'e' or chrRange[5] <> 'f' or chrRange[6] <> 'g' then
      writeln(" ***** ARRAY [ START .. STOP ] for char array failed. (3)");
      okay := FALSE;
    end if;
    chrRange := chrArr[intExpr(3) .. 4];
    if length(chrRange) <> 2 or chrRange[1] <> 'c' or chrRange[2] <> 'd' then
      writeln(" ***** ARRAY [ START .. STOP ] for char array failed. (4)");
      okay := FALSE;
    end if;
    chrRange := ([]('a', 'b') & chrRange)[2 .. 3];
    if length(chrRange) <> 2 or chrRange[1] <> 'b' or chrRange[2] <> 'c' then
      writeln(" ***** ARRAY [ START .. STOP ] for char array failed. (5)");
      okay := FALSE;
    end if;
    chrRange := ([]('a') & chrRange)[intExpr(1) .. 3];
    if length(chrRange) <> 3 or chrRange[1] <> 'a' or chrRange[2] <> 'b' or chrRange[3] <> 'c' then
      writeln(" ***** ARRAY [ START .. STOP ] for char array failed. (6)");
      okay := FALSE;
    end if;
    chrRange := (chrRange & []('a'))[4 .. intExpr(3)];
    if length(chrRange) <> 0 then
      writeln(" ***** ARRAY [ START .. STOP ] for char array failed. (7)");
      okay := FALSE;
    end if;
    chrRange := (chrRange & []('a'))[1 .. 0];
    if length(chrRange) <> 0 then
      writeln(" ***** ARRAY [ START .. STOP ] for char array failed. (8)");
      okay := FALSE;
    end if;
    chrRange := chrArr[intExpr(7) .. 7];
    if length(chrRange) <> 1 or chrRange[1] <> 'g' then
      writeln(" ***** ARRAY [ START .. STOP ] for char array failed. (9)");
      okay := FALSE;
    end if;
    chrRange := chrArr[intExpr(1) .. 0];
    if length(chrRange) <> 0 then
      writeln(" ***** ARRAY [ START .. STOP ] for char array failed. (10)");
      okay := FALSE;
    end if;
    chrRange := chrArr[intExpr(10) .. 9];
    if length(chrRange) <> 0 then
      writeln(" ***** ARRAY [ START .. STOP ] for char array failed. (11)");
      okay := FALSE;
    end if;
    chrArr := chrArr[1 .. 9];
    if length(chrArr) <> 9 or chrArr[1] <> 'a' or chrArr[2] <> 'b' or chrArr[3] <> 'c' or
            chrArr[4] <> 'd' or chrArr[5] <> 'e' or chrArr[6] <> 'f' or chrArr[7] <> 'g' or
            chrArr[8] <> 'h' or chrArr[9] <> 'i' then
      writeln(" ***** ARRAY [ START .. STOP ] for char array failed. (12)");
      okay := FALSE;
    end if;
    chrArr := chrArr[intExpr(1) .. 8];
    if length(chrArr) <> 8 or chrArr[1] <> 'a' or chrArr[2] <> 'b' or chrArr[3] <> 'c' or
            chrArr[4] <> 'd' or chrArr[5] <> 'e' or chrArr[6] <> 'f' or chrArr[7] <> 'g' or
            chrArr[8] <> 'h' then
      writeln(" ***** ARRAY [ START .. STOP ] for char array failed. (13)");
      okay := FALSE;
    end if;
    chrArr := chrArr[intExpr(2) .. 7];
    if length(chrArr) <> 6 or chrArr[1] <> 'b' or chrArr[2] <> 'c' or chrArr[3] <> 'd' or
                              chrArr[4] <> 'e' or chrArr[5] <> 'f' or chrArr[6] <> 'g' then
      writeln(" ***** ARRAY [ START .. STOP ] for char array failed. (14)");
      okay := FALSE;
    end if;
    chrArr := chrArr[intExpr(3) .. 5];
    if length(chrArr) <> 3 or chrArr[1] <> 'd' or chrArr[2] <> 'e' or chrArr[3] <> 'f' then
      writeln(" ***** ARRAY [ START .. STOP ] for char array failed. (15)");
      okay := FALSE;
    end if;

    strRange := strArr[1 .. 9];
    if length(strRange) <> 9 or strRange[1] <> "one"   or strRange[2] <> "two"   or
                                 strRange[3] <> "three" or strRange[4] <> "four"  or
                                 strRange[5] <> "five"  or strRange[6] <> "six"   or
                                 strRange[7] <> "seven" or strRange[8] <> "eight" or
                                 strRange[9] <> "nine" then
      writeln(" ***** ARRAY [ START .. STOP ] for string array failed. (1)");
      okay := FALSE;
    end if;
    strRange := strArr[intExpr(1) .. 8];
    if length(strRange) <> 8 or strRange[1] <> "one"   or strRange[2] <> "two"   or
                                 strRange[3] <> "three" or strRange[4] <> "four"  or
                                 strRange[5] <> "five"  or strRange[6] <> "six"   or
                                 strRange[7] <> "seven" or strRange[8] <> "eight" then
      writeln(" ***** ARRAY [ START .. STOP ] for string array failed. (2)");
      okay := FALSE;
    end if;
    strRange := strArr[intExpr(2) .. 7];
    if length(strRange) <> 6 or strRange[1] <> "two"  or strRange[2] <> "three" or
                                 strRange[3] <> "four" or strRange[4] <> "five"  or
                                 strRange[5] <> "six"  or strRange[6] <> "seven" then
      writeln(" ***** ARRAY [ START .. STOP ] for string array failed. (3)");
      okay := FALSE;
    end if;
    strRange := strArr[intExpr(3) .. 4];
    if length(strRange) <> 2 or strRange[1] <> "three" or strRange[2] <> "four" then
      writeln(" ***** ARRAY [ START .. STOP ] for string array failed. (4)");
      okay := FALSE;
    end if;
    strRange := ([]("one", "two") & strRange)[2 .. 3];
    if length(strRange) <> 2 or strRange[1] <> "two" or strRange[2] <> "three" then
      writeln(" ***** ARRAY [ START .. STOP ] for string array failed. (5)");
      okay := FALSE;
    end if;
    strRange := ([]("one") & strRange)[intExpr(1) .. 3];
    if length(strRange) <> 3 or strRange[1] <> "one" or strRange[2] <> "two" or
                                 strRange[3] <> "three" then
      writeln(" ***** ARRAY [ START .. STOP ] for string array failed. (6)");
      okay := FALSE;
    end if;
    strRange := (strRange & []("one"))[4 .. intExpr(3)];
    if length(strRange) <> 0 then
      writeln(" ***** ARRAY [ START .. STOP ] for string array failed. (7)");
      okay := FALSE;
    end if;
    strRange := (strRange & []("one"))[1 .. 0];
    if length(strRange) <> 0 then
      writeln(" ***** ARRAY [ START .. STOP ] for string array failed. (8)");
      okay := FALSE;
    end if;
    strRange := strArr[intExpr(7) .. 7];
    if length(strRange) <> 1 or strRange[1] <> "seven" then
      writeln(" ***** ARRAY [ START .. STOP ] for string array failed. (9)");
      okay := FALSE;
    end if;
    strRange := strArr[intExpr(1) .. 0];
    if length(strRange) <> 0 then
      writeln(" ***** ARRAY [ START .. STOP ] for string array failed. (10)");
      okay := FALSE;
    end if;
    strRange := strArr[intExpr(10) .. 9];
    if length(strRange) <> 0 then
      writeln(" ***** ARRAY [ START .. STOP ] for string array failed. (11)");
      okay := FALSE;
    end if;
    strArr := strArr[1 .. 9];
    if length(strArr) <> 9 or strArr[1] <> "one"   or strArr[2] <> "two"   or strArr[3] <> "three" or
                              strArr[4] <> "four"  or strArr[5] <> "five"  or strArr[6] <> "six"   or
                              strArr[7] <> "seven" or strArr[8] <> "eight" or strArr[9] <> "nine"  then
      writeln(" ***** ARRAY [ START .. STOP ] for string array failed. (12)");
      okay := FALSE;
    end if;
    strArr := strArr[intExpr(1) .. 8];
    if length(strArr) <> 8 or strArr[1] <> "one"   or strArr[2] <> "two"   or strArr[3] <> "three" or
                              strArr[4] <> "four"  or strArr[5] <> "five"  or strArr[6] <> "six"   or
                              strArr[7] <> "seven" or strArr[8] <> "eight" then
      writeln(" ***** ARRAY [ START .. STOP ] for string array failed. (13)");
      okay := FALSE;
    end if;
    strArr := strArr[intExpr(2) .. 7];
    if length(strArr) <> 6 or strArr[1] <> "two"  or strArr[2] <> "three" or strArr[3] <> "four"  or
                              strArr[4] <> "five" or strArr[5] <> "six"   or strArr[6] <> "seven" then
      writeln(" ***** ARRAY [ START .. STOP ] for string array failed. (14)");
      okay := FALSE;
    end if;
    strArr := strArr[intExpr(3) .. 5];
    if length(strArr) <> 3 or strArr[1] <> "four" or strArr[2] <> "five" or strArr[3] <> "six" then
      writeln(" ***** ARRAY [ START .. STOP ] for string array failed. (15)");
      okay := FALSE;
    end if;

    if  not raisesIndexError(intArr[integer.first .. integer.first]) or
        not raisesIndexError(bigArr[integer.first .. integer.first]) or
        not raisesIndexError(fltArr[integer.first .. integer.first]) or
        not raisesIndexError(cpxArr[integer.first .. integer.first]) or
        not raisesIndexError(chrArr[integer.first .. integer.first]) or
        not raisesIndexError(strArr[integer.first .. integer.first]) or
        not raisesIndexError(intArr[-1 .. integer.first]) or
        not raisesIndexError(bigArr[-1 .. integer.first]) or
        not raisesIndexError(fltArr[-1 .. integer.first]) or
        not raisesIndexError(cpxArr[-1 .. integer.first]) or
        not raisesIndexError(chrArr[-1 .. integer.first]) or
        not raisesIndexError(strArr[-1 .. integer.first]) or
        not raisesIndexError(intArr[0 .. integer.first]) or
        not raisesIndexError(bigArr[0 .. integer.first]) or
        not raisesIndexError(fltArr[0 .. integer.first]) or
        not raisesIndexError(cpxArr[0 .. integer.first]) or
        not raisesIndexError(chrArr[0 .. integer.first]) or
        not raisesIndexError(strArr[0 .. integer.first]) or
        not raisesIndexError(intArr[1 .. integer.first]) or
        not raisesIndexError(bigArr[1 .. integer.first]) or
        not raisesIndexError(fltArr[1 .. integer.first]) or
        not raisesIndexError(cpxArr[1 .. integer.first]) or
        not raisesIndexError(chrArr[1 .. integer.first]) or
        not raisesIndexError(strArr[1 .. integer.first]) or
        not raisesIndexError(intArr[3 .. integer.first]) or
        not raisesIndexError(bigArr[3 .. integer.first]) or
        not raisesIndexError(fltArr[3 .. integer.first]) or
        not raisesIndexError(cpxArr[3 .. integer.first]) or
        not raisesIndexError(chrArr[3 .. integer.first]) or
        not raisesIndexError(strArr[3 .. integer.first]) or
        not raisesIndexError(intArr[4 .. integer.first]) or
        not raisesIndexError(bigArr[4 .. integer.first]) or
        not raisesIndexError(fltArr[4 .. integer.first]) or
        not raisesIndexError(cpxArr[4 .. integer.first]) or
        not raisesIndexError(chrArr[4 .. integer.first]) or
        not raisesIndexError(strArr[4 .. integer.first]) or
        not raisesIndexError(intArr[5 .. integer.first]) or
        not raisesIndexError(bigArr[5 .. integer.first]) or
        not raisesIndexError(fltArr[5 .. integer.first]) or
        not raisesIndexError(cpxArr[5 .. integer.first]) or
        not raisesIndexError(chrArr[5 .. integer.first]) or
        not raisesIndexError(strArr[5 .. integer.first]) or
        not raisesIndexError(intArr[integer.last .. integer.first]) or
        not raisesIndexError(bigArr[integer.last .. integer.first]) or
        not raisesIndexError(fltArr[integer.last .. integer.first]) or
        not raisesIndexError(cpxArr[integer.last .. integer.first]) or
        not raisesIndexError(chrArr[integer.last .. integer.first]) or
        not raisesIndexError(strArr[integer.last .. integer.first]) then
      writeln(" ***** ARRAY [ START .. STOP ] with index out of range does not raise INDEX_ERROR. (1)");
      okay := FALSE;
    end if;

    if  not raisesIndexError(intArr[integer.first .. -1]) or
        not raisesIndexError(bigArr[integer.first .. -1]) or
        not raisesIndexError(fltArr[integer.first .. -1]) or
        not raisesIndexError(cpxArr[integer.first .. -1]) or
        not raisesIndexError(chrArr[integer.first .. -1]) or
        not raisesIndexError(strArr[integer.first .. -1]) or
        not raisesIndexError(intArr[-1 .. -1]) or
        not raisesIndexError(bigArr[-1 .. -1]) or
        not raisesIndexError(fltArr[-1 .. -1]) or
        not raisesIndexError(cpxArr[-1 .. -1]) or
        not raisesIndexError(chrArr[-1 .. -1]) or
        not raisesIndexError(strArr[-1 .. -1]) or
        not raisesIndexError(intArr[0 .. -1]) or
        not raisesIndexError(bigArr[0 .. -1]) or
        not raisesIndexError(fltArr[0 .. -1]) or
        not raisesIndexError(cpxArr[0 .. -1]) or
        not raisesIndexError(chrArr[0 .. -1]) or
        not raisesIndexError(strArr[0 .. -1]) or
        not raisesIndexError(intArr[1 .. -1]) or
        not raisesIndexError(bigArr[1 .. -1]) or
        not raisesIndexError(fltArr[1 .. -1]) or
        not raisesIndexError(cpxArr[1 .. -1]) or
        not raisesIndexError(chrArr[1 .. -1]) or
        not raisesIndexError(strArr[1 .. -1]) or
        not raisesIndexError(intArr[3 .. 1]) or
        not raisesIndexError(bigArr[3 .. 1]) or
        not raisesIndexError(fltArr[3 .. 1]) or
        not raisesIndexError(cpxArr[3 .. 1]) or
        not raisesIndexError(chrArr[3 .. 1]) or
        not raisesIndexError(strArr[3 .. 1]) or
        not raisesIndexError(intArr[4 .. 2]) or
        not raisesIndexError(bigArr[4 .. 2]) or
        not raisesIndexError(fltArr[4 .. 2]) or
        not raisesIndexError(cpxArr[4 .. 2]) or
        not raisesIndexError(chrArr[4 .. 2]) or
        not raisesIndexError(strArr[4 .. 2]) or
        not raisesIndexError(intArr[5 .. 3]) or
        not raisesIndexError(bigArr[5 .. 3]) or
        not raisesIndexError(fltArr[5 .. 3]) or
        not raisesIndexError(cpxArr[5 .. 3]) or
        not raisesIndexError(chrArr[5 .. 3]) or
        not raisesIndexError(strArr[5 .. 3]) or
        not raisesIndexError(intArr[integer.last .. -1]) or
        not raisesIndexError(bigArr[integer.last .. -1]) or
        not raisesIndexError(fltArr[integer.last .. -1]) or
        not raisesIndexError(cpxArr[integer.last .. -1]) or
        not raisesIndexError(chrArr[integer.last .. -1]) or
        not raisesIndexError(strArr[integer.last .. -1]) then
      writeln(" ***** ARRAY [ START .. STOP ] with index out of range does not raise INDEX_ERROR. (2)");
      okay := FALSE;
    end if;

    if  not raisesIndexError(intArr[integer.first .. 0]) or
        not raisesIndexError(bigArr[integer.first .. 0]) or
        not raisesIndexError(fltArr[integer.first .. 0]) or
        not raisesIndexError(cpxArr[integer.first .. 0]) or
        not raisesIndexError(chrArr[integer.first .. 0]) or
        not raisesIndexError(strArr[integer.first .. 0]) or
        not raisesIndexError(intArr[-1 .. 0]) or
        not raisesIndexError(bigArr[-1 .. 0]) or
        not raisesIndexError(fltArr[-1 .. 0]) or
        not raisesIndexError(cpxArr[-1 .. 0]) or
        not raisesIndexError(chrArr[-1 .. 0]) or
        not raisesIndexError(strArr[-1 .. 0]) or
        not raisesIndexError(intArr[0 .. 0]) or
        not raisesIndexError(bigArr[0 .. 0]) or
        not raisesIndexError(fltArr[0 .. 0]) or
        not raisesIndexError(cpxArr[0 .. 0]) or
        not raisesIndexError(chrArr[0 .. 0]) or
        not raisesIndexError(strArr[0 .. 0]) (* or
        not raisesIndexError(intArr[7 .. 0]) or
        not raisesIndexError(bigArr[7 .. 0]) or
        not raisesIndexError(fltArr[7 .. 0]) or
        not raisesIndexError(cpxArr[7 .. 0]) or
        not raisesIndexError(chrArr[7 .. 0]) or
        not raisesIndexError(strArr[7 .. 0]) or
        not raisesIndexError(intArr[integer.last .. 0]) or
        not raisesIndexError(bigArr[integer.last .. 0]) or
        not raisesIndexError(fltArr[integer.last .. 0]) or
        not raisesIndexError(cpxArr[integer.last .. 0]) or
        not raisesIndexError(chrArr[integer.last .. 0]) or
        not raisesIndexError(strArr[integer.last .. 0]) *) then
      writeln(" ***** ARRAY [ START .. STOP ] with index out of range does not raise INDEX_ERROR. (3)");
      okay := FALSE;
    end if;

    if  not raisesIndexError(([] (1, 2) & [] (3, 4))                    [integer.first .. integer.first]) or
        not raisesIndexError(([] (1_, 2_) & [] (3_, 4_))                [integer.first .. integer.first]) or
        not raisesIndexError(([] (1.0, 2.0) & [] (3.0, 4.0))            [integer.first .. integer.first]) or
        not raisesIndexError(([] (complex(1.0, 1.0), complex(2.0, 2.0)) &
                              [] (complex(3.0, 3.0), complex(4.0, 4.0)))[integer.first .. integer.first]) or
        not raisesIndexError(([] ('a', 'b') & [] ('c', 'd'))            [integer.first .. integer.first]) or
        not raisesIndexError(([] ("one", "two") & [] ("three", "four")) [integer.first .. integer.first]) or
        not raisesIndexError(([] (1, 2) & [] (3, 4))                    [-1 .. integer.first]) or
        not raisesIndexError(([] (1_, 2_) & [] (3_, 4_))                [-1 .. integer.first]) or
        not raisesIndexError(([] (1.0, 2.0) & [] (3.0, 4.0))            [-1 .. integer.first]) or
        not raisesIndexError(([] (complex(1.0, 1.0), complex(2.0, 2.0)) &
                              [] (complex(3.0, 3.0), complex(4.0, 4.0)))[-1 .. integer.first]) or
        not raisesIndexError(([] ('a', 'b') & [] ('c', 'd'))            [-1 .. integer.first]) or
        not raisesIndexError(([] ("one", "two") & [] ("three", "four")) [-1 .. integer.first]) or
        not raisesIndexError(([] (1, 2) & [] (3, 4))                    [0 .. integer.first]) or
        not raisesIndexError(([] (1_, 2_) & [] (3_, 4_))                [0 .. integer.first]) or
        not raisesIndexError(([] (1.0, 2.0) & [] (3.0, 4.0))            [0 .. integer.first]) or
        not raisesIndexError(([] (complex(1.0, 1.0), complex(2.0, 2.0)) &
                              [] (complex(3.0, 3.0), complex(4.0, 4.0)))[0 .. integer.first]) or
        not raisesIndexError(([] ('a', 'b') & [] ('c', 'd'))            [0 .. integer.first]) or
        not raisesIndexError(([] ("one", "two") & [] ("three", "four")) [0 .. integer.first]) or
        not raisesIndexError(([] (1, 2) & [] (3, 4))                    [3 .. integer.first]) or
        not raisesIndexError(([] (1_, 2_) & [] (3_, 4_))                [3 .. integer.first]) or
        not raisesIndexError(([] (1.0, 2.0) & [] (3.0, 4.0))            [3 .. integer.first]) or
        not raisesIndexError(([] (complex(1.0, 1.0), complex(2.0, 2.0)) &
                              [] (complex(3.0, 3.0), complex(4.0, 4.0)))[3 .. integer.first]) or
        not raisesIndexError(([] ('a', 'b') & [] ('c', 'd'))            [3 .. integer.first]) or
        not raisesIndexError(([] ("one", "two") & [] ("three", "four")) [3 .. integer.first]) or
        not raisesIndexError(([] (1, 2) & [] (3, 4))                    [4 .. integer.first]) or
        not raisesIndexError(([] (1_, 2_) & [] (3_, 4_))                [4 .. integer.first]) or
        not raisesIndexError(([] (1.0, 2.0) & [] (3.0, 4.0))            [4 .. integer.first]) or
        not raisesIndexError(([] (complex(1.0, 1.0), complex(2.0, 2.0)) &
                              [] (complex(3.0, 3.0), complex(4.0, 4.0)))[4 .. integer.first]) or
        not raisesIndexError(([] ('a', 'b') & [] ('c', 'd'))            [4 .. integer.first]) or
        not raisesIndexError(([] ("one", "two") & [] ("three", "four")) [4 .. integer.first]) or
        not raisesIndexError(([] (1, 2) & [] (3, 4))                    [5 .. integer.first]) or
        not raisesIndexError(([] (1_, 2_) & [] (3_, 4_))                [5 .. integer.first]) or
        not raisesIndexError(([] (1.0, 2.0) & [] (3.0, 4.0))            [5 .. integer.first]) or
        not raisesIndexError(([] (complex(1.0, 1.0), complex(2.0, 2.0)) &
                              [] (complex(3.0, 3.0), complex(4.0, 4.0)))[5 .. integer.first]) or
        not raisesIndexError(([] ('a', 'b') & [] ('c', 'd'))            [5 .. integer.first]) or
        not raisesIndexError(([] ("one", "two") & [] ("three", "four")) [5 .. integer.first]) or
        not raisesIndexError(([] (1, 2) & [] (3, 4))                    [integer.last .. integer.first]) or
        not raisesIndexError(([] (1_, 2_) & [] (3_, 4_))                [integer.last .. integer.first]) or
        not raisesIndexError(([] (1.0, 2.0) & [] (3.0, 4.0))            [integer.last .. integer.first]) or
        not raisesIndexError(([] (complex(1.0, 1.0), complex(2.0, 2.0)) &
                              [] (complex(3.0, 3.0), complex(4.0, 4.0)))[integer.last .. integer.first]) or
        not raisesIndexError(([] ('a', 'b') & [] ('c', 'd'))            [integer.last .. integer.first]) or
        not raisesIndexError(([] ("one", "two") & [] ("three", "four")) [integer.last .. integer.first]) then
      writeln(" ***** ARRAY [ START .. STOP ] with index out of range does not raise INDEX_ERROR. (4)");
      okay := FALSE;
    end if;

    if  not raisesIndexError(([] (1, 2) & [] (3, 4))                    [integer.first .. -1]) or
        not raisesIndexError(([] (1_, 2_) & [] (3_, 4_))                [integer.first .. -1]) or
        not raisesIndexError(([] (1.0, 2.0) & [] (3.0, 4.0))            [integer.first .. -1]) or
        not raisesIndexError(([] (complex(1.0, 1.0), complex(2.0, 2.0)) &
                              [] (complex(3.0, 3.0), complex(4.0, 4.0)))[integer.first .. -1]) or
        not raisesIndexError(([] ('a', 'b') & [] ('c', 'd'))            [integer.first .. -1]) or
        not raisesIndexError(([] ("one", "two") & [] ("three", "four")) [integer.first .. -1]) or
        not raisesIndexError(([] (1, 2) & [] (3, 4))                    [-1 .. -1]) or
        not raisesIndexError(([] (1_, 2_) & [] (3_, 4_))                [-1 .. -1]) or
        not raisesIndexError(([] (1.0, 2.0) & [] (3.0, 4.0))            [-1 .. -1]) or
        not raisesIndexError(([] (complex(1.0, 1.0), complex(2.0, 2.0)) &
                              [] (complex(3.0, 3.0), complex(4.0, 4.0)))[-1 .. -1]) or
        not raisesIndexError(([] ('a', 'b') & [] ('c', 'd'))            [-1 .. -1]) or
        not raisesIndexError(([] ("one", "two") & [] ("three", "four")) [-1 .. -1]) or
        not raisesIndexError(([] (1, 2) & [] (3, 4))                    [0 .. -1]) or
        not raisesIndexError(([] (1_, 2_) & [] (3_, 4_))                [0 .. -1]) or
        not raisesIndexError(([] (1.0, 2.0) & [] (3.0, 4.0))            [0 .. -1]) or
        not raisesIndexError(([] (complex(1.0, 1.0), complex(2.0, 2.0)) &
                              [] (complex(3.0, 3.0), complex(4.0, 4.0)))[0 .. -1]) or
        not raisesIndexError(([] ('a', 'b') & [] ('c', 'd'))            [0 .. -1]) or
        not raisesIndexError(([] ("one", "two") & [] ("three", "four")) [0 .. -1]) or
        not raisesIndexError(([] (1, 2) & [] (3, 4))                    [3 .. 1]) or
        not raisesIndexError(([] (1_, 2_) & [] (3_, 4_))                [3 .. 1]) or
        not raisesIndexError(([] (1.0, 2.0) & [] (3.0, 4.0))            [3 .. 1]) or
        not raisesIndexError(([] (complex(1.0, 1.0), complex(2.0, 2.0)) &
                              [] (complex(3.0, 3.0), complex(4.0, 4.0)))[3 .. 1]) or
        not raisesIndexError(([] ('a', 'b') & [] ('c', 'd'))            [3 .. 1]) or
        not raisesIndexError(([] ("one", "two") & [] ("three", "four")) [3 .. 1]) or
        not raisesIndexError(([] (1, 2) & [] (3, 4))                    [4 .. 2]) or
        not raisesIndexError(([] (1_, 2_) & [] (3_, 4_))                [4 .. 2]) or
        not raisesIndexError(([] (1.0, 2.0) & [] (3.0, 4.0))            [4 .. 2]) or
        not raisesIndexError(([] (complex(1.0, 1.0), complex(2.0, 2.0)) &
                              [] (complex(3.0, 3.0), complex(4.0, 4.0)))[4 .. 2]) or
        not raisesIndexError(([] ('a', 'b') & [] ('c', 'd'))            [4 .. 2]) or
        not raisesIndexError(([] ("one", "two") & [] ("three", "four")) [4 .. 2]) or
        not raisesIndexError(([] (1, 2) & [] (3, 4))                    [5 .. 3]) or
        not raisesIndexError(([] (1_, 2_) & [] (3_, 4_))                [5 .. 3]) or
        not raisesIndexError(([] (1.0, 2.0) & [] (3.0, 4.0))            [5 .. 3]) or
        not raisesIndexError(([] (complex(1.0, 1.0), complex(2.0, 2.0)) &
                              [] (complex(3.0, 3.0), complex(4.0, 4.0)))[5 .. 3]) or
        not raisesIndexError(([] ('a', 'b') & [] ('c', 'd'))            [5 .. 3]) or
        not raisesIndexError(([] ("one", "two") & [] ("three", "four")) [5 .. 3]) or
        not raisesIndexError(([] (1, 2) & [] (3, 4))                    [integer.last .. -1]) or
        not raisesIndexError(([] (1_, 2_) & [] (3_, 4_))                [integer.last .. -1]) or
        not raisesIndexError(([] (1.0, 2.0) & [] (3.0, 4.0))            [integer.last .. -1]) or
        not raisesIndexError(([] (complex(1.0, 1.0), complex(2.0, 2.0)) &
                              [] (complex(3.0, 3.0), complex(4.0, 4.0)))[integer.last .. -1]) or
        not raisesIndexError(([] ('a', 'b') & [] ('c', 'd'))            [integer.last .. -1]) or
        not raisesIndexError(([] ("one", "two") & [] ("three", "four")) [integer.last .. -1]) then
      writeln(" ***** ARRAY [ START .. STOP ] with index out of range does not raise INDEX_ERROR. (5)");
      okay := FALSE;
    end if;

    if  not raisesIndexError(([] (1, 2) & [] (3, 4))                    [integer.first .. 0]) or
        not raisesIndexError(([] (1_, 2_) & [] (3_, 4_))                [integer.first .. 0]) or
        not raisesIndexError(([] (1.0, 2.0) & [] (3.0, 4.0))            [integer.first .. 0]) or
        not raisesIndexError(([] (complex(1.0, 1.0), complex(2.0, 2.0)) &
                              [] (complex(3.0, 3.0), complex(4.0, 4.0)))[integer.first .. 0]) or
        not raisesIndexError(([] ('a', 'b') & [] ('c', 'd'))            [integer.first .. 0]) or
        not raisesIndexError(([] ("one", "two") & [] ("three", "four")) [integer.first .. 0]) or
        not raisesIndexError(([] (1, 2) & [] (3, 4))                    [-1 .. 0]) or
        not raisesIndexError(([] (1_, 2_) & [] (3_, 4_))                [-1 .. 0]) or
        not raisesIndexError(([] (1.0, 2.0) & [] (3.0, 4.0))            [-1 .. 0]) or
        not raisesIndexError(([] (complex(1.0, 1.0), complex(2.0, 2.0)) &
                              [] (complex(3.0, 3.0), complex(4.0, 4.0)))[-1 .. 0]) or
        not raisesIndexError(([] ('a', 'b') & [] ('c', 'd'))            [-1 .. 0]) or
        not raisesIndexError(([] ("one", "two") & [] ("three", "four")) [-1 .. 0]) or
        not raisesIndexError(([] (1, 2) & [] (3, 4))                    [0 .. 0]) or
        not raisesIndexError(([] (1_, 2_) & [] (3_, 4_))                [0 .. 0]) or
        not raisesIndexError(([] (1.0, 2.0) & [] (3.0, 4.0))            [0 .. 0]) or
        not raisesIndexError(([] (complex(1.0, 1.0), complex(2.0, 2.0)) &
                              [] (complex(3.0, 3.0), complex(4.0, 4.0)))[0 .. 0]) or
        not raisesIndexError(([] ('a', 'b') & [] ('c', 'd'))            [0 .. 0]) or
        not raisesIndexError(([] ("one", "two") & [] ("three", "four")) [0 .. 0]) (* or
        not raisesIndexError(([] (1, 2) & [] (3, 4))                    [3 .. 0]) or
        not raisesIndexError(([] (1_, 2_) & [] (3_, 4_))                [3 .. 0]) or
        not raisesIndexError(([] (1.0, 2.0) & [] (3.0, 4.0))            [3 .. 0]) or
        not raisesIndexError(([] (complex(1.0, 1.0), complex(2.0, 2.0)) &
                              [] (complex(3.0, 3.0), complex(4.0, 4.0)))[3 .. 0]) or
        not raisesIndexError(([] ('a', 'b') & [] ('c', 'd'))            [3 .. 0]) or
        not raisesIndexError(([] ("one", "two") & [] ("three", "four")) [3 .. 0]) or
        not raisesIndexError(([] (1, 2) & [] (3, 4))                    [4 .. 0]) or
        not raisesIndexError(([] (1_, 2_) & [] (3_, 4_))                [4 .. 0]) or
        not raisesIndexError(([] (1.0, 2.0) & [] (3.0, 4.0))            [4 .. 0]) or
        not raisesIndexError(([] (complex(1.0, 1.0), complex(2.0, 2.0)) &
                              [] (complex(3.0, 3.0), complex(4.0, 4.0)))[4 .. 0]) or
        not raisesIndexError(([] ('a', 'b') & [] ('c', 'd'))            [4 .. 0]) or
        not raisesIndexError(([] ("one", "two") & [] ("three", "four")) [4 .. 0]) or
        not raisesIndexError(([] (1, 2) & [] (3, 4))                    [5 .. 0]) or
        not raisesIndexError(([] (1_, 2_) & [] (3_, 4_))                [5 .. 0]) or
        not raisesIndexError(([] (1.0, 2.0) & [] (3.0, 4.0))            [5 .. 0]) or
        not raisesIndexError(([] (complex(1.0, 1.0), complex(2.0, 2.0)) &
                              [] (complex(3.0, 3.0), complex(4.0, 4.0)))[5 .. 0]) or
        not raisesIndexError(([] ('a', 'b') & [] ('c', 'd'))            [5 .. 0]) or
        not raisesIndexError(([] ("one", "two") & [] ("three", "four")) [5 .. 0]) or
        not raisesIndexError(([] (1, 2) & [] (3, 4))                    [integer.last .. 0]) or
        not raisesIndexError(([] (1_, 2_) & [] (3_, 4_))                [integer.last .. 0]) or
        not raisesIndexError(([] (1.0, 2.0) & [] (3.0, 4.0))            [integer.last .. 0]) or
        not raisesIndexError(([] (complex(1.0, 1.0), complex(2.0, 2.0)) &
                              [] (complex(3.0, 3.0), complex(4.0, 4.0)))[integer.last .. 0]) or
        not raisesIndexError(([] ('a', 'b') & [] ('c', 'd'))            [integer.last .. 0]) or
        not raisesIndexError(([] ("one", "two") & [] ("three", "four")) [integer.last .. 0]) *) then
      writeln(" ***** ARRAY [ START .. STOP ] with index out of range does not raise INDEX_ERROR. (6)");
      okay := FALSE;
    end if;

    if okay then
      writeln("Range of array works correct.");
    end if;
  end func;


const proc: testSubarr is func
  local
    var boolean: okay is TRUE;
    var array integer: intArr is [] (1, 2, 3, 4, 5, 6, 7, 8, 9);
    var array bigInteger: bigArr is [] (1_, 2_, 3_, 4_, 5_, 6_, 7_, 8_, 9_);
    var array float: fltArr is [] (1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0);
    var array complex: cpxArr is [] (complex(1.0, 1.0), complex(2.0, 2.0), complex(3.0, 3.0),
        complex(4.0, 4.0), complex(5.0, 5.0), complex(6.0, 6.0), complex(7.0, 7.0),
        complex(8.0, 8.0), complex(9.0, 9.0));
    var array char: chrArr is [] ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i');
    var array string: strArr is [] ("one", "two", "three", "four", "five", "six", "seven",
        "eight", "nine");
    var array integer: intSubarr is 0 times 0;
    var array bigInteger: bigSubarr is 0 times 0_;
    var array float: fltSubarr is 0 times 0.0;
    var array complex: cpxSubarr is 0 times complex(0.0, 0.0);
    var array char: chrSubarr is 0 times ' ';
    var array string: strSubarr is 0 times "";
  begin
    intSubarr := intArr[1 len 9];
    if length(intSubarr) <> 9 or intSubarr[1] <> 1 or intSubarr[2] <> 2 or intSubarr[3] <> 3 or
            intSubarr[4] <> 4 or intSubarr[5] <> 5 or intSubarr[6] <> 6 or intSubarr[7] <> 7 or
            intSubarr[8] <> 8 or intSubarr[9] <> 9 then
      writeln(" ***** ARRAY [ START len LENGTH ] for integer array failed. (1)");
      okay := FALSE;
    end if;
    intSubarr := intArr[intExpr(1) len 8];
    if length(intSubarr) <> 8 or intSubarr[1] <> 1 or intSubarr[2] <> 2 or intSubarr[3] <> 3 or
            intSubarr[4] <> 4 or intSubarr[5] <> 5 or intSubarr[6] <> 6 or intSubarr[7] <> 7 or
            intSubarr[8] <> 8 then
      writeln(" ***** ARRAY [ START len LENGTH ] for integer array failed. (2)");
      okay := FALSE;
    end if;
    intSubarr := intArr[intExpr(2) len 6];
    if length(intSubarr) <> 6 or intSubarr[1] <> 2 or intSubarr[2] <> 3 or intSubarr[3] <> 4 or
                                 intSubarr[4] <> 5 or intSubarr[5] <> 6 or intSubarr[6] <> 7 then
      writeln(" ***** ARRAY [ START len LENGTH ] for integer array failed. (3)");
      okay := FALSE;
    end if;
    intSubarr := intArr[intExpr(3) len 2];
    if length(intSubarr) <> 2 or intSubarr[1] <> 3 or intSubarr[2] <> 4 then
      writeln(" ***** ARRAY [ START len LENGTH ] for integer array failed. (4)");
      okay := FALSE;
    end if;
    intSubarr := ([](1, 2) & intSubarr)[2 len 2];
    if length(intSubarr) <> 2 or intSubarr[1] <> 2 or intSubarr[2] <> 3 then
      writeln(" ***** ARRAY [ START len LENGTH ] for integer array failed. (5)");
      okay := FALSE;
    end if;
    intSubarr := ([](1) & intSubarr)[intExpr(1) len 3];
    if length(intSubarr) <> 3 or intSubarr[1] <> 1 or intSubarr[2] <> 2 or intSubarr[3] <> 3 then
      writeln(" ***** ARRAY [ START len LENGTH ] for integer array failed. (6)");
      okay := FALSE;
    end if;
    intSubarr := (intSubarr & [](1))[4 len intExpr(0)];
    if length(intSubarr) <> 0 then
      writeln(" ***** ARRAY [ START len LENGTH ] for integer array failed. (7)");
      okay := FALSE;
    end if;
    intSubarr := (intSubarr & [](1))[1 len 0];
    if length(intSubarr) <> 0 then
      writeln(" ***** ARRAY [ START len LENGTH ] for integer array failed. (8)");
      okay := FALSE;
    end if;
    intSubarr := intArr[intExpr(7) len 1];
    if length(intSubarr) <> 1 or intSubarr[1] <> 7 then
      writeln(" ***** ARRAY [ START len LENGTH ] for integer array failed. (9)");
      okay := FALSE;
    end if;
    intSubarr := intArr[intExpr(1) len 0];
    if length(intSubarr) <> 0 then
      writeln(" ***** ARRAY [ START len LENGTH ] for integer array failed. (10)");
      okay := FALSE;
    end if;
    intSubarr := intArr[intExpr(10) len 0];
    if length(intSubarr) <> 0 then
      writeln(" ***** ARRAY [ START len LENGTH ] for integer array failed. (11)");
      okay := FALSE;
    end if;
    intArr := intArr[1 len 9];
    if length(intArr) <> 9 or intArr[1] <> 1 or intArr[2] <> 2 or intArr[3] <> 3 or
            intArr[4] <> 4 or intArr[5] <> 5 or intArr[6] <> 6 or intArr[7] <> 7 or
            intArr[8] <> 8 or intArr[9] <> 9 then
      writeln(" ***** ARRAY [ START len LENGTH ] for integer array failed. (12)");
      okay := FALSE;
    end if;
    intArr := intArr[intExpr(1) len 8];
    if length(intArr) <> 8 or intArr[1] <> 1 or intArr[2] <> 2 or intArr[3] <> 3 or
            intArr[4] <> 4 or intArr[5] <> 5 or intArr[6] <> 6 or intArr[7] <> 7 or
            intArr[8] <> 8 then
      writeln(" ***** ARRAY [ START len LENGTH ] for integer array failed. (13)");
      okay := FALSE;
    end if;
    intArr := intArr[intExpr(2) len 6];
    if length(intArr) <> 6 or intArr[1] <> 2 or intArr[2] <> 3 or intArr[3] <> 4 or
                              intArr[4] <> 5 or intArr[5] <> 6 or intArr[6] <> 7 then
      writeln(" ***** ARRAY [ START len LENGTH ] for integer array failed. (14)");
      okay := FALSE;
    end if;
    intArr := intArr[intExpr(3) len 3];
    if length(intArr) <> 3 or intArr[1] <> 4 or intArr[2] <> 5 or intArr[3] <> 6 then
      writeln(" ***** ARRAY [ START len LENGTH ] for integer array failed. (15)");
      okay := FALSE;
    end if;

    bigSubarr := bigArr[1 len 9];
    if length(bigSubarr) <> 9 or bigSubarr[1] <> 1_ or bigSubarr[2] <> 2_ or bigSubarr[3] <> 3_ or
           bigSubarr[4] <> 4_ or bigSubarr[5] <> 5_ or bigSubarr[6] <> 6_ or bigSubarr[7] <> 7_ or
           bigSubarr[8] <> 8_ or bigSubarr[9] <> 9_ then
      writeln(" ***** ARRAY [ START len LENGTH ] for bigInteger array failed. (1)");
      okay := FALSE;
    end if;
    bigSubarr := bigArr[intExpr(1) len 8];
    if length(bigSubarr) <> 8 or bigSubarr[1] <> 1_ or bigSubarr[2] <> 2_ or bigSubarr[3] <> 3_ or
           bigSubarr[4] <> 4_ or bigSubarr[5] <> 5_ or bigSubarr[6] <> 6_ or bigSubarr[7] <> 7_ or
           bigSubarr[8] <> 8_ then
      writeln(" ***** ARRAY [ START len LENGTH ] for bigInteger array failed. (2)");
      okay := FALSE;
    end if;
    bigSubarr := bigArr[intExpr(2) len 6];
    if length(bigSubarr) <> 6 or bigSubarr[1] <> 2_ or bigSubarr[2] <> 3_ or bigSubarr[3] <> 4_ or
                                 bigSubarr[4] <> 5_ or bigSubarr[5] <> 6_ or bigSubarr[6] <> 7_ then
      writeln(" ***** ARRAY [ START len LENGTH ] for bigInteger array failed. (3)");
      okay := FALSE;
    end if;
    bigSubarr := bigArr[intExpr(3) len 2];
    if length(bigSubarr) <> 2 or bigSubarr[1] <> 3_ or bigSubarr[2] <> 4_ then
      writeln(" ***** ARRAY [ START len LENGTH ] for bigInteger array failed. (4)");
      okay := FALSE;
    end if;
    bigSubarr := ([](1_, 2_) & bigSubarr)[2 len 2];
    if length(bigSubarr) <> 2 or bigSubarr[1] <> 2_ or bigSubarr[2] <> 3_ then
      writeln(" ***** ARRAY [ START len LENGTH ] for bigInteger array failed. (5)");
      okay := FALSE;
    end if;
    bigSubarr := ([](1_) & bigSubarr)[intExpr(1) len 3];
    if length(bigSubarr) <> 3 or bigSubarr[1] <> 1_ or bigSubarr[2] <> 2_ or bigSubarr[3] <> 3_ then
      writeln(" ***** ARRAY [ START len LENGTH ] for bigInteger array failed. (6)");
      okay := FALSE;
    end if;
    bigSubarr := (bigSubarr & [](1_))[4 len intExpr(0)];
    if length(bigSubarr) <> 0 then
      writeln(" ***** ARRAY [ START len LENGTH ] for bigInteger array failed. (7)");
      okay := FALSE;
    end if;
    bigSubarr := (bigSubarr & [](1_))[1 len 0];
    if length(bigSubarr) <> 0 then
      writeln(" ***** ARRAY [ START len LENGTH ] for bigInteger array failed. (8)");
      okay := FALSE;
    end if;
    bigSubarr := bigArr[intExpr(7) len 1];
    if length(bigSubarr) <> 1 or bigSubarr[1] <> 7_ then
      writeln(" ***** ARRAY [ START len LENGTH ] for bigInteger array failed. (9)");
      okay := FALSE;
    end if;
    bigSubarr := bigArr[intExpr(1) len 0];
    if length(bigSubarr) <> 0 then
      writeln(" ***** ARRAY [ START len LENGTH ] for bigInteger array failed. (10)");
      okay := FALSE;
    end if;
    bigSubarr := bigArr[intExpr(10) len 0];
    if length(bigSubarr) <> 0 then
      writeln(" ***** ARRAY [ START len LENGTH ] for bigInteger array failed. (11)");
      okay := FALSE;
    end if;
    bigArr := bigArr[1 len 9];
    if length(bigArr) <> 9 or bigArr[1] <> 1_ or bigArr[2] <> 2_ or bigArr[3] <> 3_ or
           bigArr[4] <> 4_ or bigArr[5] <> 5_ or bigArr[6] <> 6_ or bigArr[7] <> 7_ or
           bigArr[8] <> 8_ or bigArr[9] <> 9_ then
      writeln(" ***** ARRAY [ START len LENGTH ] for bigInteger array failed. (12)");
      okay := FALSE;
    end if;
    bigArr := bigArr[intExpr(1) len 8];
    if length(bigArr) <> 8 or bigArr[1] <> 1_ or bigArr[2] <> 2_ or bigArr[3] <> 3_ or
           bigArr[4] <> 4_ or bigArr[5] <> 5_ or bigArr[6] <> 6_ or bigArr[7] <> 7_ or
           bigArr[8] <> 8_ then
      writeln(" ***** ARRAY [ START len LENGTH ] for bigInteger array failed. (13)");
      okay := FALSE;
    end if;
    bigArr := bigArr[intExpr(2) len 6];
    if length(bigArr) <> 6 or bigArr[1] <> 2_ or bigArr[2] <> 3_ or bigArr[3] <> 4_ or
                              bigArr[4] <> 5_ or bigArr[5] <> 6_ or bigArr[6] <> 7_ then
      writeln(" ***** ARRAY [ START len LENGTH ] for bigInteger array failed. (14)");
      okay := FALSE;
    end if;
    bigArr := bigArr[intExpr(3) len 3];
    if length(bigArr) <> 3 or bigArr[1] <> 4_ or bigArr[2] <> 5_ or bigArr[3] <> 6_ then
      writeln(" ***** ARRAY [ START len LENGTH ] for bigInteger array failed. (15)");
      okay := FALSE;
    end if;

    fltSubarr := fltArr[1 len 9];
    if length(fltSubarr) <> 9 or fltSubarr[1] <> 1.0 or fltSubarr[2] <> 2.0 or fltSubarr[3] <> 3.0 or
          fltSubarr[4] <> 4.0 or fltSubarr[5] <> 5.0 or fltSubarr[6] <> 6.0 or fltSubarr[7] <> 7.0 or
          fltSubarr[8] <> 8.0 or fltSubarr[9] <> 9.0 then
      writeln(" ***** ARRAY [ START len LENGTH ] for float array failed. (1)");
      okay := FALSE;
    end if;
    fltSubarr := fltArr[intExpr(1) len 8];
    if length(fltSubarr) <> 8 or fltSubarr[1] <> 1.0 or fltSubarr[2] <> 2.0 or fltSubarr[3] <> 3.0 or
          fltSubarr[4] <> 4.0 or fltSubarr[5] <> 5.0 or fltSubarr[6] <> 6.0 or fltSubarr[7] <> 7.0 or
          fltSubarr[8] <> 8.0 then
      writeln(" ***** ARRAY [ START len LENGTH ] for float array failed. (2)");
      okay := FALSE;
    end if;
    fltSubarr := fltArr[intExpr(2) len 6];
    if length(fltSubarr) <> 6 or fltSubarr[1] <> 2.0 or fltSubarr[2] <> 3.0 or fltSubarr[3] <> 4.0 or
                                 fltSubarr[4] <> 5.0 or fltSubarr[5] <> 6.0 or fltSubarr[6] <> 7.0 then
      writeln(" ***** ARRAY [ START len LENGTH ] for float array failed. (3)");
      okay := FALSE;
    end if;
    fltSubarr := fltArr[intExpr(3) len 2];
    if length(fltSubarr) <> 2 or fltSubarr[1] <> 3.0 or fltSubarr[2] <> 4.0 then
      writeln(" ***** ARRAY [ START len LENGTH ] for float array failed. (4)");
      okay := FALSE;
    end if;
    fltSubarr := ([](1.0, 2.0) & fltSubarr)[2 len 2];
    if length(fltSubarr) <> 2 or fltSubarr[1] <> 2.0 or fltSubarr[2] <> 3.0 then
      writeln(" ***** ARRAY [ START len LENGTH ] for float array failed. (5)");
      okay := FALSE;
    end if;
    fltSubarr := ([](1.0) & fltSubarr)[intExpr(1) len 3];
    if length(fltSubarr) <> 3 or fltSubarr[1] <> 1.0 or fltSubarr[2] <> 2.0 or fltSubarr[3] <> 3.0 then
      writeln(" ***** ARRAY [ START len LENGTH ] for float array failed. (6)");
      okay := FALSE;
    end if;
    fltSubarr := (fltSubarr & [](1.0))[4 len intExpr(0)];
    if length(fltSubarr) <> 0 then
      writeln(" ***** ARRAY [ START len LENGTH ] for float array failed. (7)");
      okay := FALSE;
    end if;
    fltSubarr := (fltSubarr & [](1.0))[1 len 0];
    if length(fltSubarr) <> 0 then
      writeln(" ***** ARRAY [ START len LENGTH ] for float array failed. (8)");
      okay := FALSE;
    end if;
    fltSubarr := fltArr[intExpr(7) len 1];
    if length(fltSubarr) <> 1 or fltSubarr[1] <> 7.0 then
      writeln(" ***** ARRAY [ START len LENGTH ] for float array failed. (9)");
      okay := FALSE;
    end if;
    fltSubarr := fltArr[intExpr(1) len 0];
    if length(fltSubarr) <> 0 then
      writeln(" ***** ARRAY [ START len LENGTH ] for float array failed. (10)");
      okay := FALSE;
    end if;
    fltSubarr := fltArr[intExpr(10) len 0];
    if length(fltSubarr) <> 0 then
      writeln(" ***** ARRAY [ START len LENGTH ] for float array failed. (11)");
      okay := FALSE;
    end if;
    fltArr := fltArr[1 len 9];
    if length(fltArr) <> 9 or fltArr[1] <> 1.0 or fltArr[2] <> 2.0 or fltArr[3] <> 3.0 or
          fltArr[4] <> 4.0 or fltArr[5] <> 5.0 or fltArr[6] <> 6.0 or fltArr[7] <> 7.0 or
          fltArr[8] <> 8.0 or fltArr[9] <> 9.0 then
      writeln(" ***** ARRAY [ START len LENGTH ] for float array failed. (12)");
      okay := FALSE;
    end if;
    fltArr := fltArr[intExpr(1) len 8];
    if length(fltArr) <> 8 or fltArr[1] <> 1.0 or fltArr[2] <> 2.0 or fltArr[3] <> 3.0 or
          fltArr[4] <> 4.0 or fltArr[5] <> 5.0 or fltArr[6] <> 6.0 or fltArr[7] <> 7.0 or
          fltArr[8] <> 8.0 then
      writeln(" ***** ARRAY [ START len LENGTH ] for float array failed. (13)");
      okay := FALSE;
    end if;
    fltArr := fltArr[intExpr(2) len 6];
    if length(fltArr) <> 6 or fltArr[1] <> 2.0 or fltArr[2] <> 3.0 or fltArr[3] <> 4.0 or
                              fltArr[4] <> 5.0 or fltArr[5] <> 6.0 or fltArr[6] <> 7.0 then
      writeln(" ***** ARRAY [ START len LENGTH ] for float array failed. (14)");
      okay := FALSE;
    end if;
    fltArr := fltArr[intExpr(3) len 3];
    if length(fltArr) <> 3 or fltArr[1] <> 4.0 or fltArr[2] <> 5.0 or fltArr[3] <> 6.0 then
      writeln(" ***** ARRAY [ START len LENGTH ] for float array failed. (15)");
      okay := FALSE;
    end if;

    cpxSubarr := cpxArr[1 len 9];
    if length(cpxSubarr) <> 9 or cpxSubarr[1] <> complex(1.0, 1.0) or cpxSubarr[2] <> complex(2.0, 2.0) or
                                 cpxSubarr[3] <> complex(3.0, 3.0) or cpxSubarr[4] <> complex(4.0, 4.0) or
                                 cpxSubarr[5] <> complex(5.0, 5.0) or cpxSubarr[6] <> complex(6.0, 6.0) or
                                 cpxSubarr[7] <> complex(7.0, 7.0) or cpxSubarr[8] <> complex(8.0, 8.0) or
                                 cpxSubarr[9] <> complex(9.0, 9.0) then
      writeln(" ***** ARRAY [ START len LENGTH ] for complex array failed. (1)");
      okay := FALSE;
    end if;
    cpxSubarr := cpxArr[intExpr(1) len 8];
    if length(cpxSubarr) <> 8 or cpxSubarr[1] <> complex(1.0, 1.0) or cpxSubarr[2] <> complex(2.0, 2.0) or
                                 cpxSubarr[3] <> complex(3.0, 3.0) or cpxSubarr[4] <> complex(4.0, 4.0) or
                                 cpxSubarr[5] <> complex(5.0, 5.0) or cpxSubarr[6] <> complex(6.0, 6.0) or
                                 cpxSubarr[7] <> complex(7.0, 7.0) or cpxSubarr[8] <> complex(8.0, 8.0) then
      writeln(" ***** ARRAY [ START len LENGTH ] for complex array failed. (2)");
      okay := FALSE;
    end if;
    cpxSubarr := cpxArr[intExpr(2) len 6];
    if length(cpxSubarr) <> 6 or cpxSubarr[1] <> complex(2.0, 2.0) or cpxSubarr[2] <> complex(3.0, 3.0) or
                                 cpxSubarr[3] <> complex(4.0, 4.0) or cpxSubarr[4] <> complex(5.0, 5.0) or
                                 cpxSubarr[5] <> complex(6.0, 6.0) or cpxSubarr[6] <> complex(7.0, 7.0) then
      writeln(" ***** ARRAY [ START len LENGTH ] for complex array failed. (3)");
      okay := FALSE;
    end if;
    cpxSubarr := cpxArr[intExpr(3) len 2];
    if length(cpxSubarr) <> 2 or cpxSubarr[1] <> complex(3.0, 3.0) or cpxSubarr[2] <> complex(4.0, 4.0) then
      writeln(" ***** ARRAY [ START len LENGTH ] for complex array failed. (4)");
      okay := FALSE;
    end if;
    cpxSubarr := ([](complex(1.0, 1.0), complex(2.0, 2.0)) & cpxSubarr)[2 len 2];
    if length(cpxSubarr) <> 2 or cpxSubarr[1] <> complex(2.0, 2.0) or cpxSubarr[2] <> complex(3.0, 3.0) then
      writeln(" ***** ARRAY [ START len LENGTH ] for complex array failed. (5)");
      okay := FALSE;
    end if;
    cpxSubarr := ([](complex(1.0, 1.0)) & cpxSubarr)[intExpr(1) len 3];
    if length(cpxSubarr) <> 3 or cpxSubarr[1] <> complex(1.0, 1.0) or cpxSubarr[2] <> complex(2.0, 2.0) or
                                 cpxSubarr[3] <> complex(3.0, 3.0) then
      writeln(" ***** ARRAY [ START len LENGTH ] for complex array failed. (6)");
      okay := FALSE;
    end if;
    cpxSubarr := (cpxSubarr & [](complex(1.0, 1.0)))[4 len intExpr(0)];
    if length(cpxSubarr) <> 0 then
      writeln(" ***** ARRAY [ START len LENGTH ] for complex array failed. (7)");
      okay := FALSE;
    end if;
    cpxSubarr := (cpxSubarr & [](complex(1.0, 1.0)))[1 len 0];
    if length(cpxSubarr) <> 0 then
      writeln(" ***** ARRAY [ START len LENGTH ] for complex array failed. (8)");
      okay := FALSE;
    end if;
    cpxSubarr := cpxArr[intExpr(7) len 1];
    if length(cpxSubarr) <> 1 or cpxSubarr[1] <> complex(7.0, 7.0) then
      writeln(" ***** ARRAY [ START len LENGTH ] for complex array failed. (9)");
      okay := FALSE;
    end if;
    cpxSubarr := cpxArr[intExpr(1) len 0];
    if length(cpxSubarr) <> 0 then
      writeln(" ***** ARRAY [ START len LENGTH ] for complex array failed. (10)");
      okay := FALSE;
    end if;
    cpxSubarr := cpxArr[intExpr(10) len 0];
    if length(cpxSubarr) <> 0 then
      writeln(" ***** ARRAY [ START len LENGTH ] for complex array failed. (11)");
      okay := FALSE;
    end if;
    cpxArr := cpxArr[1 len 9];
    if length(cpxArr) <> 9 or cpxArr[1] <> complex(1.0, 1.0) or cpxArr[2] <> complex(2.0, 2.0) or
                              cpxArr[3] <> complex(3.0, 3.0) or cpxArr[4] <> complex(4.0, 4.0) or
                              cpxArr[5] <> complex(5.0, 5.0) or cpxArr[6] <> complex(6.0, 6.0) or
                              cpxArr[7] <> complex(7.0, 7.0) or cpxArr[8] <> complex(8.0, 8.0) or
                              cpxArr[9] <> complex(9.0, 9.0) then
      writeln(" ***** ARRAY [ START len LENGTH ] for complex array failed. (12)");
      okay := FALSE;
    end if;
    cpxArr := cpxArr[intExpr(1) len 8];
    if length(cpxArr) <> 8 or cpxArr[1] <> complex(1.0, 1.0) or cpxArr[2] <> complex(2.0, 2.0) or
                              cpxArr[3] <> complex(3.0, 3.0) or cpxArr[4] <> complex(4.0, 4.0) or
                              cpxArr[5] <> complex(5.0, 5.0) or cpxArr[6] <> complex(6.0, 6.0) or
                              cpxArr[7] <> complex(7.0, 7.0) or cpxArr[8] <> complex(8.0, 8.0) then
      writeln(" ***** ARRAY [ START len LENGTH ] for complex array failed. (13)");
      okay := FALSE;
    end if;
    cpxArr := cpxArr[intExpr(2) len 6];
    if length(cpxArr) <> 6 or cpxArr[1] <> complex(2.0, 2.0) or cpxArr[2] <> complex(3.0, 3.0) or
                              cpxArr[3] <> complex(4.0, 4.0) or cpxArr[4] <> complex(5.0, 5.0) or
                              cpxArr[5] <> complex(6.0, 6.0) or cpxArr[6] <> complex(7.0, 7.0) then
      writeln(" ***** ARRAY [ START len LENGTH ] for complex array failed. (14)");
      okay := FALSE;
    end if;
    cpxArr := cpxArr[intExpr(3) len 3];
    if length(cpxArr) <> 3 or cpxArr[1] <> complex(4.0, 4.0) or cpxArr[2] <> complex(5.0, 5.0) or
                              cpxArr[3] <> complex(6.0, 6.0) then
      writeln(" ***** ARRAY [ START len LENGTH ] for complex array failed. (15)");
      okay := FALSE;
    end if;

    chrSubarr := chrArr[1 len 9];
    if length(chrSubarr) <> 9 or chrSubarr[1] <> 'a' or chrSubarr[2] <> 'b' or chrSubarr[3] <> 'c' or
            chrSubarr[4] <> 'd' or chrSubarr[5] <> 'e' or chrSubarr[6] <> 'f' or chrSubarr[7] <> 'g' or
            chrSubarr[8] <> 'h' or chrSubarr[9] <> 'i' then
      writeln(" ***** ARRAY [ START len LENGTH ] for char array failed. (1)");
      okay := FALSE;
    end if;
    chrSubarr := chrArr[intExpr(1) len 8];
    if length(chrSubarr) <> 8 or chrSubarr[1] <> 'a' or chrSubarr[2] <> 'b' or chrSubarr[3] <> 'c' or
            chrSubarr[4] <> 'd' or chrSubarr[5] <> 'e' or chrSubarr[6] <> 'f' or chrSubarr[7] <> 'g' or
            chrSubarr[8] <> 'h' then
      writeln(" ***** ARRAY [ START len LENGTH ] for char array failed. (2)");
      okay := FALSE;
    end if;
    chrSubarr := chrArr[intExpr(2) len 6];
    if length(chrSubarr) <> 6 or chrSubarr[1] <> 'b' or chrSubarr[2] <> 'c' or chrSubarr[3] <> 'd' or
                                 chrSubarr[4] <> 'e' or chrSubarr[5] <> 'f' or chrSubarr[6] <> 'g' then
      writeln(" ***** ARRAY [ START len LENGTH ] for char array failed. (3)");
      okay := FALSE;
    end if;
    chrSubarr := chrArr[intExpr(3) len 2];
    if length(chrSubarr) <> 2 or chrSubarr[1] <> 'c' or chrSubarr[2] <> 'd' then
      writeln(" ***** ARRAY [ START len LENGTH ] for char array failed. (4)");
      okay := FALSE;
    end if;
    chrSubarr := ([]('a', 'b') & chrSubarr)[2 len 2];
    if length(chrSubarr) <> 2 or chrSubarr[1] <> 'b' or chrSubarr[2] <> 'c' then
      writeln(" ***** ARRAY [ START len LENGTH ] for char array failed. (5)");
      okay := FALSE;
    end if;
    chrSubarr := ([]('a') & chrSubarr)[intExpr(1) len 3];
    if length(chrSubarr) <> 3 or chrSubarr[1] <> 'a' or chrSubarr[2] <> 'b' or chrSubarr[3] <> 'c' then
      writeln(" ***** ARRAY [ START len LENGTH ] for char array failed. (6)");
      okay := FALSE;
    end if;
    chrSubarr := (chrSubarr & []('a'))[4 len intExpr(0)];
    if length(chrSubarr) <> 0 then
      writeln(" ***** ARRAY [ START len LENGTH ] for char array failed. (7)");
      okay := FALSE;
    end if;
    chrSubarr := (chrSubarr & []('a'))[1 len 0];
    if length(chrSubarr) <> 0 then
      writeln(" ***** ARRAY [ START len LENGTH ] for char array failed. (8)");
      okay := FALSE;
    end if;
    chrSubarr := chrArr[intExpr(7) len 1];
    if length(chrSubarr) <> 1 or chrSubarr[1] <> 'g' then
      writeln(" ***** ARRAY [ START len LENGTH ] for char array failed. (9)");
      okay := FALSE;
    end if;
    chrSubarr := chrArr[intExpr(1) len 0];
    if length(chrSubarr) <> 0 then
      writeln(" ***** ARRAY [ START len LENGTH ] for char array failed. (10)");
      okay := FALSE;
    end if;
    chrSubarr := chrArr[intExpr(10) len 0];
    if length(chrSubarr) <> 0 then
      writeln(" ***** ARRAY [ START len LENGTH ] for char array failed. (11)");
      okay := FALSE;
    end if;
    chrArr := chrArr[1 len 9];
    if length(chrArr) <> 9 or chrArr[1] <> 'a' or chrArr[2] <> 'b' or chrArr[3] <> 'c' or
            chrArr[4] <> 'd' or chrArr[5] <> 'e' or chrArr[6] <> 'f' or chrArr[7] <> 'g' or
            chrArr[8] <> 'h' or chrArr[9] <> 'i' then
      writeln(" ***** ARRAY [ START len LENGTH ] for char array failed. (12)");
      okay := FALSE;
    end if;
    chrArr := chrArr[intExpr(1) len 8];
    if length(chrArr) <> 8 or chrArr[1] <> 'a' or chrArr[2] <> 'b' or chrArr[3] <> 'c' or
            chrArr[4] <> 'd' or chrArr[5] <> 'e' or chrArr[6] <> 'f' or chrArr[7] <> 'g' or
            chrArr[8] <> 'h' then
      writeln(" ***** ARRAY [ START len LENGTH ] for char array failed. (13)");
      okay := FALSE;
    end if;
    chrArr := chrArr[intExpr(2) len 6];
    if length(chrArr) <> 6 or chrArr[1] <> 'b' or chrArr[2] <> 'c' or chrArr[3] <> 'd' or
                              chrArr[4] <> 'e' or chrArr[5] <> 'f' or chrArr[6] <> 'g' then
      writeln(" ***** ARRAY [ START len LENGTH ] for char array failed. (14)");
      okay := FALSE;
    end if;
    chrArr := chrArr[intExpr(3) len 3];
    if length(chrArr) <> 3 or chrArr[1] <> 'd' or chrArr[2] <> 'e' or chrArr[3] <> 'f' then
      writeln(" ***** ARRAY [ START len LENGTH ] for char array failed. (15)");
      okay := FALSE;
    end if;

    strSubarr := strArr[1 len 9];
    if length(strSubarr) <> 9 or strSubarr[1] <> "one"   or strSubarr[2] <> "two"   or
                                 strSubarr[3] <> "three" or strSubarr[4] <> "four"  or
                                 strSubarr[5] <> "five"  or strSubarr[6] <> "six"   or
                                 strSubarr[7] <> "seven" or strSubarr[8] <> "eight" or
                                 strSubarr[9] <> "nine" then
      writeln(" ***** ARRAY [ START len LENGTH ] for string array failed. (1)");
      okay := FALSE;
    end if;
    strSubarr := strArr[intExpr(1) len 8];
    if length(strSubarr) <> 8 or strSubarr[1] <> "one"   or strSubarr[2] <> "two"   or
                                 strSubarr[3] <> "three" or strSubarr[4] <> "four"  or
                                 strSubarr[5] <> "five"  or strSubarr[6] <> "six"   or
                                 strSubarr[7] <> "seven" or strSubarr[8] <> "eight" then
      writeln(" ***** ARRAY [ START len LENGTH ] for string array failed. (2)");
      okay := FALSE;
    end if;
    strSubarr := strArr[intExpr(2) len 6];
    if length(strSubarr) <> 6 or strSubarr[1] <> "two"  or strSubarr[2] <> "three" or
                                 strSubarr[3] <> "four" or strSubarr[4] <> "five"  or
                                 strSubarr[5] <> "six"  or strSubarr[6] <> "seven" then
      writeln(" ***** ARRAY [ START len LENGTH ] for string array failed. (3)");
      okay := FALSE;
    end if;
    strSubarr := strArr[intExpr(3) len 2];
    if length(strSubarr) <> 2 or strSubarr[1] <> "three" or strSubarr[2] <> "four" then
      writeln(" ***** ARRAY [ START len LENGTH ] for string array failed. (4)");
      okay := FALSE;
    end if;
    strSubarr := ([]("one", "two") & strSubarr)[2 len 2];
    if length(strSubarr) <> 2 or strSubarr[1] <> "two" or strSubarr[2] <> "three" then
      writeln(" ***** ARRAY [ START len LENGTH ] for string array failed. (5)");
      okay := FALSE;
    end if;
    strSubarr := ([]("one") & strSubarr)[intExpr(1) len 3];
    if length(strSubarr) <> 3 or strSubarr[1] <> "one" or strSubarr[2] <> "two" or
                                 strSubarr[3] <> "three" then
      writeln(" ***** ARRAY [ START len LENGTH ] for string array failed. (6)");
      okay := FALSE;
    end if;
    strSubarr := (strSubarr & []("one"))[4 len intExpr(0)];
    if length(strSubarr) <> 0 then
      writeln(" ***** ARRAY [ START len LENGTH ] for string array failed. (7)");
      okay := FALSE;
    end if;
    strSubarr := (strSubarr & []("one"))[1 len 0];
    if length(strSubarr) <> 0 then
      writeln(" ***** ARRAY [ START len LENGTH ] for string array failed. (8)");
      okay := FALSE;
    end if;
    strSubarr := strArr[intExpr(7) len 1];
    if length(strSubarr) <> 1 or strSubarr[1] <> "seven" then
      writeln(" ***** ARRAY [ START len LENGTH ] for string array failed. (9)");
      okay := FALSE;
    end if;
    strSubarr := strArr[intExpr(1) len 0];
    if length(strSubarr) <> 0 then
      writeln(" ***** ARRAY [ START len LENGTH ] for string array failed. (10)");
      okay := FALSE;
    end if;
    strSubarr := strArr[intExpr(10) len 0];
    if length(strSubarr) <> 0 then
      writeln(" ***** ARRAY [ START len LENGTH ] for string array failed. (11)");
      okay := FALSE;
    end if;
    strArr := strArr[1 len 9];
    if length(strArr) <> 9 or strArr[1] <> "one"   or strArr[2] <> "two"   or strArr[3] <> "three" or
                              strArr[4] <> "four"  or strArr[5] <> "five"  or strArr[6] <> "six"   or
                              strArr[7] <> "seven" or strArr[8] <> "eight" or strArr[9] <> "nine"  then
      writeln(" ***** ARRAY [ START len LENGTH ] for string array failed. (12)");
      okay := FALSE;
    end if;
    strArr := strArr[intExpr(1) len 8];
    if length(strArr) <> 8 or strArr[1] <> "one"   or strArr[2] <> "two"   or strArr[3] <> "three" or
                              strArr[4] <> "four"  or strArr[5] <> "five"  or strArr[6] <> "six"   or
                              strArr[7] <> "seven" or strArr[8] <> "eight" then
      writeln(" ***** ARRAY [ START len LENGTH ] for string array failed. (13)");
      okay := FALSE;
    end if;
    strArr := strArr[intExpr(2) len 6];
    if length(strArr) <> 6 or strArr[1] <> "two"  or strArr[2] <> "three" or strArr[3] <> "four"  or
                              strArr[4] <> "five" or strArr[5] <> "six"   or strArr[6] <> "seven" then
      writeln(" ***** ARRAY [ START len LENGTH ] for string array failed. (14)");
      okay := FALSE;
    end if;
    strArr := strArr[intExpr(3) len 3];
    if length(strArr) <> 3 or strArr[1] <> "four" or strArr[2] <> "five" or strArr[3] <> "six" then
      writeln(" ***** ARRAY [ START len LENGTH ] for string array failed. (15)");
      okay := FALSE;
    end if;

    if  not raisesIndexError(intArr[integer.first len integer.first]) or
        not raisesIndexError(bigArr[integer.first len integer.first]) or
        not raisesIndexError(fltArr[integer.first len integer.first]) or
        not raisesIndexError(cpxArr[integer.first len integer.first]) or
        not raisesIndexError(chrArr[integer.first len integer.first]) or
        not raisesIndexError(strArr[integer.first len integer.first]) or
        not raisesIndexError(intArr[-1 len integer.first]) or
        not raisesIndexError(bigArr[-1 len integer.first]) or
        not raisesIndexError(fltArr[-1 len integer.first]) or
        not raisesIndexError(cpxArr[-1 len integer.first]) or
        not raisesIndexError(chrArr[-1 len integer.first]) or
        not raisesIndexError(strArr[-1 len integer.first]) or
        not raisesIndexError(intArr[0 len integer.first]) or
        not raisesIndexError(bigArr[0 len integer.first]) or
        not raisesIndexError(fltArr[0 len integer.first]) or
        not raisesIndexError(cpxArr[0 len integer.first]) or
        not raisesIndexError(chrArr[0 len integer.first]) or
        not raisesIndexError(strArr[0 len integer.first]) or
        not raisesIndexError(intArr[1 len integer.first]) or
        not raisesIndexError(bigArr[1 len integer.first]) or
        not raisesIndexError(fltArr[1 len integer.first]) or
        not raisesIndexError(cpxArr[1 len integer.first]) or
        not raisesIndexError(chrArr[1 len integer.first]) or
        not raisesIndexError(strArr[1 len integer.first]) or
        not raisesIndexError(intArr[3 len integer.first]) or
        not raisesIndexError(bigArr[3 len integer.first]) or
        not raisesIndexError(fltArr[3 len integer.first]) or
        not raisesIndexError(cpxArr[3 len integer.first]) or
        not raisesIndexError(chrArr[3 len integer.first]) or
        not raisesIndexError(strArr[3 len integer.first]) or
        not raisesIndexError(intArr[4 len integer.first]) or
        not raisesIndexError(bigArr[4 len integer.first]) or
        not raisesIndexError(fltArr[4 len integer.first]) or
        not raisesIndexError(cpxArr[4 len integer.first]) or
        not raisesIndexError(chrArr[4 len integer.first]) or
        not raisesIndexError(strArr[4 len integer.first]) or
        not raisesIndexError(intArr[5 len integer.first]) or
        not raisesIndexError(bigArr[5 len integer.first]) or
        not raisesIndexError(fltArr[5 len integer.first]) or
        not raisesIndexError(cpxArr[5 len integer.first]) or
        not raisesIndexError(chrArr[5 len integer.first]) or
        not raisesIndexError(strArr[5 len integer.first]) or
        not raisesIndexError(intArr[integer.last len integer.first]) or
        not raisesIndexError(bigArr[integer.last len integer.first]) or
        not raisesIndexError(fltArr[integer.last len integer.first]) or
        not raisesIndexError(cpxArr[integer.last len integer.first]) or
        not raisesIndexError(chrArr[integer.last len integer.first]) or
        not raisesIndexError(strArr[integer.last len integer.first]) then
      writeln(" ***** ARRAY [ START len LENGTH ] with index out of range does not raise INDEX_ERROR. (1)");
      okay := FALSE;
    end if;

    if  not raisesIndexError(intArr[integer.first len -1]) or
        not raisesIndexError(bigArr[integer.first len -1]) or
        not raisesIndexError(fltArr[integer.first len -1]) or
        not raisesIndexError(cpxArr[integer.first len -1]) or
        not raisesIndexError(chrArr[integer.first len -1]) or
        not raisesIndexError(strArr[integer.first len -1]) or
        not raisesIndexError(intArr[-1 len -1]) or
        not raisesIndexError(bigArr[-1 len -1]) or
        not raisesIndexError(fltArr[-1 len -1]) or
        not raisesIndexError(cpxArr[-1 len -1]) or
        not raisesIndexError(chrArr[-1 len -1]) or
        not raisesIndexError(strArr[-1 len -1]) or
        not raisesIndexError(intArr[0 len -1]) or
        not raisesIndexError(bigArr[0 len -1]) or
        not raisesIndexError(fltArr[0 len -1]) or
        not raisesIndexError(cpxArr[0 len -1]) or
        not raisesIndexError(chrArr[0 len -1]) or
        not raisesIndexError(strArr[0 len -1]) or
        not raisesIndexError(intArr[1 len -1]) or
        not raisesIndexError(bigArr[1 len -1]) or
        not raisesIndexError(fltArr[1 len -1]) or
        not raisesIndexError(cpxArr[1 len -1]) or
        not raisesIndexError(chrArr[1 len -1]) or
        not raisesIndexError(strArr[1 len -1]) or
        not raisesIndexError(intArr[3 len -1]) or
        not raisesIndexError(bigArr[3 len -1]) or
        not raisesIndexError(fltArr[3 len -1]) or
        not raisesIndexError(cpxArr[3 len -1]) or
        not raisesIndexError(chrArr[3 len -1]) or
        not raisesIndexError(strArr[3 len -1]) or
        not raisesIndexError(intArr[4 len -1]) or
        not raisesIndexError(bigArr[4 len -1]) or
        not raisesIndexError(fltArr[4 len -1]) or
        not raisesIndexError(cpxArr[4 len -1]) or
        not raisesIndexError(chrArr[4 len -1]) or
        not raisesIndexError(strArr[4 len -1]) or
        not raisesIndexError(intArr[5 len -1]) or
        not raisesIndexError(bigArr[5 len -1]) or
        not raisesIndexError(fltArr[5 len -1]) or
        not raisesIndexError(cpxArr[5 len -1]) or
        not raisesIndexError(chrArr[5 len -1]) or
        not raisesIndexError(strArr[5 len -1]) or
        not raisesIndexError(intArr[integer.last len -1]) or
        not raisesIndexError(bigArr[integer.last len -1]) or
        not raisesIndexError(fltArr[integer.last len -1]) or
        not raisesIndexError(cpxArr[integer.last len -1]) or
        not raisesIndexError(chrArr[integer.last len -1]) or
        not raisesIndexError(strArr[integer.last len -1]) then
      writeln(" ***** ARRAY [ START len LENGTH ] with index out of range does not raise INDEX_ERROR. (2)");
      okay := FALSE;
    end if;

    if  not raisesIndexError(intArr[integer.first len 0]) or
        not raisesIndexError(bigArr[integer.first len 0]) or
        not raisesIndexError(fltArr[integer.first len 0]) or
        not raisesIndexError(cpxArr[integer.first len 0]) or
        not raisesIndexError(chrArr[integer.first len 0]) or
        not raisesIndexError(strArr[integer.first len 0]) or
        not raisesIndexError(intArr[-1 len 0]) or
        not raisesIndexError(bigArr[-1 len 0]) or
        not raisesIndexError(fltArr[-1 len 0]) or
        not raisesIndexError(cpxArr[-1 len 0]) or
        not raisesIndexError(chrArr[-1 len 0]) or
        not raisesIndexError(strArr[-1 len 0]) or
        not raisesIndexError(intArr[0 len 0]) or
        not raisesIndexError(bigArr[0 len 0]) or
        not raisesIndexError(fltArr[0 len 0]) or
        not raisesIndexError(cpxArr[0 len 0]) or
        not raisesIndexError(chrArr[0 len 0]) or
        not raisesIndexError(strArr[0 len 0]) (* or
        not raisesIndexError(intArr[7 len 0]) or
        not raisesIndexError(bigArr[7 len 0]) or
        not raisesIndexError(fltArr[7 len 0]) or
        not raisesIndexError(cpxArr[7 len 0]) or
        not raisesIndexError(chrArr[7 len 0]) or
        not raisesIndexError(strArr[7 len 0]) or
        not raisesIndexError(intArr[integer.last len 0]) or
        not raisesIndexError(bigArr[integer.last len 0]) or
        not raisesIndexError(fltArr[integer.last len 0]) or
        not raisesIndexError(cpxArr[integer.last len 0]) or
        not raisesIndexError(chrArr[integer.last len 0]) or
        not raisesIndexError(strArr[integer.last len 0]) *) then
      writeln(" ***** ARRAY [ START len LENGTH ] with index out of range does not raise INDEX_ERROR. (3)");
      okay := FALSE;
    end if;

    if  not raisesIndexError(([] (1, 2) & [] (3, 4))                    [integer.first len integer.first]) or
        not raisesIndexError(([] (1_, 2_) & [] (3_, 4_))                [integer.first len integer.first]) or
        not raisesIndexError(([] (1.0, 2.0) & [] (3.0, 4.0))            [integer.first len integer.first]) or
        not raisesIndexError(([] (complex(1.0, 1.0), complex(2.0, 2.0)) &
                              [] (complex(3.0, 3.0), complex(4.0, 4.0)))[integer.first len integer.first]) or
        not raisesIndexError(([] ('a', 'b') & [] ('c', 'd'))            [integer.first len integer.first]) or
        not raisesIndexError(([] ("one", "two") & [] ("three", "four")) [integer.first len integer.first]) or
        not raisesIndexError(([] (1, 2) & [] (3, 4))                    [-1 len integer.first]) or
        not raisesIndexError(([] (1_, 2_) & [] (3_, 4_))                [-1 len integer.first]) or
        not raisesIndexError(([] (1.0, 2.0) & [] (3.0, 4.0))            [-1 len integer.first]) or
        not raisesIndexError(([] (complex(1.0, 1.0), complex(2.0, 2.0)) &
                              [] (complex(3.0, 3.0), complex(4.0, 4.0)))[-1 len integer.first]) or
        not raisesIndexError(([] ('a', 'b') & [] ('c', 'd'))            [-1 len integer.first]) or
        not raisesIndexError(([] ("one", "two") & [] ("three", "four")) [-1 len integer.first]) or
        not raisesIndexError(([] (1, 2) & [] (3, 4))                    [0 len integer.first]) or
        not raisesIndexError(([] (1_, 2_) & [] (3_, 4_))                [0 len integer.first]) or
        not raisesIndexError(([] (1.0, 2.0) & [] (3.0, 4.0))            [0 len integer.first]) or
        not raisesIndexError(([] (complex(1.0, 1.0), complex(2.0, 2.0)) &
                              [] (complex(3.0, 3.0), complex(4.0, 4.0)))[0 len integer.first]) or
        not raisesIndexError(([] ('a', 'b') & [] ('c', 'd'))            [0 len integer.first]) or
        not raisesIndexError(([] ("one", "two") & [] ("three", "four")) [0 len integer.first]) or
        not raisesIndexError(([] (1, 2) & [] (3, 4))                    [3 len integer.first]) or
        not raisesIndexError(([] (1_, 2_) & [] (3_, 4_))                [3 len integer.first]) or
        not raisesIndexError(([] (1.0, 2.0) & [] (3.0, 4.0))            [3 len integer.first]) or
        not raisesIndexError(([] (complex(1.0, 1.0), complex(2.0, 2.0)) &
                              [] (complex(3.0, 3.0), complex(4.0, 4.0)))[3 len integer.first]) or
        not raisesIndexError(([] ('a', 'b') & [] ('c', 'd'))            [3 len integer.first]) or
        not raisesIndexError(([] ("one", "two") & [] ("three", "four")) [3 len integer.first]) or
        not raisesIndexError(([] (1, 2) & [] (3, 4))                    [4 len integer.first]) or
        not raisesIndexError(([] (1_, 2_) & [] (3_, 4_))                [4 len integer.first]) or
        not raisesIndexError(([] (1.0, 2.0) & [] (3.0, 4.0))            [4 len integer.first]) or
        not raisesIndexError(([] (complex(1.0, 1.0), complex(2.0, 2.0)) &
                              [] (complex(3.0, 3.0), complex(4.0, 4.0)))[4 len integer.first]) or
        not raisesIndexError(([] ('a', 'b') & [] ('c', 'd'))            [4 len integer.first]) or
        not raisesIndexError(([] ("one", "two") & [] ("three", "four")) [4 len integer.first]) or
        not raisesIndexError(([] (1, 2) & [] (3, 4))                    [5 len integer.first]) or
        not raisesIndexError(([] (1_, 2_) & [] (3_, 4_))                [5 len integer.first]) or
        not raisesIndexError(([] (1.0, 2.0) & [] (3.0, 4.0))            [5 len integer.first]) or
        not raisesIndexError(([] (complex(1.0, 1.0), complex(2.0, 2.0)) &
                              [] (complex(3.0, 3.0), complex(4.0, 4.0)))[5 len integer.first]) or
        not raisesIndexError(([] ('a', 'b') & [] ('c', 'd'))            [5 len integer.first]) or
        not raisesIndexError(([] ("one", "two") & [] ("three", "four")) [5 len integer.first]) or
        not raisesIndexError(([] (1, 2) & [] (3, 4))                    [integer.last len integer.first]) or
        not raisesIndexError(([] (1_, 2_) & [] (3_, 4_))                [integer.last len integer.first]) or
        not raisesIndexError(([] (1.0, 2.0) & [] (3.0, 4.0))            [integer.last len integer.first]) or
        not raisesIndexError(([] (complex(1.0, 1.0), complex(2.0, 2.0)) &
                              [] (complex(3.0, 3.0), complex(4.0, 4.0)))[integer.last len integer.first]) or
        not raisesIndexError(([] ('a', 'b') & [] ('c', 'd'))            [integer.last len integer.first]) or
        not raisesIndexError(([] ("one", "two") & [] ("three", "four")) [integer.last len integer.first]) then
      writeln(" ***** ARRAY [ START len LENGTH ] with index out of range does not raise INDEX_ERROR. (4)");
      okay := FALSE;
    end if;

    if  not raisesIndexError(([] (1, 2) & [] (3, 4))                    [integer.first len -1]) or
        not raisesIndexError(([] (1_, 2_) & [] (3_, 4_))                [integer.first len -1]) or
        not raisesIndexError(([] (1.0, 2.0) & [] (3.0, 4.0))            [integer.first len -1]) or
        not raisesIndexError(([] (complex(1.0, 1.0), complex(2.0, 2.0)) &
                              [] (complex(3.0, 3.0), complex(4.0, 4.0)))[integer.first len -1]) or
        not raisesIndexError(([] ('a', 'b') & [] ('c', 'd'))            [integer.first len -1]) or
        not raisesIndexError(([] ("one", "two") & [] ("three", "four")) [integer.first len -1]) or
        not raisesIndexError(([] (1, 2) & [] (3, 4))                    [-1 len -1]) or
        not raisesIndexError(([] (1_, 2_) & [] (3_, 4_))                [-1 len -1]) or
        not raisesIndexError(([] (1.0, 2.0) & [] (3.0, 4.0))            [-1 len -1]) or
        not raisesIndexError(([] (complex(1.0, 1.0), complex(2.0, 2.0)) &
                              [] (complex(3.0, 3.0), complex(4.0, 4.0)))[-1 len -1]) or
        not raisesIndexError(([] ('a', 'b') & [] ('c', 'd'))            [-1 len -1]) or
        not raisesIndexError(([] ("one", "two") & [] ("three", "four")) [-1 len -1]) or
        not raisesIndexError(([] (1, 2) & [] (3, 4))                    [0 len -1]) or
        not raisesIndexError(([] (1_, 2_) & [] (3_, 4_))                [0 len -1]) or
        not raisesIndexError(([] (1.0, 2.0) & [] (3.0, 4.0))            [0 len -1]) or
        not raisesIndexError(([] (complex(1.0, 1.0), complex(2.0, 2.0)) &
                              [] (complex(3.0, 3.0), complex(4.0, 4.0)))[0 len -1]) or
        not raisesIndexError(([] ('a', 'b') & [] ('c', 'd'))            [0 len -1]) or
        not raisesIndexError(([] ("one", "two") & [] ("three", "four")) [0 len -1]) or
        not raisesIndexError(([] (1, 2) & [] (3, 4))                    [3 len -1]) or
        not raisesIndexError(([] (1_, 2_) & [] (3_, 4_))                [3 len -1]) or
        not raisesIndexError(([] (1.0, 2.0) & [] (3.0, 4.0))            [3 len -1]) or
        not raisesIndexError(([] (complex(1.0, 1.0), complex(2.0, 2.0)) &
                              [] (complex(3.0, 3.0), complex(4.0, 4.0)))[3 len -1]) or
        not raisesIndexError(([] ('a', 'b') & [] ('c', 'd'))            [3 len -1]) or
        not raisesIndexError(([] ("one", "two") & [] ("three", "four")) [3 len -1]) or
        not raisesIndexError(([] (1, 2) & [] (3, 4))                    [4 len -1]) or
        not raisesIndexError(([] (1_, 2_) & [] (3_, 4_))                [4 len -1]) or
        not raisesIndexError(([] (1.0, 2.0) & [] (3.0, 4.0))            [4 len -1]) or
        not raisesIndexError(([] (complex(1.0, 1.0), complex(2.0, 2.0)) &
                              [] (complex(3.0, 3.0), complex(4.0, 4.0)))[4 len -1]) or
        not raisesIndexError(([] ('a', 'b') & [] ('c', 'd'))            [4 len -1]) or
        not raisesIndexError(([] ("one", "two") & [] ("three", "four")) [4 len -1]) or
        not raisesIndexError(([] (1, 2) & [] (3, 4))                    [5 len -1]) or
        not raisesIndexError(([] (1_, 2_) & [] (3_, 4_))                [5 len -1]) or
        not raisesIndexError(([] (1.0, 2.0) & [] (3.0, 4.0))            [5 len -1]) or
        not raisesIndexError(([] (complex(1.0, 1.0), complex(2.0, 2.0)) &
                              [] (complex(3.0, 3.0), complex(4.0, 4.0)))[5 len -1]) or
        not raisesIndexError(([] ('a', 'b') & [] ('c', 'd'))            [5 len -1]) or
        not raisesIndexError(([] ("one", "two") & [] ("three", "four")) [5 len -1]) or
        not raisesIndexError(([] (1, 2) & [] (3, 4))                    [integer.last len -1]) or
        not raisesIndexError(([] (1_, 2_) & [] (3_, 4_))                [integer.last len -1]) or
        not raisesIndexError(([] (1.0, 2.0) & [] (3.0, 4.0))            [integer.last len -1]) or
        not raisesIndexError(([] (complex(1.0, 1.0), complex(2.0, 2.0)) &
                              [] (complex(3.0, 3.0), complex(4.0, 4.0)))[integer.last len -1]) or
        not raisesIndexError(([] ('a', 'b') & [] ('c', 'd'))            [integer.last len -1]) or
        not raisesIndexError(([] ("one", "two") & [] ("three", "four")) [integer.last len -1]) then
      writeln(" ***** ARRAY [ START len LENGTH ] with index out of range does not raise INDEX_ERROR. (5)");
      okay := FALSE;
    end if;

    if  not raisesIndexError(([] (1, 2) & [] (3, 4))                    [integer.first len 0]) or
        not raisesIndexError(([] (1_, 2_) & [] (3_, 4_))                [integer.first len 0]) or
        not raisesIndexError(([] (1.0, 2.0) & [] (3.0, 4.0))            [integer.first len 0]) or
        not raisesIndexError(([] (complex(1.0, 1.0), complex(2.0, 2.0)) &
                              [] (complex(3.0, 3.0), complex(4.0, 4.0)))[integer.first len 0]) or
        not raisesIndexError(([] ('a', 'b') & [] ('c', 'd'))            [integer.first len 0]) or
        not raisesIndexError(([] ("one", "two") & [] ("three", "four")) [integer.first len 0]) or
        not raisesIndexError(([] (1, 2) & [] (3, 4))                    [-1 len 0]) or
        not raisesIndexError(([] (1_, 2_) & [] (3_, 4_))                [-1 len 0]) or
        not raisesIndexError(([] (1.0, 2.0) & [] (3.0, 4.0))            [-1 len 0]) or
        not raisesIndexError(([] (complex(1.0, 1.0), complex(2.0, 2.0)) &
                              [] (complex(3.0, 3.0), complex(4.0, 4.0)))[-1 len 0]) or
        not raisesIndexError(([] ('a', 'b') & [] ('c', 'd'))            [-1 len 0]) or
        not raisesIndexError(([] ("one", "two") & [] ("three", "four")) [-1 len 0]) or
        not raisesIndexError(([] (1, 2) & [] (3, 4))                    [0 len 0]) or
        not raisesIndexError(([] (1_, 2_) & [] (3_, 4_))                [0 len 0]) or
        not raisesIndexError(([] (1.0, 2.0) & [] (3.0, 4.0))            [0 len 0]) or
        not raisesIndexError(([] (complex(1.0, 1.0), complex(2.0, 2.0)) &
                              [] (complex(3.0, 3.0), complex(4.0, 4.0)))[0 len 0]) or
        not raisesIndexError(([] ('a', 'b') & [] ('c', 'd'))            [0 len 0]) or
        not raisesIndexError(([] ("one", "two") & [] ("three", "four")) [0 len 0]) (* or
        not raisesIndexError(([] (1, 2) & [] (3, 4))                    [3 len 0]) or
        not raisesIndexError(([] (1_, 2_) & [] (3_, 4_))                [3 len 0]) or
        not raisesIndexError(([] (1.0, 2.0) & [] (3.0, 4.0))            [3 len 0]) or
        not raisesIndexError(([] (complex(1.0, 1.0), complex(2.0, 2.0)) &
                              [] (complex(3.0, 3.0), complex(4.0, 4.0)))[3 len 0]) or
        not raisesIndexError(([] ('a', 'b') & [] ('c', 'd'))            [3 len 0]) or
        not raisesIndexError(([] ("one", "two") & [] ("three", "four")) [3 len 0]) or
        not raisesIndexError(([] (1, 2) & [] (3, 4))                    [4 len 0]) or
        not raisesIndexError(([] (1_, 2_) & [] (3_, 4_))                [4 len 0]) or
        not raisesIndexError(([] (1.0, 2.0) & [] (3.0, 4.0))            [4 len 0]) or
        not raisesIndexError(([] (complex(1.0, 1.0), complex(2.0, 2.0)) &
                              [] (complex(3.0, 3.0), complex(4.0, 4.0)))[4 len 0]) or
        not raisesIndexError(([] ('a', 'b') & [] ('c', 'd'))            [4 len 0]) or
        not raisesIndexError(([] ("one", "two") & [] ("three", "four")) [4 len 0]) or
        not raisesIndexError(([] (1, 2) & [] (3, 4))                    [5 len 0]) or
        not raisesIndexError(([] (1_, 2_) & [] (3_, 4_))                [5 len 0]) or
        not raisesIndexError(([] (1.0, 2.0) & [] (3.0, 4.0))            [5 len 0]) or
        not raisesIndexError(([] (complex(1.0, 1.0), complex(2.0, 2.0)) &
                              [] (complex(3.0, 3.0), complex(4.0, 4.0)))[5 len 0]) or
        not raisesIndexError(([] ('a', 'b') & [] ('c', 'd'))            [5 len 0]) or
        not raisesIndexError(([] ("one", "two") & [] ("three", "four")) [5 len 0]) or
        not raisesIndexError(([] (1, 2) & [] (3, 4))                    [integer.last len 0]) or
        not raisesIndexError(([] (1_, 2_) & [] (3_, 4_))                [integer.last len 0]) or
        not raisesIndexError(([] (1.0, 2.0) & [] (3.0, 4.0))            [integer.last len 0]) or
        not raisesIndexError(([] (complex(1.0, 1.0), complex(2.0, 2.0)) &
                              [] (complex(3.0, 3.0), complex(4.0, 4.0)))[integer.last len 0]) or
        not raisesIndexError(([] ('a', 'b') & [] ('c', 'd'))            [integer.last len 0]) or
        not raisesIndexError(([] ("one", "two") & [] ("three", "four")) [integer.last len 0]) *) then
      writeln(" ***** ARRAY [ START len LENGTH ] with index out of range does not raise INDEX_ERROR. (6)");
      okay := FALSE;
    end if;

    if okay then
      writeln("Sub array of array works correct.");
    end if;
  end func;


const proc: testInsertElement is func
  local
    var boolean: okay is TRUE;
    var integer: anIndex is 5;
    var array integer: intArr is [] (3, 4);
    var array bigInteger: bigArr is [] (3_, 4_);
    var array float: fltArr is [] (3.0, 4.0);
    var array complex: cpxArr is [] (complex(3.0, 3.0), complex(4.0, 4.0));
    var array char: chrArr is [] ('c', 'd');
    var array string: strArr is [] ("three", "four");
    var array array string: arrArr is 0 times 0 times "";
  begin
    insert(intArr, 1, 1);
    if length(intArr) <> 3 or intArr[1] <> 1 or intArr[2] <> 3 or
                              intArr[3] <> 4 then
      writeln(" ***** Insert of integer element to array failed. (1)");
      okay := FALSE;
    end if;
    insert(intArr, 2, intExpr(2));
    if length(intArr) <> 4 or intArr[1] <> 1 or intArr[2] <> 2 or
                              intArr[3] <> 3 or intArr[4] <> 4 then
      writeln(" ***** Insert of integer element to array failed. (2)");
      okay := FALSE;
    end if;
    insert(intArr, anIndex, 5);
    if length(intArr) <> 5 or intArr[1] <> 1 or intArr[2] <> 2 or
                              intArr[3] <> 3 or intArr[4] <> 4 or
                              intArr[5] <> 5 then
      writeln(" ***** Insert of integer element to array failed. (3)");
      okay := FALSE;
    end if;

    insert(bigArr, 1, 1_);
    if length(bigArr) <> 3 or bigArr[1] <> 1_ or bigArr[2] <> 3_ or
                              bigArr[3] <> 4_ then
      writeln(" ***** Insert of bigInteger element to array failed. (1)");
      okay := FALSE;
    end if;
    insert(bigArr, 2, bigintExpr(2_));
    if length(bigArr) <> 4 or bigArr[1] <> 1_ or bigArr[2] <> 2_ or
                              bigArr[3] <> 3_ or bigArr[4] <> 4_ then
      writeln(" ***** Insert of bigInteger element to array failed. (2)");
      okay := FALSE;
    end if;
    insert(bigArr, anIndex, 5_);
    if length(bigArr) <> 5 or bigArr[1] <> 1_ or bigArr[2] <> 2_ or
                              bigArr[3] <> 3_ or bigArr[4] <> 4_ or
                              bigArr[5] <> 5_ then
      writeln(" ***** Insert of bigInteger element to array failed. (3)");
      okay := FALSE;
    end if;

    insert(fltArr, 1, 1.0);
    if length(fltArr) <> 3 or fltArr[1] <> 1.0 or fltArr[2] <> 3.0 or
                              fltArr[3] <> 4.0 then
      writeln(" ***** Insert of float element to array failed. (1)");
      okay := FALSE;
    end if;
    insert(fltArr, 2, floatExpr(2.0));
    if length(fltArr) <> 4 or fltArr[1] <> 1.0 or fltArr[2] <> 2.0 or
                              fltArr[3] <> 3.0 or fltArr[4] <> 4.0 then
      writeln(" ***** Insert of float element to array failed. (2)");
      okay := FALSE;
    end if;
    insert(fltArr, anIndex, 5.0);
    if length(fltArr) <> 5 or fltArr[1] <> 1.0 or fltArr[2] <> 2.0 or
                              fltArr[3] <> 3.0 or fltArr[4] <> 4.0 or
                              fltArr[5] <> 5.0 then
      writeln(" ***** Insert of float element to array failed. (3)");
      okay := FALSE;
    end if;

    insert(cpxArr, 1, complex(1.0, 1.0));
    if length(cpxArr) <> 3 or cpxArr[1] <> complex(1.0, 1.0) or cpxArr[2] <> complex(3.0, 3.0) or
                              cpxArr[3] <> complex(4.0, 4.0) then
      writeln(" ***** Insert of complex element to array failed. (1)");
      okay := FALSE;
    end if;
    insert(cpxArr, 2, complexExpr(complex(2.0, 2.0)));
    if length(cpxArr) <> 4 or cpxArr[1] <> complex(1.0, 1.0) or cpxArr[2] <> complex(2.0, 2.0) or
                              cpxArr[3] <> complex(3.0, 3.0) or cpxArr[4] <> complex(4.0, 4.0) then
      writeln(" ***** Insert of complex element to array failed. (2)");
      okay := FALSE;
    end if;
    insert(cpxArr, anIndex, complex(5.0, 5.0));
    if length(cpxArr) <> 5 or cpxArr[1] <> complex(1.0, 1.0) or cpxArr[2] <> complex(2.0, 2.0) or
                              cpxArr[3] <> complex(3.0, 3.0) or cpxArr[4] <> complex(4.0, 4.0) or
                              cpxArr[5] <> complex(5.0, 5.0) then
      writeln(" ***** Insert of complex element to array failed. (3)");
      okay := FALSE;
    end if;

    insert(chrArr, 1, 'a');
    if length(chrArr) <> 3 or chrArr[1] <> 'a' or chrArr[2] <> 'c' or
                              chrArr[3] <> 'd' then
      writeln(" ***** Insert of char element to array failed. (1)");
      okay := FALSE;
    end if;
    insert(chrArr, 2, charExpr('b'));
    if length(chrArr) <> 4 or chrArr[1] <> 'a' or chrArr[2] <> 'b' or
                              chrArr[3] <> 'c' or chrArr[4] <> 'd' then
      writeln(" ***** Insert of char element to array failed. (2)");
      okay := FALSE;
    end if;
    insert(chrArr, anIndex, 'e');
    if length(chrArr) <> 5 or chrArr[1] <> 'a' or chrArr[2] <> 'b' or
                              chrArr[3] <> 'c' or chrArr[4] <> 'd' or
                              chrArr[5] <> 'e' then
      writeln(" ***** Insert of char element to array failed. (3)");
      okay := FALSE;
    end if;

    insert(strArr, 1, "one");
    if length(strArr) <> 3 or strArr[1] <> "one"   or strArr[2] <> "three" or
                              strArr[3] <> "four" then
      writeln(" ***** Insert of string element to array failed. (1)");
      okay := FALSE;
    end if;
    insert(strArr, 2, striExpr("two"));
    if length(strArr) <> 4 or strArr[1] <> "one"   or strArr[2] <> "two" or
                              strArr[3] <> "three" or strArr[4] <> "four" then
      writeln(" ***** Insert of string element to array failed. (2)");
      okay := FALSE;
    end if;
    insert(strArr, anIndex, "five");
    if length(strArr) <> 5 or strArr[1] <> "one"   or strArr[2] <> "two" or
                              strArr[3] <> "three" or strArr[4] <> "four" or
                              strArr[5] <> "five" then
      writeln(" ***** Insert of string element to array failed. (3)");
      okay := FALSE;
    end if;

    insert(arrArr, 1, 0 times "");
    if length(arrArr) <> 1 or length(arrArr[1]) <> 0 then
      writeln(" ***** Insert of array element to array failed. (1)");
      okay := FALSE;
    end if;
    insert(arrArr[1], 1, "three");
    if length(arrArr) <> 1 or length(arrArr[1]) <> 1 or arrArr[1][1] <> "three" then
      writeln(" ***** Insert of array element to array failed. (2)");
      okay := FALSE;
    end if;
    insert(arrArr[1], 2, "four");
    if length(arrArr) <> 1 or length(arrArr[1]) <> 2 or arrArr[1][1] <> "three" or
                                                        arrArr[1][2] <> "four" then
      writeln(" ***** Insert of array element to array failed. (3)");
      okay := FALSE;
    end if;

    if  not raisesIndexError(insert(intArr, integer.first, 0)) or
        not raisesIndexError(insert(bigArr, integer.first, 0_)) or
        not raisesIndexError(insert(fltArr, integer.first, 0.0)) or
        not raisesIndexError(insert(cpxArr, integer.first, complex(0.0, 0.0))) or
        not raisesIndexError(insert(chrArr, integer.first, '@')) or
        not raisesIndexError(insert(strArr, integer.first, "zero")) or
        not raisesIndexError(insert(intArr, 0, 0)) or
        not raisesIndexError(insert(bigArr, 0, 0_)) or
        not raisesIndexError(insert(fltArr, 0, 0.0)) or
        not raisesIndexError(insert(cpxArr, 0, complex(0.0, 0.0))) or
        not raisesIndexError(insert(chrArr, 0, '@')) or
        not raisesIndexError(insert(strArr, 0, "zero")) or
        not raisesIndexError(insert(intArr, 7, 0)) or
        not raisesIndexError(insert(bigArr, 7, 0_)) or
        not raisesIndexError(insert(fltArr, 7, 0.0)) or
        not raisesIndexError(insert(cpxArr, 7, complex(0.0, 0.0))) or
        not raisesIndexError(insert(chrArr, 7, '@')) or
        not raisesIndexError(insert(strArr, 7, "zero")) or
        not raisesIndexError(insert(intArr, integer.last, 0)) or
        not raisesIndexError(insert(bigArr, integer.last, 0_)) or
        not raisesIndexError(insert(fltArr, integer.last, 0.0)) or
        not raisesIndexError(insert(cpxArr, integer.last, complex(0.0, 0.0))) or
        not raisesIndexError(insert(chrArr, integer.last, '@')) or
        not raisesIndexError(insert(strArr, integer.last, "zero")) then
      writeln(" ***** Insert with index out of range does not raise INDEX_ERROR.");
      okay := FALSE;
    end if;

    if okay then
      writeln("Insert element into array works correct.");
    end if;
  end func;


const proc: testInsertArray is func
  local
    var boolean: okay is TRUE;
    var integer: anIndex is 5;
    var array integer: intArr is [] (1, 4);
    var array bigInteger: bigArr is [] (1_, 4_);
    var array float: fltArr is [] (1.0, 4.0);
    var array complex: cpxArr is [] (complex(1.0, 1.0), complex(4.0, 4.0));
    var array char: chrArr is [] ('a', 'd');
    var array string: strArr is [] ("one", "four");
    var array integer: intArr2 is [] (2, 3);
    var array bigInteger: bigArr2 is [] (2_, 3_);
    var array float: fltArr2 is [] (2.0, 3.0);
    var array complex: cpxArr2 is [] (complex(2.0, 2.0), complex(3.0, 3.0));
    var array char: chrArr2 is [] ('b', 'c');
    var array string: strArr2 is [] ("two", "three");
    var array array string: arrArr is 0 times 0 times "";
  begin
    insert(intArr, 2, [] (2, 3));
    if length(intArr) <> 4 or intArr[1] <> 1 or intArr[2] <> 2 or
                              intArr[3] <> 3 or intArr[4] <> 4 then
      writeln(" ***** Insert of integer array to array failed. (1)");
      okay := FALSE;
    end if;
    insert(intArr, 5, [] (5, 6));
    if length(intArr) <> 6 or intArr[1] <> 1 or intArr[2] <> 2 or
                              intArr[3] <> 3 or intArr[4] <> 4 or
                              intArr[5] <> 5 or intArr[6] <> 6 then
      writeln(" ***** Insert of integer array to array failed. (2)");
      okay := FALSE;
    end if;
    intArr := [] (1, 2);
    insert(intArr, 2, intArr);
    if length(intArr) <> 4 or intArr[1] <> 1 or intArr[2] <> 1 or
                              intArr[3] <> 2 or intArr[4] <> 2 then
      writeln(" ***** Insert of integer array to array failed. (3)");
      okay := FALSE;
    end if;
    intArr := [] (1, 2, 3);
    insert(intArr, 1, intArr[2 ..]);
    if length(intArr) <> 5 or intArr[1] <> 2 or intArr[2] <> 3 or
                              intArr[3] <> 1 or intArr[4] <> 2 or
                              intArr[5] <> 3 then
      writeln(" ***** Insert of integer array to array failed. (4)");
      okay := FALSE;
    end if;
    intArr := [] (1, 2, 3);
    insert(intArr, 2, intArr[.. 2]);
    if length(intArr) <> 5 or intArr[1] <> 1 or intArr[2] <> 1 or
                              intArr[3] <> 2 or intArr[4] <> 2 or
                              intArr[5] <> 3 then
      writeln(" ***** Insert of integer array to array failed. (5)");
      okay := FALSE;
    end if;
    intArr := [] (1, 6);
    insert(intArr, 2, [] (2, 3) & [] (4, 5));
    if length(intArr) <> 6 or intArr[1] <> 1 or intArr[2] <> 2 or
                              intArr[3] <> 3 or intArr[4] <> 4 or
                              intArr[5] <> 5 or intArr[6] <> 6 then
      writeln(" ***** Insert of integer array to array failed. (6)");
      okay := FALSE;
    end if;
    intArr := [] (1, 6);
    insert(intArr, 2, intArr2 & [] (4, 5));
    if length(intArr) <> 6 or intArr[1] <> 1 or intArr[2] <> 2 or
                              intArr[3] <> 3 or intArr[4] <> 4 or
                              intArr[5] <> 5 or intArr[6] <> 6 then
      writeln(" ***** Insert of integer array to array failed. (7)");
      okay := FALSE;
    end if;

    insert(bigArr, 2, [] (2_, 3_));
    if length(bigArr) <> 4 or bigArr[1] <> 1_ or bigArr[2] <> 2_ or
                              bigArr[3] <> 3_ or bigArr[4] <> 4_ then
      writeln(" ***** Insert of bigInteger array to array failed. (1)");
      okay := FALSE;
    end if;
    insert(bigArr, 5, [] (5_, 6_));
    if length(bigArr) <> 6 or bigArr[1] <> 1_ or bigArr[2] <> 2_ or
                              bigArr[3] <> 3_ or bigArr[4] <> 4_ or
                              bigArr[5] <> 5_ or bigArr[6] <> 6_ then
      writeln(" ***** Insert of bigInteger array to array failed. (2)");
      okay := FALSE;
    end if;
    bigArr := [] (1_, 2_);
    insert(bigArr, 2, bigArr);
    if length(bigArr) <> 4 or bigArr[1] <> 1_ or bigArr[2] <> 1_ or
                              bigArr[3] <> 2_ or bigArr[4] <> 2_ then
      writeln(" ***** Insert of bigInteger array to array failed. (3)");
      okay := FALSE;
    end if;
    bigArr := [] (1_, 2_, 3_);
    insert(bigArr, 1, bigArr[2 ..]);
    if length(bigArr) <> 5 or bigArr[1] <> 2_ or bigArr[2] <> 3_ or
                              bigArr[3] <> 1_ or bigArr[4] <> 2_ or
                              bigArr[5] <> 3_ then
      writeln(" ***** Insert of bigInteger array to array failed. (4)");
      okay := FALSE;
    end if;
    bigArr := [] (1_, 2_, 3_);
    insert(bigArr, 2, bigArr[.. 2]);
    if length(bigArr) <> 5 or bigArr[1] <> 1_ or bigArr[2] <> 1_ or
                              bigArr[3] <> 2_ or bigArr[4] <> 2_ or
                              bigArr[5] <> 3_ then
      writeln(" ***** Insert of bigInteger array to array failed. (5)");
      okay := FALSE;
    end if;
    bigArr := [] (1_, 6_);
    insert(bigArr, 2, [] (2_, 3_) & [] (4_, 5_));
    if length(bigArr) <> 6 or bigArr[1] <> 1_ or bigArr[2] <> 2_ or
                              bigArr[3] <> 3_ or bigArr[4] <> 4_ or
                              bigArr[5] <> 5_ or bigArr[6] <> 6_ then
      writeln(" ***** Insert of bigInteger array to array failed. (6)");
      okay := FALSE;
    end if;
    bigArr := [] (1_, 6_);
    insert(bigArr, 2, bigArr2 & [] (4_, 5_));
    if length(bigArr) <> 6 or bigArr[1] <> 1_ or bigArr[2] <> 2_ or
                              bigArr[3] <> 3_ or bigArr[4] <> 4_ or
                              bigArr[5] <> 5_ or bigArr[6] <> 6_ then
      writeln(" ***** Insert of bigInteger array to array failed. (7)");
      okay := FALSE;
    end if;

    insert(fltArr, 2, [] (2.0, 3.0));
    if length(fltArr) <> 4 or fltArr[1] <> 1.0 or fltArr[2] <> 2.0 or
                              fltArr[3] <> 3.0 or fltArr[4] <> 4.0 then
      writeln(" ***** Insert of float array to array failed. (1)");
      okay := FALSE;
    end if;
    insert(fltArr, 5, [] (5.0, 6.0));
    if length(fltArr) <> 6 or fltArr[1] <> 1.0 or fltArr[2] <> 2.0 or
                              fltArr[3] <> 3.0 or fltArr[4] <> 4.0 or
                              fltArr[5] <> 5.0 or fltArr[6] <> 6.0 then
      writeln(" ***** Insert of float array to array failed. (2)");
      okay := FALSE;
    end if;
    fltArr := [] (1.0, 2.0);
    insert(fltArr, 2, fltArr);
    if length(fltArr) <> 4 or fltArr[1] <> 1.0 or fltArr[2] <> 1.0 or
                              fltArr[3] <> 2.0 or fltArr[4] <> 2.0 then
      writeln(" ***** Insert of float array to array failed. (3)");
      okay := FALSE;
    end if;
    fltArr := [] (1.0, 2.0, 3.0);
    insert(fltArr, 1, fltArr[2 ..]);
    if length(fltArr) <> 5 or fltArr[1] <> 2.0 or fltArr[2] <> 3.0 or
                              fltArr[3] <> 1.0 or fltArr[4] <> 2.0 or
                              fltArr[5] <> 3.0 then
      writeln(" ***** Insert of float array to array failed. (4)");
      okay := FALSE;
    end if;
    fltArr := [] (1.0, 2.0, 3.0);
    insert(fltArr, 2, fltArr[.. 2]);
    if length(fltArr) <> 5 or fltArr[1] <> 1.0 or fltArr[2] <> 1.0 or
                              fltArr[3] <> 2.0 or fltArr[4] <> 2.0 or
                              fltArr[5] <> 3.0 then
      writeln(" ***** Insert of float array to array failed. (5)");
      okay := FALSE;
    end if;
    fltArr := [] (1.0, 6.0);
    insert(fltArr, 2, [] (2.0, 3.0) & [] (4.0, 5.0));
    if length(fltArr) <> 6 or fltArr[1] <> 1.0 or fltArr[2] <> 2.0 or
                              fltArr[3] <> 3.0 or fltArr[4] <> 4.0 or
                              fltArr[5] <> 5.0 or fltArr[6] <> 6.0 then
      writeln(" ***** Insert of float array to array failed. (6)");
      okay := FALSE;
    end if;
    fltArr := [] (1.0, 6.0);
    insert(fltArr, 2, fltArr2 & [] (4.0, 5.0));
    if length(fltArr) <> 6 or fltArr[1] <> 1.0 or fltArr[2] <> 2.0 or
                              fltArr[3] <> 3.0 or fltArr[4] <> 4.0 or
                              fltArr[5] <> 5.0 or fltArr[6] <> 6.0 then
      writeln(" ***** Insert of float array to array failed. (7)");
      okay := FALSE;
    end if;

    insert(cpxArr, 2, [] (complex(2.0, 2.0), complex(3.0, 3.0)));
    if length(cpxArr) <> 4 or cpxArr[1] <> complex(1.0, 1.0) or cpxArr[2] <> complex(2.0, 2.0) or
                              cpxArr[3] <> complex(3.0, 3.0) or cpxArr[4] <> complex(4.0, 4.0) then
      writeln(" ***** Insert of complex array to array failed. (1)");
      okay := FALSE;
    end if;
    insert(cpxArr, 5, [] (complex(5.0, 5.0), complex(6.0, 6.0)));
    if length(cpxArr) <> 6 or cpxArr[1] <> complex(1.0, 1.0) or cpxArr[2] <> complex(2.0, 2.0) or
                              cpxArr[3] <> complex(3.0, 3.0) or cpxArr[4] <> complex(4.0, 4.0) or
                              cpxArr[5] <> complex(5.0, 5.0) or cpxArr[6] <> complex(6.0, 6.0) then
      writeln(" ***** Insert of complex array to array failed. (2)");
      okay := FALSE;
    end if;
    cpxArr := [] (complex(1.0, 1.0), complex(2.0, 2.0));
    insert(cpxArr, 2, cpxArr);
    if length(cpxArr) <> 4 or cpxArr[1] <> complex(1.0, 1.0) or cpxArr[2] <> complex(1.0, 1.0) or
                              cpxArr[3] <> complex(2.0, 2.0) or cpxArr[4] <> complex(2.0, 2.0) then
      writeln(" ***** Insert of complex array to array failed. (3)");
      okay := FALSE;
    end if;
    cpxArr := [] (complex(1.0, 1.0), complex(2.0, 2.0), complex(3.0, 3.0));
    insert(cpxArr, 1, cpxArr[2 ..]);
    if length(cpxArr) <> 5 or cpxArr[1] <> complex(2.0, 2.0) or cpxArr[2] <> complex(3.0, 3.0) or
                              cpxArr[3] <> complex(1.0, 1.0) or cpxArr[4] <> complex(2.0, 2.0) or
                              cpxArr[5] <> complex(3.0, 3.0) then
      writeln(" ***** Insert of complex array to array failed. (4)");
      okay := FALSE;
    end if;
    cpxArr := [] (complex(1.0, 1.0), complex(2.0, 2.0), complex(3.0, 3.0));
    insert(cpxArr, 2, cpxArr[.. 2]);
    if length(cpxArr) <> 5 or cpxArr[1] <> complex(1.0, 1.0) or cpxArr[2] <> complex(1.0, 1.0) or
                              cpxArr[3] <> complex(2.0, 2.0) or cpxArr[4] <> complex(2.0, 2.0) or
                              cpxArr[5] <> complex(3.0, 3.0) then
      writeln(" ***** Insert of complex array to array failed. (5)");
      okay := FALSE;
    end if;
    cpxArr := [] (complex(1.0, 1.0), complex(6.0, 6.0));
    insert(cpxArr, 2, [] (complex(2.0, 2.0), complex(3.0, 3.0)) & [] (complex(4.0, 4.0), complex(5.0, 5.0)));
    if length(cpxArr) <> 6 or cpxArr[1] <> complex(1.0, 1.0) or cpxArr[2] <> complex(2.0, 2.0) or
                              cpxArr[3] <> complex(3.0, 3.0) or cpxArr[4] <> complex(4.0, 4.0) or
                              cpxArr[5] <> complex(5.0, 5.0) or cpxArr[6] <> complex(6.0, 6.0) then
      writeln(" ***** Insert of complex array to array failed. (6)");
      okay := FALSE;
    end if;
    cpxArr := [] (complex(1.0, 1.0), complex(6.0, 6.0));
    insert(cpxArr, 2, cpxArr2 & [] (complex(4.0, 4.0), complex(5.0, 5.0)));
    if length(cpxArr) <> 6 or cpxArr[1] <> complex(1.0, 1.0) or cpxArr[2] <> complex(2.0, 2.0) or
                              cpxArr[3] <> complex(3.0, 3.0) or cpxArr[4] <> complex(4.0, 4.0) or
                              cpxArr[5] <> complex(5.0, 5.0) or cpxArr[6] <> complex(6.0, 6.0) then
      writeln(" ***** Insert of complex array to array failed. (7)");
      okay := FALSE;
    end if;

    insert(chrArr, 2, [] ('b', 'c'));
    if length(chrArr) <> 4 or chrArr[1] <> 'a' or chrArr[2] <> 'b' or
                              chrArr[3] <> 'c' or chrArr[4] <> 'd' then
      writeln(" ***** Insert of char array to array failed. (1)");
      okay := FALSE;
    end if;
    insert(chrArr, 5, [] ('e', 'f'));
    if length(chrArr) <> 6 or chrArr[1] <> 'a' or chrArr[2] <> 'b' or
                              chrArr[3] <> 'c' or chrArr[4] <> 'd' or
                              chrArr[5] <> 'e' or chrArr[6] <> 'f' then
      writeln(" ***** Insert of char array to array failed. (2)");
      okay := FALSE;
    end if;
    chrArr := [] ('a', 'b');
    insert(chrArr, 2, chrArr);
    if length(chrArr) <> 4 or chrArr[1] <> 'a' or chrArr[2] <> 'a' or
                              chrArr[3] <> 'b' or chrArr[4] <> 'b' then
      writeln(" ***** Insert of char array to array failed. (3)");
      okay := FALSE;
    end if;
    chrArr := [] ('a', 'b', 'c');
    insert(chrArr, 1, chrArr[2 ..]);
    if length(chrArr) <> 5 or chrArr[1] <> 'b' or chrArr[2] <> 'c' or
                              chrArr[3] <> 'a' or chrArr[4] <> 'b' or
                              chrArr[5] <> 'c' then
      writeln(" ***** Insert of char array to array failed. (4)");
      okay := FALSE;
    end if;
    chrArr := [] ('a', 'b', 'c');
    insert(chrArr, 2, chrArr[.. 2]);
    if length(chrArr) <> 5 or chrArr[1] <> 'a' or chrArr[2] <> 'a' or
                              chrArr[3] <> 'b' or chrArr[4] <> 'b' or
                              chrArr[5] <> 'c' then
      writeln(" ***** Insert of char array to array failed. (5)");
      okay := FALSE;
    end if;
    chrArr := [] ('a', 'f');
    insert(chrArr, 2, chrArr2 & [] ('d', 'e'));
    if length(chrArr) <> 6 or chrArr[1] <> 'a' or chrArr[2] <> 'b' or
                              chrArr[3] <> 'c' or chrArr[4] <> 'd' or
                              chrArr[5] <> 'e' or chrArr[6] <> 'f' then
      writeln(" ***** Insert of char array to array failed. (6)");
      okay := FALSE;
    end if;
    chrArr := [] ('a', 'f');
    insert(chrArr, 2, [] ('b', 'c') & [] ('d', 'e'));
    if length(chrArr) <> 6 or chrArr[1] <> 'a' or chrArr[2] <> 'b' or
                              chrArr[3] <> 'c' or chrArr[4] <> 'd' or
                              chrArr[5] <> 'e' or chrArr[6] <> 'f' then
      writeln(" ***** Insert of char array to array failed. (7)");
      okay := FALSE;
    end if;

    insert(strArr, 2, [] ("two", "three"));
    if length(strArr) <> 4 or strArr[1] <> "one" or strArr[2] <> "two" or
                              strArr[3] <> "three" or strArr[4] <> "four" then
      writeln(" ***** Insert of string array to array failed. (1)");
      okay := FALSE;
    end if;
    insert(strArr, 5, [] ("five", "six"));
    if length(strArr) <> 6 or strArr[1] <> "one" or strArr[2] <> "two" or
                              strArr[3] <> "three" or strArr[4] <> "four" or
                              strArr[5] <> "five" or strArr[6] <> "six" then
      writeln(" ***** Insert of string array to array failed. (2)");
      okay := FALSE;
    end if;
    strArr := [] ("one", "two");
    insert(strArr, 2, strArr);
    if length(strArr) <> 4 or strArr[1] <> "one" or strArr[2] <> "one" or
                              strArr[3] <> "two" or strArr[4] <> "two" then
      writeln(" ***** Insert of string array to array failed. (3)");
      okay := FALSE;
    end if;
    strArr := [] ("one", "two", "three");
    insert(strArr, 1, strArr[2 ..]);
    if length(strArr) <> 5 or strArr[1] <> "two" or strArr[2] <> "three" or
                              strArr[3] <> "one" or strArr[4] <> "two" or
                              strArr[5] <> "three" then
      writeln(" ***** Insert of string array to array failed. (4)");
      okay := FALSE;
    end if;
    strArr := [] ("one", "two", "three");
    insert(strArr, 2, strArr[.. 2]);
    if length(strArr) <> 5 or strArr[1] <> "one" or strArr[2] <> "one" or
                              strArr[3] <> "two" or strArr[4] <> "two" or
                              strArr[5] <> "three" then
      writeln(" ***** Insert of string array to array failed. (5)");
      okay := FALSE;
    end if;
    strArr := [] ("one", "six");
    insert(strArr, 2, [] ("two", "three") & [] ("four", "five"));
    if length(strArr) <> 6 or strArr[1] <> "one" or strArr[2] <> "two" or
                              strArr[3] <> "three" or strArr[4] <> "four" or
                              strArr[5] <> "five" or strArr[6] <> "six" then
      writeln(" ***** Insert of string array to array failed. (6)");
      okay := FALSE;
    end if;
    strArr := [] ("one", "six");
    insert(strArr, 2, strArr2 & [] ("four", "five"));
    if length(strArr) <> 6 or strArr[1] <> "one" or strArr[2] <> "two" or
                              strArr[3] <> "three" or strArr[4] <> "four" or
                              strArr[5] <> "five" or strArr[6] <> "six" then
      writeln(" ***** Insert of string array to array failed. (7)");
      okay := FALSE;
    end if;

    if  not raisesIndexError(insert(intArr, integer.first, 0 times 0)) or
        not raisesIndexError(insert(bigArr, integer.first, 0 times 0_)) or
        not raisesIndexError(insert(fltArr, integer.first, 0 times 0.0)) or
        not raisesIndexError(insert(cpxArr, integer.first, 0 times complex(0.0, 0.0))) or
        not raisesIndexError(insert(chrArr, integer.first, 0 times '@')) or
        not raisesIndexError(insert(strArr, integer.first, 0 times "zero")) or
        not raisesIndexError(insert(intArr, 0, 0 times 0)) or
        not raisesIndexError(insert(bigArr, 0, 0 times 0_)) or
        not raisesIndexError(insert(fltArr, 0, 0 times 0.0)) or
        not raisesIndexError(insert(cpxArr, 0, 0 times complex(0.0, 0.0))) or
        not raisesIndexError(insert(chrArr, 0, 0 times '@')) or
        not raisesIndexError(insert(strArr, 0, 0 times "zero")) or
        not raisesIndexError(insert(intArr, 8, 0 times 0)) or
        not raisesIndexError(insert(bigArr, 8, 0 times 0_)) or
        not raisesIndexError(insert(fltArr, 8, 0 times 0.0)) or
        not raisesIndexError(insert(cpxArr, 8, 0 times complex(0.0, 0.0))) or
        not raisesIndexError(insert(chrArr, 8, 0 times '@')) or
        not raisesIndexError(insert(strArr, 8, 0 times "zero")) or
        not raisesIndexError(insert(intArr, integer.last, 0 times 0)) or
        not raisesIndexError(insert(bigArr, integer.last, 0 times 0_)) or
        not raisesIndexError(insert(fltArr, integer.last, 0 times 0.0)) or
        not raisesIndexError(insert(cpxArr, integer.last, 0 times complex(0.0, 0.0))) or
        not raisesIndexError(insert(chrArr, integer.last, 0 times '@')) or
        not raisesIndexError(insert(strArr, integer.last, 0 times "zero")) then
      writeln(" ***** Insert with index out of range does not raise INDEX_ERROR.");
      okay := FALSE;
    end if;

    if okay then
      writeln("Insert array into array works correct.");
    end if;
  end func;


const proc: testRemoveElement is func
  local
    var boolean: okay is TRUE;
    var array integer: intArr is [] (1, 2, 3, 4, 5);
    var array bigInteger: bigArr is [] (1_, 2_, 3_, 4_, 5_);
    var array float: fltArr is [] (1.0, 2.0, 3.0, 4.0, 5.0);
    var array complex: cpxArr is [] (complex(1.0, 1.0), complex(2.0, 2.0),
        complex(3.0, 3.0), complex(4.0, 4.0), complex(5.0, 5.0));
    var array char: chrArr is [] ('a', 'b', 'c', 'd', 'e');
    var array string: strArr is [] ("one", "two", "three", "four", "five");
    var integer: intElem is 0;
    var bigInteger: bigElem is 0_;
    var float: fltElem is 0.0;
    var complex: cpxElem is complex(0.0, 0.0);
    var char: chrElem is ' ';
    var string: strElem is "";
  begin
    intElem := remove(intArr, 1);
    if intElem <> 1 or length(intArr) <> 4 or intArr[1] <> 2 or intArr[2] <> 3 or
                                              intArr[3] <> 4 or intArr[4] <> 5 then
      writeln(" ***** Remove of integer element from array failed. (1)");
      okay := FALSE;
    end if;
    intElem := remove(intArr, intExpr(1));
    if intElem <> 2 or length(intArr) <> 3 or intArr[1] <> 3 or intArr[2] <> 4 or
                                              intArr[3] <> 5 then
      writeln(" ***** Remove of integer element from array failed. (2)");
      okay := FALSE;
    end if;
    intElem := remove(intArr, 2);
    if intElem <> 4 or length(intArr) <> 2 or intArr[1] <> 3 or intArr[2] <> 5 then
      writeln(" ***** Remove of integer element from array failed. (3)");
      okay := FALSE;
    end if;
    intElem := remove(intArr, 2);
    if intElem <> 5 or length(intArr) <> 1 or intArr[1] <> 3 then
      writeln(" ***** Remove of integer element from array failed. (4)");
      okay := FALSE;
    end if;

    bigElem := remove(bigArr, 1);
    if bigElem <> 1_ or length(bigArr) <> 4 or bigArr[1] <> 2_ or bigArr[2] <> 3_ or
                                              bigArr[3] <> 4_ or bigArr[4] <> 5_ then
      writeln(" ***** Remove of bigInteger element from array failed. (1)");
      okay := FALSE;
    end if;
    bigElem := remove(bigArr, intExpr(1));
    if bigElem <> 2_ or length(bigArr) <> 3 or bigArr[1] <> 3_ or bigArr[2] <> 4_ or
                                              bigArr[3] <> 5_ then
      writeln(" ***** Remove of bigInteger element from array failed. (2)");
      okay := FALSE;
    end if;
    bigElem := remove(bigArr, 2);
    if bigElem <> 4_ or length(bigArr) <> 2 or bigArr[1] <> 3_ or bigArr[2] <> 5_ then
      writeln(" ***** Remove of bigInteger element from array failed. (3)");
      okay := FALSE;
    end if;
    bigElem := remove(bigArr, 2);
    if bigElem <> 5_ or length(bigArr) <> 1 or bigArr[1] <> 3_ then
      writeln(" ***** Remove of bigInteger element from array failed. (4)");
      okay := FALSE;
    end if;

    fltElem := remove(fltArr, 1);
    if fltElem <> 1.0 or length(fltArr) <> 4 or fltArr[1] <> 2.0 or fltArr[2] <> 3.0 or
                                                fltArr[3] <> 4.0 or fltArr[4] <> 5.0 then
      writeln(" ***** Remove of float element from array failed. (1)");
      okay := FALSE;
    end if;
    fltElem := remove(fltArr, intExpr(1));
    if fltElem <> 2.0 or length(fltArr) <> 3 or fltArr[1] <> 3.0 or fltArr[2] <> 4.0 or
                                                fltArr[3] <> 5.0 then
      writeln(" ***** Remove of float element from array failed. (2)");
      okay := FALSE;
    end if;
    fltElem := remove(fltArr, 2);
    if fltElem <> 4.0 or length(fltArr) <> 2 or fltArr[1] <> 3.0 or fltArr[2] <> 5.0 then
      writeln(" ***** Remove of float element from array failed. (3)");
      okay := FALSE;
    end if;
    fltElem := remove(fltArr, 2);
    if fltElem <> 5.0 or length(fltArr) <> 1 or fltArr[1] <> 3.0 then
      writeln(" ***** Remove of float element from array failed. (4)");
      okay := FALSE;
    end if;

    cpxElem := remove(cpxArr, 1);
    if cpxElem <> complex(1.0, 1.0) or length(cpxArr) <> 4 or
        cpxArr[1] <> complex(2.0, 2.0) or cpxArr[2] <> complex(3.0, 3.0) or
        cpxArr[3] <> complex(4.0, 4.0) or cpxArr[4] <> complex(5.0, 5.0) then
      writeln(" ***** Remove of complex element from array failed. (1)");
      okay := FALSE;
    end if;
    cpxElem := remove(cpxArr, intExpr(1));
    if cpxElem <> complex(2.0, 2.0) or length(cpxArr) <> 3 or
        cpxArr[1] <> complex(3.0, 3.0) or cpxArr[2] <> complex(4.0, 4.0) or
        cpxArr[3] <> complex(5.0, 5.0) then
      writeln(" ***** Remove of complex element from array failed. (2)");
      okay := FALSE;
    end if;
    cpxElem := remove(cpxArr, 2);
    if cpxElem <> complex(4.0, 4.0) or length(cpxArr) <> 2 or
        cpxArr[1] <> complex(3.0, 3.0) or cpxArr[2] <> complex(5.0, 5.0) then
      writeln(" ***** Remove of complex element from array failed. (3)");
      okay := FALSE;
    end if;
    cpxElem := remove(cpxArr, 2);
    if cpxElem <> complex(5.0, 5.0) or length(cpxArr) <> 1 or
        cpxArr[1] <> complex(3.0, 3.0) then
      writeln(" ***** Remove of complex element from array failed. (4)");
      okay := FALSE;
    end if;

    chrElem := remove(chrArr, 1);
    if chrElem <> 'a' or length(chrArr) <> 4 or chrArr[1] <> 'b' or chrArr[2] <> 'c' or
                                                chrArr[3] <> 'd' or chrArr[4] <> 'e' then
      writeln(" ***** Remove of char element from array failed. (1)");
      okay := FALSE;
    end if;
    chrElem := remove(chrArr, intExpr(1));
    if chrElem <> 'b' or length(chrArr) <> 3 or chrArr[1] <> 'c' or chrArr[2] <> 'd' or
                                                chrArr[3] <> 'e' then
      writeln(" ***** Remove of char element from array failed. (2)");
      okay := FALSE;
    end if;
    chrElem := remove(chrArr, 2);
    if chrElem <> 'd' or length(chrArr) <> 2 or chrArr[1] <> 'c' or chrArr[2] <> 'e' then
      writeln(" ***** Remove of char element from array failed. (3)");
      okay := FALSE;
    end if;
    chrElem := remove(chrArr, 2);
    if chrElem <> 'e' or length(chrArr) <> 1 or chrArr[1] <> 'c' then
      writeln(" ***** Remove of char element from array failed. (4)");
      okay := FALSE;
    end if;

    strElem := remove(strArr, 1);
    if strElem <> "one" or length(strArr) <> 4 or strArr[1] <> "two"  or strArr[2] <> "three" or
                                                  strArr[3] <> "four" or strArr[4] <> "five"  then
      writeln(" ***** Remove of string element from array failed. (1)");
      okay := FALSE;
    end if;
    strElem := remove(strArr, intExpr(1));
    if strElem <> "two" or length(strArr) <> 3 or strArr[1] <> "three" or strArr[2] <> "four" or
                                                  strArr[3] <> "five" then
      writeln(" ***** Remove of string element from array failed. (2)");
      okay := FALSE;
    end if;
    strElem := remove(strArr, 2);
    if strElem <> "four" or length(strArr) <> 2 or strArr[1] <> "three" or strArr[2] <> "five" then
      writeln(" ***** Remove of string element from array failed. (3)");
      okay := FALSE;
    end if;
    strElem := remove(strArr, 2);
    if strElem <> "five" or length(strArr) <> 1 or strArr[1] <> "three" then
      writeln(" ***** Remove of string element from array failed. (4)");
      okay := FALSE;
    end if;

    if  not raisesIndexError(remove(intArr, integer.first)) or
        not raisesIndexError(remove(bigArr, integer.first)) or
        not raisesIndexError(remove(fltArr, integer.first)) or
        not raisesIndexError(remove(cpxArr, integer.first)) or
        not raisesIndexError(remove(chrArr, integer.first)) or
        not raisesIndexError(remove(strArr, integer.first)) or
        not raisesIndexError(remove(intArr, 0)) or
        not raisesIndexError(remove(bigArr, 0)) or
        not raisesIndexError(remove(fltArr, 0)) or
        not raisesIndexError(remove(cpxArr, 0)) or
        not raisesIndexError(remove(chrArr, 0)) or
        not raisesIndexError(remove(strArr, 0)) or
        not raisesIndexError(remove(intArr, 2)) or
        not raisesIndexError(remove(bigArr, 2)) or
        not raisesIndexError(remove(fltArr, 2)) or
        not raisesIndexError(remove(cpxArr, 2)) or
        not raisesIndexError(remove(chrArr, 2)) or
        not raisesIndexError(remove(strArr, 2)) or
        not raisesIndexError(remove(intArr, integer.last)) or
        not raisesIndexError(remove(bigArr, integer.last)) or
        not raisesIndexError(remove(fltArr, integer.last)) or
        not raisesIndexError(remove(cpxArr, integer.last)) or
        not raisesIndexError(remove(chrArr, integer.last)) or
        not raisesIndexError(remove(strArr, integer.last)) then
      writeln(" ***** Remove with index out of range does not raise INDEX_ERROR.");
      okay := FALSE;
    end if;

    if okay then
      writeln("Remove element from array works correct.");
    end if;
  end func;


const proc: testRemoveArray is func
  local
    var boolean: okay is TRUE;
    var array integer: intArr is [] (1, 2, 3, 4, 5, 6, 7);
    var array bigInteger: bigArr is [] (1_, 2_, 3_, 4_, 5_, 6_, 7_);
    var array float: fltArr is [] (1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0);
    var array complex: cpxArr is [] (complex(1.0, 1.0), complex(2.0, 2.0), complex(3.0, 3.0),
        complex(4.0, 4.0), complex(5.0, 5.0), complex(6.0, 6.0), complex(7.0, 7.0));
    var array char: chrArr is [] ('a', 'b', 'c', 'd', 'e', 'f', 'g');
    var array string: strArr is [] ("one", "two", "three", "four", "five", "six", "seven");
    var array integer: intRemoved is 0 times 0;
    var array bigInteger: bigRemoved is 0 times 0_;
    var array float: fltRemoved is 0 times 0.0;
    var array complex: cpxRemoved is 0 times complex(0.0, 0.0);
    var array char: chrRemoved is 0 times ' ';
    var array string: strRemoved is 0 times "";
  begin
    intRemoved := remove(intArr, 1, 0);
    if length(intRemoved) <> 0 or
        length(intArr) <> 7 or intArr[1] <> 1 or intArr[2] <> 2 or intArr[3] <> 3 or
                               intArr[4] <> 4 or intArr[5] <> 5 or intArr[6] <> 6 or
                               intArr[7] <> 7 then
      writeln(" ***** Remove of integer array from array failed. (1)");
      okay := FALSE;
    end if;
    intRemoved := remove(intArr, 1, 1);
    if length(intRemoved) <> 1 or intRemoved[1] <> 1 or
        length(intArr) <> 6 or intArr[1] <> 2 or intArr[2] <> 3 or intArr[3] <> 4 or
                               intArr[4] <> 5 or intArr[5] <> 6 or intArr[6] <> 7 then
      writeln(" ***** Remove of integer array from array failed. (2)");
      okay := FALSE;
    end if;
    intRemoved := remove(intArr, 2, 2);
    if length(intRemoved) <> 2 or intRemoved[1] <> 3 or intRemoved[2] <> 4 or
        length(intArr) <> 4 or intArr[1] <> 2 or intArr[2] <> 5 or intArr[3] <> 6 or
                               intArr[4] <> 7 then
      writeln(" ***** Remove of integer array from array failed. (3)");
      okay := FALSE;
    end if;
    intRemoved := remove(intArr, 3, integer.last);
    if length(intRemoved) <> 2 or intRemoved[1] <> 6 or intRemoved[2] <> 7 or
        length(intArr) <> 2 or intArr[1] <> 2 or intArr[2] <> 5 then
      writeln(" ***** Remove of integer array from array failed. (4)");
      okay := FALSE;
    end if;

    bigRemoved := remove(bigArr, 1, 0);
    if length(bigRemoved) <> 0 or
        length(bigArr) <> 7 or bigArr[1] <> 1_ or bigArr[2] <> 2_ or bigArr[3] <> 3_ or
                               bigArr[4] <> 4_ or bigArr[5] <> 5_ or bigArr[6] <> 6_ or
                               bigArr[7] <> 7_ then
      writeln(" ***** Remove of bigInteger array from array failed. (1)");
      okay := FALSE;
    end if;
    bigRemoved := remove(bigArr, 1, 1);
    if length(bigRemoved) <> 1 or bigRemoved[1] <> 1_ or
        length(bigArr) <> 6 or bigArr[1] <> 2_ or bigArr[2] <> 3_ or bigArr[3] <> 4_ or
                               bigArr[4] <> 5_ or bigArr[5] <> 6_ or bigArr[6] <> 7_ then
      writeln(" ***** Remove of bigInteger array from array failed. (2)");
      okay := FALSE;
    end if;
    bigRemoved := remove(bigArr, 2, 2);
    if length(bigRemoved) <> 2 or bigRemoved[1] <> 3_ or bigRemoved[2] <> 4_ or
        length(bigArr) <> 4 or bigArr[1] <> 2_ or bigArr[2] <> 5_ or bigArr[3] <> 6_ or
                               bigArr[4] <> 7_ then
      writeln(" ***** Remove of bigInteger array from array failed. (3)");
      okay := FALSE;
    end if;
    bigRemoved := remove(bigArr, 3, integer.last);
    if length(bigRemoved) <> 2 or bigRemoved[1] <> 6_ or bigRemoved[2] <> 7_ or
        length(bigArr) <> 2 or bigArr[1] <> 2_ or bigArr[2] <> 5_ then
      writeln(" ***** Remove of bigInteger array from array failed. (4)");
      okay := FALSE;
    end if;

    fltRemoved := remove(fltArr, 1, 0);
    if length(fltRemoved) <> 0 or
        length(fltArr) <> 7 or fltArr[1] <> 1.0 or fltArr[2] <> 2.0 or fltArr[3] <> 3.0 or
                               fltArr[4] <> 4.0 or fltArr[5] <> 5.0 or fltArr[6] <> 6.0 or
                               fltArr[7] <> 7.0 then
      writeln(" ***** Remove of float array from array failed. (1)");
      okay := FALSE;
    end if;
    fltRemoved := remove(fltArr, 1, 1);
    if length(fltRemoved) <> 1 or fltRemoved[1] <> 1.0 or
        length(fltArr) <> 6 or fltArr[1] <> 2.0 or fltArr[2] <> 3.0 or fltArr[3] <> 4.0 or
                               fltArr[4] <> 5.0 or fltArr[5] <> 6.0 or fltArr[6] <> 7.0 then
      writeln(" ***** Remove of float array from array failed. (2)");
      okay := FALSE;
    end if;
    fltRemoved := remove(fltArr, 2, 2);
    if length(fltRemoved) <> 2 or fltRemoved[1] <> 3.0 or fltRemoved[2] <> 4.0 or
        length(fltArr) <> 4 or fltArr[1] <> 2.0 or fltArr[2] <> 5.0 or fltArr[3] <> 6.0 or
                               fltArr[4] <> 7.0 then
      writeln(" ***** Remove of float array from array failed. (3)");
      okay := FALSE;
    end if;
    fltRemoved := remove(fltArr, 3, integer.last);
    if length(fltRemoved) <> 2 or fltRemoved[1] <> 6.0 or fltRemoved[2] <> 7.0 or
        length(fltArr) <> 2 or fltArr[1] <> 2.0 or fltArr[2] <> 5.0 then
      writeln(" ***** Remove of float array from array failed. (4)");
      okay := FALSE;
    end if;

    cpxRemoved := remove(cpxArr, 1, 0);
    if length(cpxRemoved) <> 0 or
        length(cpxArr) <> 7 or cpxArr[1] <> complex(1.0, 1.0) or cpxArr[2] <> complex(2.0, 2.0) or
                               cpxArr[3] <> complex(3.0, 3.0) or cpxArr[4] <> complex(4.0, 4.0) or
                               cpxArr[5] <> complex(5.0, 5.0) or cpxArr[6] <> complex(6.0, 6.0) or
                               cpxArr[7] <> complex(7.0, 7.0) then
      writeln(" ***** Remove of complex array from array failed. (1)");
      okay := FALSE;
    end if;
    cpxRemoved := remove(cpxArr, 1, 1);
    if length(cpxRemoved) <> 1 or cpxRemoved[1] <> complex(1.0, 1.0) or
        length(cpxArr) <> 6 or cpxArr[1] <> complex(2.0, 2.0) or cpxArr[2] <> complex(3.0, 3.0) or
                               cpxArr[3] <> complex(4.0, 4.0) or cpxArr[4] <> complex(5.0, 5.0) or
                               cpxArr[5] <> complex(6.0, 6.0) or cpxArr[6] <> complex(7.0, 7.0) then
      writeln(" ***** Remove of complex array from array failed. (2)");
      okay := FALSE;
    end if;
    cpxRemoved := remove(cpxArr, 2, 2);
    if length(cpxRemoved) <> 2 or cpxRemoved[1] <> complex(3.0, 3.0) or
                                  cpxRemoved[2] <> complex(4.0, 4.0) or
        length(cpxArr) <> 4 or cpxArr[1] <> complex(2.0, 2.0) or cpxArr[2] <> complex(5.0, 5.0) or
                               cpxArr[3] <> complex(6.0, 6.0) or cpxArr[4] <> complex(7.0, 7.0) then
      writeln(" ***** Remove of complex array from array failed. (3)");
      okay := FALSE;
    end if;
    cpxRemoved := remove(cpxArr, 3, integer.last);
    if length(cpxRemoved) <> 2 or cpxRemoved[1] <> complex(6.0, 6.0) or
                                  cpxRemoved[2] <> complex(7.0, 7.0) or
        length(cpxArr) <> 2 or cpxArr[1] <> complex(2.0, 2.0) or cpxArr[2] <> complex(5.0, 5.0) then
      writeln(" ***** Remove of complex array from array failed. (4)");
      okay := FALSE;
    end if;

    chrRemoved := remove(chrArr, 1, 0);
    if length(chrRemoved) <> 0 or
        length(chrArr) <> 7 or chrArr[1] <> 'a' or chrArr[2] <> 'b' or chrArr[3] <> 'c' or
                               chrArr[4] <> 'd' or chrArr[5] <> 'e' or chrArr[6] <> 'f' or
                               chrArr[7] <> 'g' then
      writeln(" ***** Remove of char array from array failed. (1)");
      okay := FALSE;
    end if;
    chrRemoved := remove(chrArr, 1, 1);
    if length(chrRemoved) <> 1 or chrRemoved[1] <> 'a' or
        length(chrArr) <> 6 or chrArr[1] <> 'b' or chrArr[2] <> 'c' or chrArr[3] <> 'd' or
                               chrArr[4] <> 'e' or chrArr[5] <> 'f' or chrArr[6] <> 'g' then
      writeln(" ***** Remove of char array from array failed. (2)");
      okay := FALSE;
    end if;
    chrRemoved := remove(chrArr, 2, 2);
    if length(chrRemoved) <> 2 or chrRemoved[1] <> 'c' or chrRemoved[2] <> 'd' or
        length(chrArr) <> 4 or chrArr[1] <> 'b' or chrArr[2] <> 'e' or chrArr[3] <> 'f' or
                               chrArr[4] <> 'g' then
      writeln(" ***** Remove of char array from array failed. (3)");
      okay := FALSE;
    end if;
    chrRemoved := remove(chrArr, 3, integer.last);
    if length(chrRemoved) <> 2 or chrRemoved[1] <> 'f' or chrRemoved[2] <> 'g' or
        length(chrArr) <> 2 or chrArr[1] <> 'b' or chrArr[2] <> 'e' then
      writeln(" ***** Remove of char array from array failed. (4)");
      okay := FALSE;
    end if;

    strRemoved := remove(strArr, 1, 0);
    if length(strRemoved) <> 0 or
        length(strArr) <> 7 or strArr[1] <> "one" or strArr[2] <> "two" or strArr[3] <> "three" or
                               strArr[4] <> "four" or strArr[5] <> "five" or strArr[6] <> "six" or
                               strArr[7] <> "seven" then
      writeln(" ***** Remove of integer array from array failed. (1)");
      okay := FALSE;
    end if;
    strRemoved := remove(strArr, 1, 1);
    if length(strRemoved) <> 1 or strRemoved[1] <> "one" or
        length(strArr) <> 6 or strArr[1] <> "two" or strArr[2] <> "three" or strArr[3] <> "four" or
                               strArr[4] <> "five" or strArr[5] <> "six" or strArr[6] <> "seven" then
      writeln(" ***** Remove of integer array from array failed. (2)");
      okay := FALSE;
    end if;
    strRemoved := remove(strArr, 2, 2);
    if length(strRemoved) <> 2 or strRemoved[1] <> "three" or strRemoved[2] <> "four" or
        length(strArr) <> 4 or strArr[1] <> "two" or strArr[2] <> "five" or strArr[3] <> "six" or
                               strArr[4] <> "seven" then
      writeln(" ***** Remove of integer array from array failed. (3)");
      okay := FALSE;
    end if;
    strRemoved := remove(strArr, 3, integer.last);
    if length(strRemoved) <> 2 or strRemoved[1] <> "six" or strRemoved[2] <> "seven" or
        length(strArr) <> 2 or strArr[1] <> "two" or strArr[2] <> "five" then
      writeln(" ***** Remove of integer array from array failed. (4)");
      okay := FALSE;
    end if;

    if  not raisesIndexError(remove(intArr, integer.first, 0)) or
        not raisesIndexError(remove(bigArr, integer.first, 0)) or
        not raisesIndexError(remove(fltArr, integer.first, 0)) or
        not raisesIndexError(remove(cpxArr, integer.first, 0)) or
        not raisesIndexError(remove(chrArr, integer.first, 0)) or
        not raisesIndexError(remove(strArr, integer.first, 0)) or
        not raisesIndexError(remove(intArr, 0, 0)) or
        not raisesIndexError(remove(bigArr, 0, 0)) or
        not raisesIndexError(remove(fltArr, 0, 0)) or
        not raisesIndexError(remove(cpxArr, 0, 0)) or
        not raisesIndexError(remove(chrArr, 0, 0)) or
        not raisesIndexError(remove(strArr, 0, 0)) or
        not raisesIndexError(remove(intArr, 3, 0)) or
        not raisesIndexError(remove(bigArr, 3, 0)) or
        not raisesIndexError(remove(fltArr, 3, 0)) or
        not raisesIndexError(remove(cpxArr, 3, 0)) or
        not raisesIndexError(remove(chrArr, 3, 0)) or
        not raisesIndexError(remove(strArr, 3, 0)) or
        not raisesIndexError(remove(intArr, integer.last, 0)) or
        not raisesIndexError(remove(bigArr, integer.last, 0)) or
        not raisesIndexError(remove(fltArr, integer.last, 0)) or
        not raisesIndexError(remove(cpxArr, integer.last, 0)) or
        not raisesIndexError(remove(chrArr, integer.last, 0)) or
        not raisesIndexError(remove(strArr, integer.last, 0)) then
      writeln(" ***** Remove with index out of range does not raise INDEX_ERROR.");
      okay := FALSE;
    end if;

    if okay then
      writeln("Remove array from array works correct.");
    end if;
  end func;


const proc: main is func
  begin
    writeln;
    # testSpecial;
    testCompare;
    testAssign;
    testAppend;
    testIndex;
    testHeadAndTail;
    testHead;
    testTail;
    testRange;
    testSubarr;
    testInsertElement;
    testInsertArray;
    testRemoveElement;
    testRemoveArray;
    # testArraySort;
    # testArrayCopy;
  end func;
