home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / eiffel / smalleif.97 / se.t / SmallEiffel / lib_test / test_array.e < prev    next >
Encoding:
Text File  |  1996-05-02  |  1.6 KB  |  80 lines

  1. -- Part of SmallEiffel -- Read DISCLAIMER file -- Copyright (C) 
  2. -- Dominique COLNET and Suzanne COLLIN -- colnet@loria.fr
  3. --
  4. class TEST_ARRAY
  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, false>>;
  24.      is_true(1 = t_boolean.index_of(true));
  25.      is_true(1 = t_boolean.fast_index_of(true));
  26.      is_true(2 = t_boolean.index_of(false));
  27.      is_true(2 = t_boolean.fast_index_of(false));
  28.       
  29.      is_true(equal(<<1,2,3>>,<<1,2,3>>));
  30.      
  31.      is_true(equal(<<'a','b','c'>>,<<'a','b','c'>>));
  32.      
  33. -- ???     is_true(equal(<<1.5,2.5,3.>>,<<1.5,2.5,3.>>));
  34.      
  35.      t_integer := <<1,2>>;
  36.      t_real := <<1.,2.>>;
  37. -- ????     is_true(equal(t_real,t_integer));
  38.       
  39.      !!cat;
  40.      t_any := <<cat,cat>>;
  41.      t_animal := <<cat,cat>>;
  42.      
  43.      is_true(equal(t_any,t_animal));
  44.      t_any.put(Void,1);
  45.      t_animal.put(Void,1);
  46.      is_true(equal(t_any,t_animal));
  47.      t_animal.put(cat,1);
  48.      is_true(not equal(t_any,t_animal));
  49.      
  50.      !!dog;
  51.      t_any.put(dog,1);
  52.      t_animal.put(dog,1);
  53.      is_true(equal(t_any,t_animal));
  54.      
  55.      
  56. --     !!cat;
  57. --     !!dog;
  58. --     t_any := <<cat,dog>>;
  59. --     t_animal := <<cat,dog>>;
  60. --     is_true(equal(t_any,t_animal));
  61.      
  62.      
  63.       end;
  64.    
  65.    is_true(b: BOOLEAN) is
  66.       do
  67.      cpt := cpt + 1;
  68.      if not b then
  69.         std_output.put_string("TEST_ARRAY: ERROR Test # ");
  70.         std_output.put_integer(cpt);
  71.         std_output.put_string("%N");
  72.      else
  73.         --std_output.put_string("Yes%N");
  74.      end;
  75.       end;
  76.    
  77.    cpt: INTEGER;
  78.    
  79. end -- TEST_ARRAY
  80.