[GAP] design by contract

Dick Gayler dgayler at kennesaw.edu
Wed Aug 10 21:46:01 CEST 2011


I am hoping to use Ada in a design by contract class this fall however I 
am having problems getting "it" to work.  The following is a simple example:

> with Ada.Text_IO, Ada.Integer_Text_IO;
> use Ada.Text_IO, Ada.Integer_Text_IO;
>
> procedure Test_Stack is
>
>    a, b, value: Integer;
>
>    function div (num, denom: in Integer) return Integer is
>    pragma Precondition (denom /= 0);
>    begin
>       return num / denom;
>    end div;
>
> begin
>    a := -3;
>    b := 0;
>    value := div (a, b);
>    put (value);
>    new_line;
>
> end Test_Stack;

This file is compiled using the -gnatA switch but the precondition is 
not executing.  Any help would be appreciated.

Thank you.

-- 
Dick Gayler
Professor
Department of Computer Science and Information Systems
Kennesaw State University
1000 Chastain Road
Building 11, Room 3039
Kennesaw, GA 30144
office: 770-423-6099
Google Voice 678-273-2129
fax 770-302-4415



More information about the GAP mailing list