Home
 

Testing

Chapter 3. Testing

Testing is done with the test suite provided in the subdirectory t/ of the project source code. Read its README for further details.

The following program was provided with the Specification (see Chapter 1).

program test1;
   var a, b: array [1..10] of integer;
       i, j: integer;

begin
   i := j := 2;        // Multiple assignments
   loop
      if i > 10 then exit end if;
      a[i] := j * 2 + i;
      b[i] := 11 - i;
      i := i + 1;
      j := j + 3
   end loop;
   b[5] := 0-2; ;     // Empty statement
   writeln (a[b[4]+1]);
   if i < j then
      if i = 0 then
        writeln (a[5])
      else
        writeln (a[3]);  // Empty statement
      end if
   end if;
   writeln (a[10])
end.    


Running the program leads to the following result.

>./epc test1.p | ./slick
slick interpreter version 1.2

48
13
62