Test suite results for test file test/texception4.pp

Test run data :

Free Pascal Compiler Test Suite Results

View Test suite results

Please specify search criteria:
File:
Operating system:
Processor:
Version
Date
Submitter
Machine
Comment
Limit
Cond
Category
Only failed tests
Hide skipped tests
List all tests

Test file "test/texception4.pp" information:

t_id 36
t_adddate 2003/10/03
t_result 0
t_knownrunerror 0

Detailed test run results:

Record count: 50

Total = 50

OK=50 Percentage= 100.00

Result type Cat. Count Percentage First date Last Date
Successfully run 50 100.0 2024/05/16 22:06:00 76 2024/05/17 00:25:00 23
i386 18 36.0 2024/05/16 22:08:00 35 2024/05/16 23:57:00 23
sparc 18 36.0 2024/05/16 23:24:00 38 2024/05/16 23:55:00 41
powerpc 1 2.0 2024/05/16 22:06:00 76 2024/05/16 22:06:00 76
x86_64 12 24.0 2024/05/16 22:26:00 31 2024/05/17 00:25:00 23
aarch64 1 2.0 2024/05/17 00:12:00 32 2024/05/17 00:12:00 32
linux 4 8.0 2024/05/16 22:06:00 76 2024/05/17 00:12:00 32
win32 4 8.0 2024/05/16 22:08:00 35 2024/05/16 23:57:00 23
solaris 41 82.0 2024/05/16 22:26:00 31 2024/05/16 23:55:00 41
win64 1 2.0 2024/05/17 00:25:00 23 2024/05/17 00:25:00 23
3.3.1 27 54.0 2024/05/16 22:08:00 35 2024/05/17 00:12:00 32
3.2.3 23 46.0 2024/05/16 22:06:00 76 2024/05/17 00:25:00 23

Source:

{$mode objfpc}

uses
  sysutils;

const
  Program_has_errors : boolean = false;
  exception_called   : boolean = false;
  TestNumber : longint = 10000;

procedure test_exception(const s : string);
  begin
    if not(exception_called) then
      begin
        Writeln('Exception not called : ',s);
        Program_has_errors := true;
      end;
  end;

var
   i,j : longint;
   e : extended;
   exception_count,level : longint;
begin
   j:=0;
   i:=100;
   try
   exception_called:=false;
   j := i div j;
   except
     on e : exception do
       begin
         Writeln('First integer exception called ',e.message);
         exception_called:=true;
       end;
   end;
   test_exception('First division by zero for integers');
   try
   exception_called:=false;
   j := i div j;
   except
     on e : exception do
       begin
         Writeln('Second integer exception called ',e.message);
         exception_called:=true;
       end;
   end;
   test_exception('Second division by zero for integers');
   try
   exception_called:=false;
   e:=i/j;
   except
     on e : exception do
       begin
         Writeln('First real exception called ',e.message);
         exception_called:=true;
       end;
   end;
   test_exception('First division by zero for reals');
   try
   exception_called:=false;
   e:=i/j;
   except
     on e : exception do
       begin
         Writeln('Second real exception called ',e.message);
         exception_called:=true;
       end;
   end;
   test_exception('Second division by zero for reals');
   try
   exception_called:=false;
   j := i div j;
   except
     on e : exception do
       begin
         Writeln('exception called ',e.message);
         exception_called:=true;
       end;
   end;
   test_exception('third division by zero for integers');
   exception_count:=0;
   level:=0;
   for j:=1 to TestNumber do
     begin
       try
         i:=0;
         inc(level);
         e:=j/i;
       except
         on e : exception do
           begin
             inc(exception_count);
             if level>1 then
               Writeln('exception overrun');
             dec(level);
           end;
       end;

     end;
   if exception_count<>TestNumber then
     begin
       program_has_errors:=true;
       Writeln('Could not generate ',TestNumber,' consecutive exceptions');
       Writeln('Only ',exception_count,' exceptions were generated');
     end
   else
     begin
       Writeln(TestNumber,' consecutive exceptions generated successfully');
     end;
   try
   exception_called:=false;
   i := -1;
   e := ln(i);
   except
     on e : exception do
       begin
         Writeln('exception called ',e.message);
         exception_called:=true;
       end;
   end;
   test_exception('ln(-1)');
   if program_has_errors then
     Halt(1);
end.

Link to SVN view of test/texception4.pp source.