comp.lang.ada
 help / color / mirror / Atom feed
From: "Frédéric PRACA" <frederic.praca@free.fr>
Subject: Re: [Spark] Proving GCD
Date: Fri, 17 Mar 2017 02:33:07 -0700 (PDT)
Date: 2017-03-17T02:33:07-07:00	[thread overview]
Message-ID: <eaf03e7d-a2dd-4490-9156-3a25c32634eb@googlegroups.com> (raw)
In-Reply-To: <58caf52b$0$24793$426a74cc@news.free.fr>

Le jeudi 16 mars 2017 21:27:24 UTC+1, Frédéric PRACA a écrit :
> Hi guys,

Here is the new version of the contract
function gcd (A : Natural; B : Positive) return Natural
     with
       Global => null,
       Depends => (gcd'Result => (A,B)),
       Post =>  A mod gcd'Result = 0 
       and B mod gcd'Result = 0 
       and ((A > 0 and then gcd'Result <= A) OR (A = 0 and then gcd'result = B));

It was tested with the following code
Pragma SPARK_Mode;

with Ada.text_io; use Ada.text_io;
with GCD_Package; use GCD_Package;

procedure TestGCD is

begin
   Put_line ("GCD (420, 252) = " & Integer'Image(gcd(a => 420,
                                                     b => 252)));
   
   Put_line ("GCD (512, 252) = " & Integer'Image(gcd(a => 512,
                                                     b => 252)));
   
   Put_line ("GCD (1, 1) = " & Integer'Image(gcd(a => 1,
                                                 b => 1)));
   
   Put_line ("GCD (0, 1) = " & Integer'Image(gcd(a => 0,
                                                 b => 1)));
end TestGCD;

And I still have the same message from Spark. Any idea ?

  reply	other threads:[~2017-03-17  9:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-16 20:27 [Spark] Proving GCD Frédéric Praca
2017-03-17  9:33 ` Frédéric PRACA [this message]
2017-03-17 13:00   ` Phil Thornley
2017-03-17 13:24     ` Frédéric PRACA
2017-03-17 13:28       ` Frédéric PRACA
2017-03-17 17:16         ` Phil Thornley
  -- strict thread matches above, loose matches on Subject: below --
2017-03-16 20:31 Frédéric Praca
2017-03-17  1:20 ` Brian Kolden
2017-03-17  9:07   ` Frédéric PRACA
2017-04-05 23:52 ` moy
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox