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_integer1.e < prev    next >
Encoding:
Text File  |  1996-05-02  |  2.3 KB  |  119 lines

  1. -- Part of SmallEiffel -- Read DISCLAIMER file -- Copyright (C) 
  2. -- Dominique COLNET and Suzanne COLLIN -- colnet@loria.fr
  3. --
  4. class TEST_INTEGER1
  5.  
  6. creation {ANY}
  7.    make
  8.    
  9. feature {ANY}
  10.    
  11.    make is
  12.       local
  13.      i: INTEGER;
  14.       do
  15.      is_true(1 = 1);
  16.      is_true(0 = 0);
  17.      is_true(-1 = -1);
  18.      is_true(0 + 1 = 1);
  19.      is_true(1 = 1 + 0);
  20.      is_true(0 - 1 = -1);
  21.      is_true(-1 = - 1 + 0);
  22.      
  23.      is_true(2 + 2 = 4);
  24.      is_true(2 + 2 /= 3);
  25.      is_true(2 * 2 = 4);
  26.      is_true(4 = 2 * 2);
  27.      
  28.      i := 76;
  29.      is_true(76 = i);
  30.      is_true(i + 1 = 77);
  31.      is_true(76 = i);
  32.      
  33. --     is_true(9 / 2 = 4);
  34.      is_true(9 \\ 2 = 1);
  35.      
  36.      is_true(2 ^ 0 = 1);
  37.      is_true(2 ^ 1 = 2);
  38.      is_true(2 ^ 2 = 4);
  39.      is_true(2 ^ 3 = 8);
  40.      
  41.      is_true(3 ^ 0 = 1);
  42.      is_true(3 ^ 1 = 3);
  43.      is_true(3 ^ 2 = 9);
  44.      is_true(3 ^ 3 = 27);
  45.      
  46.      is_true(-3 < -1);
  47.      is_true(-1 < 0);
  48.      is_true(-1 < 1);
  49.      is_true(0 < 1);
  50.      is_true(1 < 2);
  51.  
  52.      is_true(-3 <= -1);
  53.      is_true(-3 <= -3);
  54.      is_true(-1 <= 0);
  55.      is_true(-1 <= 1);
  56.      is_true(-1 <= -1);
  57.      is_true(0 <= 1);
  58.      is_true(1 <= 2);
  59.      is_true(2 <= 2);
  60.      
  61.      is_true(not (3 <= 2));
  62.       
  63.      is_true(3 = +3);
  64.      is_true(+3 = +(1 + 2));
  65.       
  66.            is_true(-3 = 3-6);
  67.      
  68.      is_true(("0").is_equal((0).to_string));
  69.      is_true(("25").is_equal((25).to_string));
  70.      is_true(("-25").is_equal((-25).to_string));
  71.      
  72.      is_true((" 25").is_equal((25).to_string_format(3)));
  73.      is_true((" -25").is_equal((-25).to_string_format(4)));
  74.  
  75.      is_true('0' = (0).digit);
  76.      is_true('5' = (5).digit);
  77.      is_true('9' = (9).digit);
  78.       
  79.            is_true(' ' = (32).to_character);
  80.      
  81.      is_true((-25).abs = 25);
  82.      is_true((25).abs = 25);
  83.      
  84.      is_true((3).max(4) = 4);
  85.      is_true((4).max(3) = 4);
  86.       
  87.      is_true((3).min(4) = 3);
  88.      is_true((4).min(3) = 3);
  89.       
  90.      is_true((-2).min(2) = -2);
  91.      is_true((2).max(-2) = 2);
  92.       
  93.      is_true((0).to_octal = 0);
  94.      is_true((7).to_octal = 7);
  95.      is_true((8).to_octal = 10);
  96.      is_true((9).to_octal = 11);
  97.      is_true((-10).to_octal = -12);
  98.      is_true(400 = (256).to_octal);
  99.      is_true(-400 = (-256).to_octal);
  100.      is_true(377 = (255).to_octal);
  101.      is_true(177 = (127).to_octal);
  102.       end;
  103.    
  104.    is_true(b: BOOLEAN) is
  105.       do
  106.      cpt := cpt + 1;
  107.      if not b then
  108.         std_output.put_string("TEST_INTEGER1: ERROR Test # ");
  109.         std_output.put_integer(cpt);
  110.         std_output.put_string("%N");
  111.      else
  112.         -- std_output.put_string("Yes%N");
  113.      end;
  114.       end;
  115.    
  116.    cpt: INTEGER;
  117.    
  118. end -- TEST_INTEGER1
  119.