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_evm.e < prev    next >
Encoding:
Text File  |  1996-05-02  |  1.5 KB  |  71 lines

  1. -- Part of SmallEiffel -- Read DISCLAIMER file -- Copyright (C) 
  2. -- Dominique COLNET and Suzanne COLLIN -- colnet@loria.fr
  3. --
  4. class TEST_EVM
  5.    --
  6.    -- This is a very important test for the portability 
  7.    -- of the SmallEiffel interpretor (command `eval').
  8.    -- 
  9.  
  10. creation make
  11.  
  12. feature
  13.    
  14.    evm: EVAL_VIRTUAL_MACHINE;
  15.  
  16.    make is
  17.       do
  18.      !!evm.make;
  19.      is_true(evm.stack_empty);
  20.      evm.push_integer(1);
  21.      is_true(evm.top_integer = 1);
  22.      evm.pop;
  23.      evm.push_integer(1);
  24.      is_true(evm.top_integer = 1);
  25.      evm.push_integer(-1);
  26.      is_true(evm.top_integer = -1);
  27.      evm.push_character('a');
  28.      is_true(evm.top_character = 'a');
  29.      evm.push_real(3.5);
  30.      is_true(evm.top_real = 3.5);
  31.      evm.push_boolean(true);
  32.      is_true(evm.top_boolean);
  33.      evm.push_double((7.7887).to_double);
  34.      is_true(evm.top_double = (7.7887).to_double);
  35.  
  36.      evm.push_any(Current);
  37.      is_true(evm.top_any = Current);
  38.      ----------------- TIP TOP :-)
  39.      evm.pop;
  40.      is_true(evm.top_double = (7.7887).to_double);
  41.  
  42.      evm.pop;
  43.      is_true(evm.top_boolean);
  44.      evm.pop;
  45.      is_true(evm.top_real = 3.5);
  46.      evm.pop;
  47.      is_true(evm.top_character = 'a');
  48.      evm.pop;
  49.      is_true(evm.top_integer = -1);
  50.      evm.pop;
  51.      is_true(evm.top_integer = 1);
  52.      evm.pop;
  53.      is_true(evm.stack_empty);
  54.       end;
  55.  
  56.    is_true(b: BOOLEAN) is
  57.       do
  58.      cpt := cpt + 1;
  59.      if not b then
  60.         std_output.put_string("TEST_EVM: ERROR Test # ");
  61.         std_output.put_integer(cpt);
  62.         std_output.put_string("%N");
  63.      else
  64.         -- std_output.put_string("Yes%N");
  65.      end;
  66.       end;
  67.    
  68.    cpt: INTEGER;
  69.  
  70. end -- class TEST_EVM
  71.