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_character.e < prev    next >
Encoding:
Text File  |  1996-05-02  |  1.8 KB  |  87 lines

  1. -- Part of SmallEiffel -- Read DISCLAIMER file -- Copyright (C) 
  2. -- Dominique COLNET and Suzanne COLLIN -- colnet@loria.fr
  3. --
  4. class TEST_CHARACTER
  5. -- 
  6. -- Test CHARACTER / CHARACTER_REF
  7. --
  8. creation {ANY}
  9.    make
  10.    
  11. feature {ANY}
  12.    
  13.    make is
  14.       local
  15.      cr: CHARACTER_REF;
  16.      a: ANY;
  17.      aa: ARRAY[ANY];
  18.       do
  19.      is_true('a' = 'a');
  20.      is_true('a' < 'b');
  21.      is_true('a' <= 'b');
  22.      is_true('b' <= 'b');
  23.      is_true(('a').to_upper = 'A');
  24.      is_true(('z').to_upper = 'Z');
  25.      is_true(('+').to_upper = '+');
  26.      
  27.      is_true(('A').to_lower = 'a');
  28.      is_true(('Z').to_lower = 'z');
  29.      is_true(('+').to_lower = '+');
  30.      
  31.      is_true(('0').is_digit);
  32.      is_true(('1').is_digit);
  33.      is_true(('2').is_digit);
  34.      is_true(('3').is_digit);
  35.      is_true(('4').is_digit);
  36.      is_true(('5').is_digit);
  37.      is_true(('6').is_digit);
  38.      is_true(('7').is_digit);
  39.      is_true(('8').is_digit);
  40.      is_true(('9').is_digit);
  41.      is_true(not ('x').is_digit);
  42.      
  43.      is_true(('0').value = 0);
  44.      is_true(('1').value = 1);
  45.      is_true(('2').value = 2);
  46.      is_true(('3').value = 3);
  47.      is_true(('4').value = 4);
  48.      is_true(('5').value = 5);
  49.      is_true(('6').value = 6);
  50.      is_true(('7').value = 7);
  51.      is_true(('8').value = 8);
  52.      is_true(('9').value = 9);
  53.  
  54.      is_true(('a').code = 97);
  55.      is_true(('z').code = 122);
  56.      is_true(('A').code = 65);
  57.      is_true(('Z').code = 90);
  58.      
  59.      cr := 'x';
  60.      is_true(cr.item = 'x');
  61.      a := 'x';
  62.      is_true(equal(a,cr));
  63.      is_true(equal(cr,'x'));
  64.      is_true(equal(a,'x'));
  65.      
  66.      !!aa.make(1,1);
  67.      aa.put('a',1);
  68.      is_true(equal(aa.item(1),'a'));
  69.      --  **** A FAIRE *** is_true(26 = aa.item(1));
  70.       end;
  71.    
  72.    is_true(b: BOOLEAN) is
  73.       do
  74.      cpt := cpt + 1;
  75.      if not b then
  76.         std_output.put_string("TEST_CHARACTER: ERROR Test # ");
  77.         std_output.put_integer(cpt);
  78.         std_output.put_string("%N");
  79.      else
  80.         --std_output.put_string("Yes%N");
  81.      end;
  82.       end;
  83.    
  84.    cpt: INTEGER;
  85.    
  86. end -- TEST_CHARACTER
  87.