From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,93a8020cc980d113 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!proxad.net!proxad.net!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: What is wrong with Ada? Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <1176150704.130880.248080@l77g2000hsb.googlegroups.com> <461B52A6.20102@obry.net> <461BA892.3090002@obry.net> <82dgve.spf.ln@hunter.axlog.fr> <1176226291.589741.257600@q75g2000hsh.googlegroups.com> <4eaive.6p9.ln@hunter.axlog.fr> Date: Thu, 12 Apr 2007 21:39:40 +0200 Message-ID: <1rbtw92apxpl1.1ednvo8v6oiq8$.dlg@40tude.net> NNTP-Posting-Date: 12 Apr 2007 21:38:51 CEST NNTP-Posting-Host: c43b7b2d.newsspool4.arcor-online.net X-Trace: DXC=:MXjFe1>W4gPXlQ;h]GTMd4IUKVWQBH`Zb X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:14958 Date: 2007-04-12T21:38:51+02:00 List-Id: On Thu, 12 Apr 2007 14:47:19 -0400, Robert A Duff wrote: > Brian May writes: > >>...The only way you can >> be sure the code is bug free is too regularly test every possible >> path, ... > > Well, yeah, static checking is helpful, but I think you overstate the > case: > > There is no way to be sure the code is bug free! Not in any language. > Not using testing, nor any other method (including so-called > proof of correctness). > > Testing every possible path is not enough. Here's a function that > detects prime numbers (except that it has a bug): > > function Is_Prime (X: Integer) return Boolean is > -- Returns True if and only if X is prime. > begin > if X = 2 then > return True; > else > return False; > end if; > end Is_Prime; > > If I test with inputs 2 and 4, it gives the right answer for both, > and I have covered all paths. But I have failed to detect the bug. Tests should cover all program states. Covering all paths is a rough approximation of. > And it is impossible to cover all paths in a program containing > unbounded loops or recursion, because there are an infinite number of > them. But the number of program states is finite, or else the program is wrong anyway? However the inputs and outputs of a program can be infinite, uncountable, like hardware random generators or clocks. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de