home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Environments / SmallEiffel 0.3.3 / SmallEiffel 68k / lib_test / test_array_add_last1.e < prev    next >
Encoding:
Text File  |  1996-06-13  |  1.2 KB  |  73 lines  |  [TEXT/EDIT]

  1. -- Part of SmallEiffel -- Read DISCLAIMER file -- Copyright (C) 
  2. -- Dominique COLNET and Suzanne COLLIN -- colnet@loria.fr
  3. --
  4. class TEST_ARRAY_ADD_LAST
  5.  
  6. creation {ANY}
  7.    make
  8.    
  9. feature {ANY}
  10.  
  11.    t_boolean: ARRAY[BOOLEAN];
  12.    t_integer: ARRAY[INTEGER];
  13.    t_animal: ARRAY[ANIMAL];
  14.    t_real: ARRAY[REAL];
  15.    t_any: ARRAY[ANY];
  16.         
  17.    make is
  18.       local
  19.      i: INTEGER;
  20.      cat: CAT;
  21.      dog: DOG;
  22.       do
  23.      t_boolean := <<true>>;
  24.      from
  25.         i := 1;
  26.      until
  27.         i = 100
  28.      loop
  29.         i := i + 1;
  30.         t_boolean.add_last(true);
  31.         is_true(t_boolean.nb_occurrences(true) = i);
  32.      end;
  33.  
  34.      t_integer := <<56>>;
  35.      from
  36.         i := 1;
  37.      until
  38.         i = 100
  39.      loop
  40.         i := i + 1;
  41.         t_integer.add_last(56);
  42.         is_true(t_integer.nb_occurrences(56) = i);
  43.      end;
  44.  
  45.      !!cat;
  46.      t_animal := <<cat>>;
  47.      from
  48.         i := 1;
  49.      until
  50.         i = 100
  51.      loop
  52.         i := i + 1;
  53.         t_animal.add_last(cat);
  54.         is_true(t_animal.nb_occurrences(cat) = i);
  55.      end;
  56.       end;
  57.    
  58.    is_true(b: BOOLEAN) is
  59.       do
  60.      cpt := cpt + 1;
  61.      if not b then
  62.         std_output.put_string("TEST_ARRAY_ADD_LAST: ERROR Test # ");
  63.         std_output.put_integer(cpt);
  64.         std_output.put_string("%N");
  65.      else
  66.         -- std_output.put_string("Yes%N");
  67.      end;
  68.       end;
  69.    
  70.    cpt: INTEGER;
  71.    
  72. end -- TEST_ARRAY_ADD_LAST
  73.