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_recursive_once.e < prev    next >
Encoding:
Text File  |  1996-05-02  |  1.1 KB  |  61 lines

  1. -- Part of SmallEiffel -- Read DISCLAIMER file -- Copyright (C) 
  2. -- Dominique COLNET and Suzanne COLLIN -- colnet@loria.fr
  3. --
  4. class TEST_RECURSIVE_ONCE
  5.  
  6. creation {ANY}
  7.    make
  8.    
  9. feature {ANY}
  10.    
  11.    proc1val: INTEGER;
  12.    
  13.    proc1 is
  14.       once
  15.      proc1;
  16.      proc1val := proc1val + 1;
  17.       end;
  18.    
  19.    fonc1: INTEGER is
  20.       once
  21.      Result := fonc1;
  22.      Result := Result + 1;
  23.       end;
  24.    
  25.    crossf1: INTEGER is
  26.       once
  27.      Result := 3 + crossf2;
  28.       end;
  29.    
  30.    crossf2: INTEGER is
  31.       once
  32.      Result := 2 + crossf1;
  33.       end;
  34.    
  35.    make is
  36.       do
  37.      proc1;
  38.      is_true(proc1val = 1);
  39.      is_true(fonc1 = fonc1);
  40.      is_true(fonc1 = 1);
  41.      is_true(crossf1 = 3 or crossf1 = 5);
  42.      -- What to think of this crazy call :-) 
  43.      -- It is not really clear in E.T.L. :-(
  44.       end;
  45.    
  46.    is_true(b: BOOLEAN) is
  47.       do
  48.      cpt := cpt + 1;
  49.      if not b then
  50.         std_output.put_string("TEST_RECURSIVE_ONCE: ERROR Test # ");
  51.         std_output.put_integer(cpt);
  52.         std_output.put_string("%N");
  53.      else
  54.         -- std_output.put_string("Yes%N");
  55.      end;
  56.       end;
  57.    
  58.    cpt: INTEGER;
  59.    
  60. end -- TEST_RECURSIVE_ONCE
  61.