Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 


Quellcode-Bibliothek

© Kompilation durch diese Firma

[Weder Korrektheit noch Funktionsfähigkeit der Software werden zugesichert.]

Datei: bagtest.vdmsl   Sprache: VDM

Original von: VDM©

\section{Test of the BAG}

\begin{vdm_al}
module BAGTEST

imports from BAG all

exports all

definitions

functions 

  TestBagAll: () -> bool
  TestBagAll() ==
    let b1  = TestAdd1(),
        b2  = TestAdd2(),
        b3  = TestCount1(),
        b4  = TestCount2(),
        b5  = TestDifference(),
        b6  = TestEmpty(),
        b7  = TestIn1(),
        b8  = TestIn2(),
        b9  = TestIntersection(),
        b10 = TestJoin(),
        b11 = TestRemove1(),
        b12 = TestRemove2(),
        b13 = TestRemove3(),
        b14 = TestSeqToBag(),
        b15 = TestSize(),
        b16 = TestSubBag1(),
        b17 = TestSubBag2(),
        b18 = TestUnion()
    in
      b1 and b2 and b3 and b4 and b5 and b6 and
      b7 and b8 and b9 and b10 and b11 and b12
      and b13 and b14 and b15 and b16 and b17 
      and b18;
      
  TestAdd1: () -> bool
  TestAdd1() ==
    BAG`Add(<C>,BAG`baga) = 
    { <A> |-> 3,<B> |-> 2,<C> |-> 5 };
    
  TestAdd2: () -> bool
  TestAdd2() == 
    BAG`Add(<D>,BAG`baga) = 
    { <A> |-> 3,<B> |-> 2,<C> |-> 4,<D> |-> 1 };

  TestCount1: () -> bool
  TestCount1() ==
    BAG`Count(<D>,BAG`baga) = 0;
    
  TestCount2: () -> bool
  TestCount2() == 
    BAG`Count(<D>,BAG`bagb) = 4;

  TestDifference: () -> bool
  TestDifference() == 
    BAG`Difference(BAG`baga,BAG`bagb) = 
    { <A> |-> 2,<B> |-> 2 };

  TestEmpty: () -> bool
  TestEmpty() == 
    BAG`Empty() = { |-> };
     
  TestIn1: () -> bool
  TestIn1() ==
    BAG`In(<A>,BAG`baga);
    
  TestIn2: () -> bool
  TestIn2() ==
    not BAG`In(<D>,BAG`baga);

  TestIntersection: () -> bool
  TestIntersection() ==
    BAG`Intersection(BAG`baga,BAG`bagb) =
    { <A> |-> 1,<C> |-> 4 };

  TestJoin: () -> bool
  TestJoin() ==
    BAG`Join(BAG`baga,BAG`bagb) =
    { <A> |-> 3,<B> |-> 2,<C> |-> 5,
      <D> |-> 4,<E> |-> 1 };

  TestRemove1: () -> bool
  TestRemove1() ==
    BAG`Remove(<A>,BAG`bagb) =
    { <C> |-> 5,<D> |-> 4,<E> |-> 1 };

  TestRemove2: () -> bool
  TestRemove2() ==
    BAG`Remove(<A>,BAG`baga) =
    { <A> |-> 2,<B> |-> 2,<C> |-> 4 };

  TestRemove3: () -> bool
  TestRemove3() ==
    BAG`Remove(<D>,BAG`baga) = BAG`baga;
    
  TestSeqToBag: () -> bool
  TestSeqToBag() ==
    BAG`SeqToBag([<A>,<A>,<B>,<C>,<A>]) = 
    { <A> |-> 3,<B> |-> 1,<C> |-> 1 };
    
  TestSize: () -> bool
  TestSize() ==
    BAG`Size(BAG`baga) = 9;

  TestSubBag1: () -> bool
  TestSubBag1() ==
    not BAG`SubBag(BAG`baga,BAG`bagb);
    
  TestSubBag2: () -> bool
  TestSubBag2() ==
    BAG`SubBag({<A> |-> 2,<C> |-> 4},BAG`baga);

  TestUnion: () -> bool
  TestUnion() ==
    BAG`Union(BAG`baga,BAG`bagb) =
    { <A> |-> 4,<B> |-> 2,<C> |-> 9,
      <D> |-> 4,<E> |-> 1 }
    
end BAGTEST
\end{vdm_al}

¤ Dauer der Verarbeitung: 0.15 Sekunden  (vorverarbeitet)  ¤





Download des
Quellennavigators
Download des
sprechenden Kalenders

in der Quellcodebibliothek suchen




Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.


Bemerkung:

Die farbliche Syntaxdarstellung ist noch experimentell.


Bot Zugriff



                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Produkte
     Quellcodebibliothek

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik