[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: kdebase: L.h, Q.h, etc. defining macros like A, I, etc.
From:       Mirko Sucker <mirko.sucker () unibw-hamburg ! de>
Date:       2000-01-25 17:49:36
[Download RAW message or body]

David Faure wrote:
> ...
Here is the missing example:

--------

#include <knana.h>
#include <qarray.h>
 
int main()
{
  const int Values[]= { 0, 9, 8, 7, 6, 5, 4, 3, 2, 1
  };
  const int Size=sizeof(Values)/sizeof(Values[0]);
  int count;
  QArray<int> array(Size);
  // -----
  for(count=0; count<Size; ++count)
    {
      array[count]=Values[count];
    }
  // evaluate: there may be no member in array that is larger than 9:
  // I(..) is an invariant (may never be false)
  // A(..) is forall ..
  I(A(int i=0, i<Size, ++i, array[i]<10));
  // now a test that fails:
  // E(..) is at least one ..
  // means: at least one element > 9 must Exist
  I(E(int i=0, i<Size, ++i, array[i]>9));
  return 0;
}    

---------

I think tests of this kind would make looking for spooky bugs easier.
What do you say?
Greetings,
--Mirko.                                                                              \
                
-- 
Denn der  Mensch  liebt und ehrt den  Menschen,  solange er ihn
nicht zu beurteilen vermag, und die Sehnsucht ist ein Erzeugnis
mangelhafter Erkenntnis. (Thomas Mann)


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic