Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/Isabelle/Pure/System/   (Beweissystem Isabelle Version 2025-1©)  Datei vom 16.11.2025 mit Größe 4 kB image not shown  

Impressum MapT.vdmpp   Sprache: VDM

 
class MapT is subclass of TestDriver
functions
public tests : () -> seq of TestCase
tests() == 
 [ 
 new MapT01(), new MapT02() 
 ];
end MapT
----------------------------------------------------
class MapT01 is subclass of TestCase, CommonDefinition
operations 
protected test: () ==> bool
test() == 
 let m1 = {1 |-> "Kei Sato", 19 |-> "Shin Sahara", 20 |-> "Hiroshi Sakoh"},
  m2 = {"Kei Sato" |-> 1,  "Shin Sahara" |-> 19,  "Hiroshi Sakoh" |-> 20},
  get1 = Map`Get[intseq of char],
  get2 = Map`Get[seq of charint]
 in
 return 
  get1(m1)(19) = "Shin Sahara" and
  get1(m1)(2) = nil and
  get2(m2)("Shin Sahara") = 19 and
  get2(m2)("Worst Prime Minister Koizumi") = nil
;
protected setUp: () ==> ()
setUp() == TestName := "MapT01:\tTest of Get function.";
protected tearDown: () ==> ()
tearDown() == return;
end MapT01
----------------------------------------------------
class MapT02 is subclass of TestCase, CommonDefinition
operations 
protected test: () ==> bool
test() == 
 let m1 = {1 |-> "Kei Sato", 19 |-> "Shin Sahara", 20 |-> "Hiroshi Sakoh"},
  m2 = {"Kei Sato" |-> 1,  "Shin Sahara" |-> 19,  "Hiroshi Sakoh" |-> 20},
  c1 = Map`Contains[intseq of char],
  k1 = Map`ContainsKey[intseq of char],
  c2 = Map`Contains[seq of charint],
  k2 = Map`ContainsKey[seq of charint]
 in
 return 
  c1(m1)("Kei Sato"and c1(m1)("Shin Sahara"and c1(m1)("Hiroshi Sakoh"and
  c1(m1)("Worst Prime Minister Koizumi") = false and
  k1(m1)(1) and k1(m1)(19) and k1(m1)(20) and
  not k1(m1)(99) and
  c2(m2)(1) and c2(m2)(19) and c2(m2)(20) and
  c2(m2)(30) = false and
  k2(m2)("Kei Sato"and k2(m2)("Shin Sahara"and k2(m2)("Hiroshi Sakoh"and
  k2(m2)("Worst Prime Minister Koizumi") = false
;
protected setUp: () ==> ()
setUp() == TestName := "MapT02:\tTest of Contains related functions.";
protected tearDown: () ==> ()
tearDown() == return;
end MapT02

100%


¤ Dauer der Verarbeitung: 0.13 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

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.