/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * This file is part of SableVM.                             *
 * See the file "LICENSE" for Copyright information and the  *
 * terms and conditions for copying, distribution and        *
 * modification of SableVM.                                  *
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

/* m4svm_file_name */

m4svm_define_begin v = ":], [:m4svm_BytecodeVerificationTest_header:])";

public class BytecodeVerificationTest
{
  // Lenght of all the array type variable
  private final int arrayLength = 6;

  private SVMTestInlinabilityOfBytecodes zeTest =
    new SVMTestInlinabilityOfBytecodes();
  private SVMTestInlinabilityBytecodeVerificationFields zeFields =
    new SVMTestInlinabilityBytecodeVerificationFields();

  private final boolean boolean_False = false;
  private final boolean boolean_True = true;
  private final byte byte_0 = 0;
  private final byte byte_1 = 1;
  private final char char_0 = 0;
  private final char char_1 = 1;
  private final double double_minus_1 = -1.0;
  private final double double_0 = 0.0;
  private final double double_1 = 1.0;
  private final float float_minus_1 = -1.0f;
  private final float float_0 = 0.0f;
  private final float float_1 = 1.0f;
  private final int int_minus_1 = -1;
  private final int int_0 = 0;
  private final int int_1 = 1;
  private final long long_minus_1 = -1;
  private final long long_0 = 0;
  private final long long_1 = 1;
  private Object anObject;
  private Object anotherObject;
  private final short short_0 = 0;
  private final short short_1 = 1;
  private boolean[] aBooleanArray = new boolean[arrayLength];
  private byte[] aByteArray = new byte[arrayLength];
  private char[] aCharArray = new char[arrayLength];
  private double[] double1Array = new double[arrayLength];
  private float[] float1Array = new float[arrayLength];
  private int[] int1Array = new int[arrayLength];
  private long[] long1Array = new long[arrayLength];
  private Object[] anObjectArray = new Object[arrayLength];
  private short[] aShortArray = new short[arrayLength];
  
  m4svm_define_end = ":])";


  m4svm_define_begin v = ":], [:m4svm_setUp_method:])";
  
  protected void setUp()
  {
    anObject = new Object();
    anotherObject = new Object();

    for(int i=0; i<arrayLength; i++)
    {
      aBooleanArray[i] = boolean_True;
      aByteArray[i] = byte_0;
      aCharArray[i] = char_0;
      double1Array[i] = double_0;
      float1Array[i] = float_0;
      int1Array[i] = int_0;
      long1Array[i] = long_0;
      anObjectArray[i] = new Object();
      aShortArray[i] = short_0;
    }
  }

  m4svm_define_end = ":])";


  m4svm_define_begin v = ":], [:m4svm_main_method:])";

  public static void main (String args[])
  {
    new BytecodeVerificationTest().doIt();
  }

  m4svm_define_end = ":])";

 
  m4svm_define_begin v = ":], [:m4svm_utils_methods:])";
  
  void fail(String s) {
    System.out.println(s);
  };

  void assertEquals(String s, Object o1, Object o2) {
    if (o1 != o2) fail(s);
  };

  void assertEquals(String s, int o1, int o2) {
    if (o1 != o2) fail(s);
  };
  
  void assertEquals(String s, float o1, float o2) {
    if (o1 != o2) fail(s);
  };
  
  void assertEquals(String s, long o1, long o2) {
    if (o1 != o2) fail(s);
  };
  
  void assertEquals(String s, boolean o1, boolean o2) {
    if (o1 != o2) fail(s);
  };
  
  void assertEquals(String s, double o1, double o2) {
    if (o1 != o2) fail(s);
  };
  
  void assertEquals(String s, double o1, double o2, double o3) {
    if (o1 != o2) fail(s);
  };

  void assertTrue(boolean o1) {};

  void assertTrue(String s, boolean o1) {
    if (!o1) fail(s);
  };

  m4svm_define_end = ":])";
  

  void dummy() {

  /////////////////////////////// m4svm_test_equal ////
  // $1 - instruction name
  // $2 - result expected
  // $3 - params given to test method
  // $4 - extra text put into error message (use m4svm_test_equal_comment !)
  // $5 - extra suffix to called method name

    m4svm_define_begin v = ":], [:m4svm_test_equal:])";

    try
    {
      assertEquals("$1 failed when given $3 $4",
	  zeTest.svmTestBytecode_$1$5$3,
	  $2);
    }
    catch (Throwable e)
    {
      System.out.println("EXCEPTION1: " + e + " $1 failed when given $3 $4" );
    }
    m4svm_define_end = ":])";

  /////////////////////////////// m4svm_test_run ////
  // $1 - instruction name
  // $2 - params given to test method

    m4svm_define_begin v = ":], [:m4svm_test_run:])";

    try
    {
      zeTest.svmTestBytecode_$1$2;
    }
    catch (Throwable e)
    {
      System.out.println("EXCEPTION2: " + e + " $1 failed when given $2" );
    }
    m4svm_define_end = ":])";

  /////////////////////////////// m4svm_test_exception ////
  // $1 - instruction name
  // $2 - exception expected
  // $3 - params given to test method
  // $4 - extra text put into error message (use m4svm_test_exception_comment !)

    m4svm_define_begin v = ":], [:m4svm_test_exception:])";

    try
    {
      zeTest.svmTestBytecode_$1$3;
      fail("EXCEPTION3 MISSING: $1 should have thrown $2 when given $3 $4");
    }
    catch ($2 exception_expected) { }
    catch (Throwable e)
    {
      System.out.println("EXCEPTION4: " + e + " $1 failed when given $3 $4" );
    }
    m4svm_define_end = ":])";

  /////////////////////////////// m4svm_test_exception_comment ////
  // $4 - extra text appended to error message

    m4svm_define_begin v = ":], [:m4svm_test_exception_comment:])";
    m4svm_test_exception($1, $2, $3, " + $4 + ")
    m4svm_define_end = ":])";

  /////////////////////////////// m4svm_test_true_func ////
  // $1 - instruction name
  // $2 - function to call, returning true if OK
  // $3 - params given to test method
    m4svm_define_begin v = ":], [:m4svm_test_true_func:])";

    try
    {
      assertTrue("$1 failed when given $3, $2 checked result and returned false",
	  $2(zeTest.svmTestBytecode_$1$3));
    }
    catch (Throwable e)
    {
      System.out.println("EXCEPTION5: " + e + " $1 failed when given $3" );
    }
    m4svm_define_end = ":])";

  /////////////////////////////// m4svm_test_instanceof ////
  // $1 - instruction name
  // $2 - instance expected
  // $3 - params given to test method

    m4svm_define_begin v = ":], [:m4svm_test_instanceof:])";

    try
    {
      assertEquals("$1 failed to instantiate $2 when given $3 ",
	  zeTest.svmTestBytecode_$1$3 instanceof $2, true);
    }
    catch (Throwable e)
    {
      System.out.println("EXCEPTION6: " + e
	      + " $1 failed while trying to instantiate $2 when given $3" );
    }
    m4svm_define_end = ":])";

  /////////////////////////////// m4svm_test_equal_comment ////
  // $4 - extra text appended to error message

    m4svm_define_begin v = ":], [:m4svm_test_equal_comment:])";
    m4svm_test_equal($1, $2, $3, " + $4 + ")
    m4svm_define_end = ":])";

  /////////////////////////////// m4svm_test_equal_twomod ////

    m4svm_define_begin v = ":], [:m4svm_test_equal_twomod:])";
    m4svm_test_equal_comment($1, $2, $3,
		    "(probably SLOW version)");
    m4svm_test_equal_comment($1, $2, $3,
		    "(probably FAST version)");
    m4svm_define_end = ":])";

  /////////////////////////////// m4svm_test_Xload_std ////
  // $1 - method name suffix (ex. ALoad)
  // $2 - instruction group name (ex. aload)
  // $3 - "good" object (ex. anObject)
  // $4 - "bad" object (ex. anotherObject)
    m4svm_define_begin v = ":], [:m4svm_test_Xload_std:])";

    public void test$1()
    {
      m4svm_test_equal($2,   $3, ($4, $4, $4, $4, $3));
      m4svm_test_equal($2_0, $3, ($3));
      m4svm_test_equal($2_1, $3, ($4, $3));
      m4svm_test_equal($2_2, $3, ($4, $4, $3));
      m4svm_test_equal($2_3, $3, ($4, $4, $4, $3));
    }

    m4svm_define_end = ":])";

  /////////////////////////////// m4svm_test_Xload_big ////
  // $1 - method name suffix (ex. DLoad)
  // $2 - instruction group name (ex. dload)
  // $3 - "good" object (ex. double_1)
  // $4 - "bad" object big (ex. double_0)
  // $5 - "bad" object small (ex. int_0)
    m4svm_define_begin v = ":], [:m4svm_test_Xload_big:])";

    public void test$1()
    {
      m4svm_test_equal($2,   $3, ($4, $4, $3));
      m4svm_test_equal($2_0, $3, ($3));
      m4svm_test_equal($2_1, $3, ($5, $3));
      m4svm_test_equal($2_2, $3, ($4, $3));
      m4svm_test_equal($2_3, $3, ($5, $4, $3));
    }

    m4svm_define_end = ":])";

  /////////////////////////////// m4svm_test_wide_Xload_std ////
  // $1 - method name suffix (ex. ALoad)
  // $2 - instruction group name (ex. aload)
  // $3 - "good" object (ex. anObject)
  // $4 - "bad" object (ex. anotherObject)
    m4svm_define_begin v = ":], [:m4svm_test_wide_Xload_std:])";

    public void test$1()
    {
      m4svm_test_equal($2,   $3, ($3));
      m4svm_test_equal($2_0, $3, ($3));
      m4svm_test_equal($2_1, $3, ($4, $3));
      m4svm_test_equal($2_2, $3, ($4, $4, $3));
      m4svm_test_equal($2_3, $3, ($4, $4, $4, $3));
    }

    m4svm_define_end = ":])";

  /////////////////////////////// m4svm_test_wide_Xload_big ////
  // $1 - method name suffix (ex. DLoad)
  // $2 - instruction group name (ex. dload)
  // $3 - "good" object (ex. double_1)
  // $4 - "bad" object big (ex. double_0)
  // $5 - "bad" object small (ex. int_0)
    m4svm_define_begin v = ":], [:m4svm_test_wide_Xload_big:])";

    public void test$1()
    {
      m4svm_test_equal($2,   $3, ($3));
      m4svm_test_equal($2_0, $3, ($3));
      m4svm_test_equal($2_1, $3, ($5, $3));
      m4svm_test_equal($2_2, $3, ($4, $3));
      m4svm_test_equal($2_3, $3, ($5, $4, $3));
    }

    m4svm_define_end = ":])";

  /////////////////////////////// m4svm_test_Xstore_std ////
  // $1 - method name suffix (ex. AStore)
  // $2 - instruction group name (ex. astore)
  // $3 - "good" object (ex. anObject)
  // $4 - "bad" object (ex. anotherObject)
    m4svm_define_begin v = ":], [:m4svm_test_Xstore_std:])";

    public void test$1()
    {
      m4svm_test_equal($2,   $3, ($3));
      m4svm_test_equal($2_0, $3, ($4, $3));
      m4svm_test_equal($2_1, $3, ($3));
      m4svm_test_equal($2_2, $3, ($3));
      m4svm_test_equal($2_3, $3, ($3));
    }

    m4svm_define_end = ":])";
    
  /////////////////////////////// m4svm_test_Xstore_big ////
  // $1 - method name suffix (ex. DStore)
  // $2 - instruction group name (ex. dstore)
  // $3 - "good" object (ex. double_1)
  // $4 - "bad" object big (ex. double_0)
  // $5 - "bad" object small (ex. int_0)
    m4svm_define_begin v = ":], [:m4svm_test_Xstore_big:])";

    public void test$1()
    {
      m4svm_test_equal($2,   $3, ($3));
      m4svm_test_equal($2_0, $3, ($4, $3));
      m4svm_test_equal($2_1, $3, ($5, $4, $3));
      m4svm_test_equal($2_2, $3, ($3));
      m4svm_test_equal($2_3, $3, ($3));
    }

    m4svm_define_end = ":])";
   
  /////////////////////////////// m4svm_test_Xadd ////
  // $1 - method name suffix (ex. DADD)
  // $2 - instruction name (ex. dadd)
  // $3 - type class (ex. Double)
  // $4 - type prefix (ex. double)
  // $5 - type letter if any (ex. d or f)
    m4svm_define_begin v = ":], [:m4svm_test_Xadd:])";

    public void test$1()
    {
      m4svm_test_equal($2, 2.0$5, ($4_1, $4_1));
      m4svm_test_equal($2, $4_0, ($4_1, $4_minus_1));
      m4svm_test_true_func($2, $3.isInfinite, ($4_1, $3.POSITIVE_INFINITY));
      m4svm_test_true_func($2, $3.isNaN, ($4_1, $3.NaN));
      m4svm_test_true_func($2, $3.isInfinite, ($3.POSITIVE_INFINITY, $4_1));
      m4svm_test_true_func($2, $3.isInfinite, ($3.POSITIVE_INFINITY, $3.POSITIVE_INFINITY));
      m4svm_test_true_func($2, $3.isNaN, ($3.NEGATIVE_INFINITY, $3.POSITIVE_INFINITY));
      m4svm_test_true_func($2, $3.isNaN, ($3.POSITIVE_INFINITY, $3.NaN));
      m4svm_test_true_func($2, $3.isNaN, ($3.NaN, $4_1));
      m4svm_test_true_func($2, $3.isNaN, ($3.NaN, $3.POSITIVE_INFINITY));
      m4svm_test_true_func($2, $3.isNaN, ($3.NaN, $3.NaN));
      m4svm_test_equal($2, $4_0, ($4_0, -0.0$5));
    }

    m4svm_define_end = ":])";

  /////////////////////////////// m4svm_test_Xsub ////
  // $1 - method name suffix (ex. DSUB)
  // $2 - instruction name first char (ex. d)
  // $3 - type class (ex. Double)
  // $4 - type prefix (ex. double)
    m4svm_define_begin v = ":], [:m4svm_test_Xsub:])";

    public void test$1()
    {
      m4svm_test_equal($2sub, $4_minus_1, ($4_0, $4_1));
      m4svm_test_equal($2sub, $4_0, ($4_1, $4_1));
      m4svm_test_true_func($2sub, $3.isInfinite, ($4_1, $3.POSITIVE_INFINITY));
      m4svm_test_true_func($2sub, $3.isNaN, ($4_1, $3.NaN));
      m4svm_test_true_func($2sub, $3.isInfinite, ($3.POSITIVE_INFINITY, $4_1));
      m4svm_test_true_func($2sub, $3.isNaN, ($3.POSITIVE_INFINITY, $3.POSITIVE_INFINITY));
      m4svm_test_true_func($2sub, $3.isInfinite, ($3.NEGATIVE_INFINITY, $3.POSITIVE_INFINITY));
      m4svm_test_true_func($2sub, $3.isNaN, ($3.POSITIVE_INFINITY, $3.NaN));
      m4svm_test_true_func($2sub, $3.isNaN, ($3.NaN, $4_1));
      m4svm_test_true_func($2sub, $3.isNaN, ($3.NaN, $3.POSITIVE_INFINITY));
      m4svm_test_true_func($2sub, $3.isNaN, ($3.NaN, $3.NaN));
    }

    m4svm_define_end = ":])";
   
  /////////////////////////////// m4svm_test_Xmul ////
  // $1 - method name suffix (ex. DMUL)
  // $2 - instruction name (ex. dmul)
  // $3 - type class (ex. Double)
  // $4 - type prefix (ex. double)
  // $5 - type letter if any (ex. d or f)
    m4svm_define_begin v = ":], [:m4svm_test_Xmul:])";

    public void test$1()
    {
      m4svm_test_equal($2, 1.0, ($4_1, $4_1));
      m4svm_test_equal($2, $4_0, ($4_1, $4_0));
      m4svm_test_true_func($2, $3.isInfinite, ($4_1, $3.POSITIVE_INFINITY));
      m4svm_test_true_func($2, $3.isNaN, ($4_1, $3.NaN));
      m4svm_test_equal($2, $4_0, ($4_0, $4_1));
      m4svm_test_equal($2, $4_0, ($4_0, $4_0));
      m4svm_test_true_func($2, $3.isNaN, ($4_0, $3.POSITIVE_INFINITY));
      m4svm_test_true_func($2, $3.isNaN, ($4_0, $3.NaN));
      m4svm_test_true_func($2, $3.isInfinite, ($3.POSITIVE_INFINITY, $4_1));
      m4svm_test_true_func($2, $3.isNaN, ($3.POSITIVE_INFINITY, $4_0));
      m4svm_test_true_func($2, $3.isInfinite, ($3.POSITIVE_INFINITY, $3.POSITIVE_INFINITY));
      m4svm_test_true_func($2, $3.isNaN, ($3.POSITIVE_INFINITY, $3.NaN));
      m4svm_test_true_func($2, $3.isNaN, ($3.NaN, $4_1));
      m4svm_test_true_func($2, $3.isNaN, ($3.NaN, $4_0));
      m4svm_test_true_func($2, $3.isNaN, ($3.NaN, $3.POSITIVE_INFINITY));
      m4svm_test_true_func($2, $3.isNaN, ($3.NaN, $3.NaN));
    }

    m4svm_define_end = ":])";
   
  /////////////////////////////// m4svm_test_Xdiv ////
  // $1 - method name suffix (ex. DDIV)
  // $2 - instruction name (ex. ddiv)
  // $3 - type class (ex. Double)
  // $4 - type prefix (ex. double)
    m4svm_define_begin v = ":], [:m4svm_test_Xdiv:])";

    public void test$1()
    {
      m4svm_test_equal($2, 1.0, ($4_1, $4_1));
      m4svm_test_true_func($2, $3.isInfinite, ($4_1, $4_0));
      m4svm_test_equal($2, $4_0, ($4_1, $3.POSITIVE_INFINITY));
      m4svm_test_true_func($2, $3.isNaN, ($4_1, $3.NaN));
      m4svm_test_equal($2, $4_0, ($4_0, $4_1));
      m4svm_test_true_func($2, $3.isNaN, ($4_0, $4_0));
      m4svm_test_equal($2, $4_0, ($4_0, $3.POSITIVE_INFINITY));
      m4svm_test_true_func($2, $3.isNaN, ($4_0, $3.NaN));
      m4svm_test_true_func($2, $3.isInfinite, ($3.POSITIVE_INFINITY, $4_1));
      m4svm_test_true_func($2, $3.isInfinite, ($3.POSITIVE_INFINITY, $4_0));
      m4svm_test_true_func($2, $3.isNaN, ($3.POSITIVE_INFINITY, $3.POSITIVE_INFINITY));
      m4svm_test_true_func($2, $3.isNaN, ($3.POSITIVE_INFINITY, $3.NaN));
      m4svm_test_true_func($2, $3.isNaN, ($3.NaN, $4_1));
      m4svm_test_true_func($2, $3.isNaN, ($3.NaN, $4_0));
      m4svm_test_true_func($2, $3.isNaN, ($3.NaN, $3.POSITIVE_INFINITY));
      m4svm_test_true_func($2, $3.isNaN, ($3.NaN, $3.NaN));
    }

    m4svm_define_end = ":])";

  /////////////////////////////// m4svm_test_Xrem ////
  // $1 - method name suffix (ex. DREM)
  // $2 - instruction name first char (ex. d)
  // $3 - type class (ex. Double)
  // $4 - type prefix (ex. double)
    m4svm_define_begin v = ":], [:m4svm_test_Xrem:])";

    public void test$1()
    {
      m4svm_test_equal($2rem, $4_0, ($4_1, $4_1));
      m4svm_test_true_func($2rem, $3.isNaN, ($4_1, $4_0));
      m4svm_test_equal($2rem, $4_1, ($4_1, $3.POSITIVE_INFINITY));
      m4svm_test_true_func($2rem, $3.isNaN, ($4_1, $3.NaN));
      m4svm_test_equal($2rem, $4_0, ($4_0, $4_1));
      m4svm_test_true_func($2rem, $3.isNaN, ($4_0, $4_0));
      m4svm_test_equal($2rem, $4_0, ($4_0, $3.POSITIVE_INFINITY));
      m4svm_test_true_func($2rem, $3.isNaN, ($4_0, $3.NaN));
      m4svm_test_true_func($2rem, $3.isNaN, ($3.POSITIVE_INFINITY, $4_1));
      m4svm_test_true_func($2rem, $3.isNaN, ($3.POSITIVE_INFINITY, $4_0));
      m4svm_test_true_func($2rem, $3.isNaN, ($3.POSITIVE_INFINITY, $3.POSITIVE_INFINITY));
      m4svm_test_true_func($2rem, $3.isNaN, ($3.POSITIVE_INFINITY, $3.NaN));
      m4svm_test_true_func($2rem, $3.isNaN, ($3.NaN, $4_1));
      m4svm_test_true_func($2rem, $3.isNaN, ($3.NaN, $4_0));
      m4svm_test_true_func($2rem, $3.isNaN, ($3.NaN, $3.POSITIVE_INFINITY));
      m4svm_test_true_func($2rem, $3.isNaN, ($3.NaN, $3.NaN));
    }

    m4svm_define_end = ":])";

  /////////////////////////////// m4svm_test_Xneg ////
  // $1 - method name suffix (ex. DNEG)
  // $2 - instruction name first char (ex. d)
  // $3 - type class (ex. Double)
  // $4 - type prefix (ex. double)
    m4svm_define_begin v = ":], [:m4svm_test_Xneg:])";

    public void test$1()
    {
      m4svm_test_equal($2neg, $4_minus_1, ($4_1));
      m4svm_test_equal($2neg, $4_0, ($4_0));
      m4svm_test_true_func($2neg, $3.isInfinite, ($3.POSITIVE_INFINITY));
      m4svm_test_true_func($2neg, $3.isNaN, ($3.NaN));
    }

    m4svm_define_end = ":])";

  /////////////////////////////// m4svm_test_conditional ////
  // $1 - method name suffix (ex. IFACMPEQ)
  // $2 - instruction name (ex. if_acmpeq)
  // $3 - object 1 for comparison (main) (ex. anObject)
  // $4 - object 2 for compairson (ex. anotherObject)
  // $5 - result expected when given objects 1 1
  // $6 - result expected when given objects 1 2
  // $7 - result expected when given objects 2 1
  // $8 - result expected when given objects 2 2
    m4svm_define_begin v = ":], [:m4svm_test_conditional_2:])";

    public void test$1()
    {
      m4svm_test_equal($2, $5, ($3, $3));
      m4svm_test_equal($2, $6, ($3, $4));
      m4svm_test_equal($2, $7, ($4, $3));
      m4svm_test_equal($2, $8, ($4, $4));
    }
    m4svm_define_end = ":])";

  /////////////////////////////// m4svm_test_conditional_10m1 ////
  // $1 - method name suffix (ex. IFEQ)
  // $2 - instruction name (ex. ifeq)
  // $3 - result expected for value  1
  // $4 - result expected for value  0
  // $5 - result expected for value -1
    m4svm_define_begin v = ":], [:m4svm_test_conditional_10m1:])";

    public void test$1()
    {
      m4svm_test_equal($2, $3,       (int_0));
      m4svm_test_equal($2, $4,       (int_1));
      m4svm_test_equal($2, $5, (int_minus_1));
    }
    m4svm_define_end = ":])";

  }

  /////////////////////////////// m4svm_test_conditional_NaNs ////
  // $1 - method name suffix (ex. DCMPG_NaNs)
  // $2 - instruction name (ex. dcmpg)
  // $3 - class type (ex. Double)
  // $4 - type (ex. double)
  // $5 - result expected for comparison: type_1 NAN
  // $6 - result expected for comparison: NaN type_1
    m4svm_define_begin v = ":], [:m4svm_test_conditional_NaNs:])";

    public void test$1()
    {
      m4svm_test_equal($2, $5, ($4_1, $3.NaN));
      m4svm_test_equal($2, $6, ($3.NaN, $4_1));
    }
    m4svm_define_end = ":])";

////////////////////////////////////////////////////////////////////
  m4svm_define_begin v = ":], [:m4svm_test_methods:])";
  
  /**
   * @method : testLoad
   * @description : tests each <type>load and <type>load_<n> instruction individually except the
   * wide_<type>load instructions which are tested along with the other wide family instructions.
   *
   * @author : Christian Arcand
   * @version : 1.0
   * @date : 2003
   */
 
  m4svm_test_Xload_std(ALoad, aload, anObject, anotherObject);
  m4svm_test_Xload_big(DLoad, dload, double_1, double_0, int_0);
  m4svm_test_Xload_std(FLoad, fload, float_1, float_0);
  m4svm_test_Xload_std(ILoad, iload, int_1, int_0);
  m4svm_test_Xload_big(LLoad, lload, long_1, long_0, int_0);

  public void testArrayLoadIterations()
  {
    // tests the <type>aload instructions
    for(int i=0; i<arrayLength; i++)
    {
      m4svm_test_equal(aaload, anObjectArray[i], (anObjectArray, i));
      m4svm_test_equal(baload, (boolean)aBooleanArray[i],(aBooleanArray, i),,_boolean);
      m4svm_test_equal(baload, (byte)aByteArray[i], (aByteArray, i),,_byte);
      m4svm_test_equal(caload, aCharArray[i], (aCharArray, i));
      m4svm_test_equal(daload, double1Array[i], (double1Array, i));
      m4svm_test_equal(faload, float1Array[i], (float1Array, i));
      m4svm_test_equal(iaload, int1Array[i], (int1Array, i));
      m4svm_test_equal(laload, long1Array[i], (long1Array, i));
      m4svm_test_equal(saload, aShortArray[i], (aShortArray, i));
    }
  }

  public void testArrayLoadNullExceptions()
  {
    m4svm_test_exception(aaload, NullPointerException, (null, 1));
    m4svm_test_exception(baload_boolean, NullPointerException, (null, 1));
    m4svm_test_exception(baload_byte, NullPointerException, (null, 1));
    m4svm_test_exception(caload, NullPointerException, (null, 1));
    m4svm_test_exception(daload, NullPointerException, (null, 1));
    m4svm_test_exception(faload, NullPointerException, (null, 1));
    m4svm_test_exception(iaload, NullPointerException, (null, 1));
    m4svm_test_exception(laload, NullPointerException, (null, 1));
    m4svm_test_exception(saload, NullPointerException, (null, 1));
  }


  public void testArrayLoadIndexBounds()
  {
    for (int i=-1; i<=2; i++) {
      if (i == 0) i = arrayLength;

      m4svm_test_exception_comment(aaload, ArrayIndexOutOfBoundsException,
		      (anObjectArray, i), "with index " + i);
      m4svm_test_exception_comment(baload_boolean, ArrayIndexOutOfBoundsException,
		      (aBooleanArray, i), "with index " + i);
      m4svm_test_exception_comment(baload_byte, ArrayIndexOutOfBoundsException,
		      (aByteArray, i), "with index " + i);
      m4svm_test_exception_comment(caload, ArrayIndexOutOfBoundsException,
		      (aCharArray, i), "with index " + i);
      m4svm_test_exception_comment(daload, ArrayIndexOutOfBoundsException,
		      (double1Array, i), "with index " + i);
      m4svm_test_exception_comment(faload, ArrayIndexOutOfBoundsException,
		      (float1Array, i), "with index " + i);
      m4svm_test_exception_comment(iaload, ArrayIndexOutOfBoundsException,
		      (int1Array, i), "with index " + i);
      m4svm_test_exception_comment(laload, ArrayIndexOutOfBoundsException,
		      (long1Array, i), "with index " + i);
      m4svm_test_exception_comment(saload, ArrayIndexOutOfBoundsException,
		      (aShortArray, i), "with index " + i);
    }    
  }


  /**
   * @method : testStore
   * @description : tests each <type>store and <type>store_<n> instruction individually except the
   * wide_<type>store instructions which are tested along with the other wide family instructions.
   *
   * @author : Christian Arcand
   * @version : 1.0
   * @date : 2003
   */
  
  m4svm_test_Xstore_std(AStore, astore, anObject, anotherObject);
  m4svm_test_Xstore_big(DStore, dstore, double_1, double_0, int_0);
  m4svm_test_Xstore_std(FStore, fstore, float_1, float_0);
  m4svm_test_Xstore_std(IStore, istore, int_1, int_0);
  m4svm_test_Xstore_big(LStore, lstore, long_1, long_0, int_0);

  public void testArrayStoreIterations()
  {
    for(int i=0; i<arrayLength; i++)
    {
      m4svm_test_equal_comment(aastore, anObject,
		      (anObjectArray, i, anObject), "at iteration " + i);
      m4svm_test_equal_comment(bastore_boolean, boolean_False,
		      (aBooleanArray, i, boolean_False), "at iteration " + i);
      m4svm_test_equal_comment(bastore_byte, byte_1,
		      (aByteArray, i, byte_1), "at iteration " + i);
      m4svm_test_equal_comment(castore, char_1,
		      (aCharArray, i, char_1), "at iteration " + i);
      m4svm_test_equal_comment(dastore, double_1,
		      (double1Array, i, double_1), "at iteration " + i);
      m4svm_test_equal_comment(fastore, float_1,
		      (float1Array, i, float_1), "at iteration " + i);
      m4svm_test_equal_comment(iastore, int_1,
		      (int1Array, i, int_1), "at iteration " + i);
      m4svm_test_equal_comment(lastore, long_1,
		      (long1Array, i, long_1), "at iteration " + i);
      m4svm_test_equal_comment(sastore, short_1,
		      (aShortArray, i, short_1), "at iteration " + i);
    }
  }

  public void testArrayStoreNullExceptions()
  {
    m4svm_test_exception(aastore, NullPointerException, (null, 1, anObject));
    m4svm_test_exception(bastore_boolean, NullPointerException, (null, 1, boolean_False));
    m4svm_test_exception(bastore_byte, NullPointerException, (null, 1, byte_1));
    m4svm_test_exception(castore, NullPointerException, (null, 1, char_1));
    m4svm_test_exception(dastore, NullPointerException, (null, 1, double_1));
    m4svm_test_exception(fastore, NullPointerException, (null, 1, float_1));
    m4svm_test_exception(iastore, NullPointerException, (null, 1, int_1));
    m4svm_test_exception(lastore, NullPointerException, (null, 1, long_1));
    m4svm_test_exception(sastore, NullPointerException, (null, 1, short_1));
  }

  public void testArrayStoreIndexBounds()
  {
    for (int i=-1; i<=2; i++) {
      if (i == 0) i = arrayLength;

      m4svm_test_exception_comment(aastore, ArrayIndexOutOfBoundsException,
		      (anObjectArray, i, anObject), "with index " + i);
      m4svm_test_exception_comment(bastore_boolean, ArrayIndexOutOfBoundsException,
		      (aBooleanArray, i, boolean_False), "with index " + i);
      m4svm_test_exception_comment(bastore_byte, ArrayIndexOutOfBoundsException,
		      (aByteArray, i, byte_1), "with index " + i);
      m4svm_test_exception_comment(castore, ArrayIndexOutOfBoundsException,
		      (aCharArray, i, char_1), "with index " + i);
      m4svm_test_exception_comment(dastore, ArrayIndexOutOfBoundsException,
		      (double1Array, i, double_1), "with index " + i);
      m4svm_test_exception_comment(fastore, ArrayIndexOutOfBoundsException,
		      (float1Array, i, float_1), "with index " + i);
      m4svm_test_exception_comment(iastore, ArrayIndexOutOfBoundsException,
		      (int1Array, i, int_1), "with index " + i);
      m4svm_test_exception_comment(lastore, ArrayIndexOutOfBoundsException,
		      (long1Array, i, long_1), "with index " + i);
      m4svm_test_exception_comment(sastore, ArrayIndexOutOfBoundsException,
		      (aShortArray, i, short_1), "with index " + i);
    }
  }

  
  /**
   * @method : testBasicStackHandling
   * @description : tests all the instructions pushing or popping single values from the 
   * stack individually.
   *
   * @author : Christian Arcand
   * @version : 1.0
   * @date : 2003
   */

  public void testAConstNull()
  { // tests aconst_null
    m4svm_test_equal(aconst_null, null, ());
  }
  
  public void testBIPush()
  { // tests the bipush instruction
    m4svm_test_equal(bipush, -86, ());
  }

  public void testDConst()
  { // tests the dconst_<n> instructions
    m4svm_test_equal(dconst_0, 0.0, ());
    m4svm_test_equal(dconst_1, 1.0, ());
  }

  public void testFConst()
  { // tests the fconst_<n> instructions
    m4svm_test_equal(fconst_0, 0.0f, ());
    m4svm_test_equal(fconst_1, 1.0f, ());
    m4svm_test_equal(fconst_2, 2.0f, ());
  }

  public void testIConst()
  { // tests the iconst_<n> instructions
    m4svm_test_equal(iconst_m1, -1, ());
    m4svm_test_equal(iconst_0,   0, ());
    m4svm_test_equal(iconst_1,   1, ());
    m4svm_test_equal(iconst_2,   2, ());
    m4svm_test_equal(iconst_3,   3, ());
    m4svm_test_equal(iconst_4,   4, ());
    m4svm_test_equal(iconst_5,   5, ());
  }

  public void testLConst()
  { // tests the lconst_<n> instructions
    m4svm_test_equal(lconst_0, 0, ());
    m4svm_test_equal(lconst_1, 1, ());
  }

  public void testLDC()
  { // tests the ldc family instructions
    m4svm_test_equal(ldc_integer, 1,    ());
    m4svm_test_equal(ldc_float,   1.0f, ());

    m4svm_test_equal_twomod(ldc_String, "Hello World!", ());
    m4svm_test_equal_twomod(ldc_w_String, "Hello World!", ());

    m4svm_test_equal(ldc_w_int, 1, ());
    m4svm_test_equal(ldc_w_float, 1.0f, ());
    m4svm_test_equal(ldc_long, 1, ());
    m4svm_test_equal(ldc_double, 1.0, ());
  }

  public void testPOP()
  {
    m4svm_test_equal(pop,   int_1, (int_1,  int_0));
    m4svm_test_equal(pop2, long_1, (long_1, long_0));
  }

  public void testSIPush()
  { // tests the sipush instruction
    m4svm_test_equal(sipush, 170, ());
  }

  /**
   * @method : testClassCheck
   * @description : tests the checkcast and instanceof instructions.
   *
   * @author : Christian Arcand
   * @version : 1.0
   * @date : 2003
   */
  public void testClassCheck()
  {
    m4svm_test_equal_comment(checkcast, 1, (anObject),
		    "doing java.lang.Object checkcast into java.lang.Object");
    m4svm_test_equal_comment(checkcast, 1, (null),
		    "doing checkcast of null into java.lang.Object");
    m4svm_test_equal_comment(instanceof, 1, (anObject),
		    "checking if java.lang.Object is instanceof java.lang.Object");
    m4svm_test_equal_comment(instanceof, 0, (null),
		    "checking if null is instanceof java.lang.Object");
  }

  /**
   * @method : testBranching
   * @description : tests all the branching instructions individually.
   *
   * @author : Christian Arcand
   * @version : 1.0
   * @date : 2003
   */

  public void testGoto()
  {
    m4svm_test_equal(goto,   1, ());
    m4svm_test_equal(goto_w, 1, ());
  }

  
  m4svm_test_conditional_2(IFACMPEQ, if_acmpeq,  anObject,  anotherObject, 1, 0, 0, 1);
  m4svm_test_conditional_2(IFACMPNE, if_acmpne,  anObject,  anotherObject, 0, 1, 1, 0);
  m4svm_test_conditional_2(IFICMPEQ, if_icmpeq,     int_1,          int_0, 1, 0, 0, 1);
  m4svm_test_conditional_2(IFICMPNE, if_icmpne,     int_1,          int_0, 0, 1, 1, 0);
  m4svm_test_conditional_2(IFICMPGE, if_icmpge,     int_1,          int_0, 1, 1, 0, 1);
  m4svm_test_conditional_2(IFICMPGT, if_icmpgt,     int_1,          int_0, 0, 1, 0, 0);
  m4svm_test_conditional_2(IFICMPLE, if_icmple,     int_1,          int_0, 1, 0, 1, 1);
  m4svm_test_conditional_2(IFICMPLT, if_icmplt,     int_1,          int_0, 0, 0, 1, 0);

  m4svm_test_conditional_2(IFACMPEQ_check, if_acmpeq_check,  anObject,  anotherObject, 1, 0, 0, 1);
  m4svm_test_conditional_2(IFACMPNE_check, if_acmpne_check,  anObject,  anotherObject, 0, 1, 1, 0);
  m4svm_test_conditional_2(IFICMPEQ_check, if_icmpeq_check,     int_1,          int_0, 1, 0, 0, 1);
  m4svm_test_conditional_2(IFICMPNE_check, if_icmpne_check,     int_1,          int_0, 0, 1, 1, 0);
  m4svm_test_conditional_2(IFICMPGE_check, if_icmpge_check,     int_1,          int_0, 1, 1, 0, 1);
  m4svm_test_conditional_2(IFICMPGT_check, if_icmpgt_check,     int_1,          int_0, 0, 1, 0, 0);
  m4svm_test_conditional_2(IFICMPLE_check, if_icmple_check,     int_1,          int_0, 1, 0, 1, 1);
  m4svm_test_conditional_2(IFICMPLT_check, if_icmplt_check,     int_1,          int_0, 0, 0, 1, 0);


  m4svm_test_conditional_10m1(IFEQ, ifeq, 1, 0, 0);
  m4svm_test_conditional_10m1(IFGE, ifge, 1, 1, 0);
  m4svm_test_conditional_10m1(IFGT, ifgt, 0, 1, 0);
  m4svm_test_conditional_10m1(IFLE, ifle, 1, 0, 1);
  m4svm_test_conditional_10m1(IFLT, iflt, 0, 0, 1);
  m4svm_test_conditional_10m1(IFNE, ifne, 0, 1, 1);

  m4svm_test_conditional_10m1(IFEQ_check, ifeq_check, 1, 0, 0);
  m4svm_test_conditional_10m1(IFGE_check, ifge_check, 1, 1, 0);
  m4svm_test_conditional_10m1(IFGT_check, ifgt_check, 0, 1, 0);
  m4svm_test_conditional_10m1(IFLE_check, ifle_check, 1, 0, 1);
  m4svm_test_conditional_10m1(IFLT_check, iflt_check, 0, 0, 1);
  m4svm_test_conditional_10m1(IFNE_check, ifne_check, 0, 1, 1);

  public void testIFNONNULL()
  {
    m4svm_test_equal(ifnonnull, 1, (anObject));
    m4svm_test_equal(ifnonnull, 0,     (null));
    m4svm_test_equal(ifnonnull_check, 1, (anObject));
    m4svm_test_equal(ifnonnull_check, 0,     (null));
   }

  public void testIFNULL()
  {
    m4svm_test_equal(ifnull, 0, (anObject));
    m4svm_test_equal(ifnull, 1,     (null));
    m4svm_test_equal(ifnull_check, 0, (anObject));
    m4svm_test_equal(ifnull_check, 1,     (null));
   }

  public void testLookupSwitch()
  {
    m4svm_test_equal(lookupswitch,       int_1, (int_0));
    m4svm_test_equal(lookupswitch,       int_0, (int_1));
    m4svm_test_equal(lookupswitch, int_minus_1,    (-2));
    m4svm_test_equal(lookupswitch, int_minus_1,     (2));
  }

  public void testTableSwitch()
  {
    m4svm_test_equal(tableswitch,       int_1, (int_0));
    m4svm_test_equal(tableswitch,       int_0, (int_1));
    m4svm_test_equal(tableswitch, int_minus_1,    (-2));
    m4svm_test_equal(tableswitch, int_minus_1,     (2));
  }

  /**
   * @method : testAdvancedStackHandling
   * @description : tests all the instructions manipulating values on the stack individually.
   *
   * @author : Christian Arcand
   * @version : 1.0
   * @date : 2003
   */
  public void testSwap()
  {
    m4svm_test_equal(swap, int_1, (int_1, int_0));
  }

  public void testDup()
  {
    m4svm_test_equal(dup,      int_1, (int_1, int_0));
    m4svm_test_equal(dup_x1,   int_1, (int_1, int_0));
    m4svm_test_equal(dup_x2,   int_1, (int_1, int_0));
    m4svm_test_equal(dup2,    long_1, (long_1, int_0));
    m4svm_test_equal(dup2_x1, long_1, (long_1, int_1, int_0));
    m4svm_test_equal(dup2_x2, long_1, (long_1, long_0, int_0));
  }

  /**
   * @method : testNew
   * @description : tests the new and newarray instructions and each newarray and multianewarray instruction individually.
   *
   * @author : Christian Arcand
   * @version : 1.0
   * @date : 2003
   */
  public void testNew()
  {
    m4svm_test_instanceof(new, Object, ());
    m4svm_test_instanceof(anewarray, Object[], (1));
    m4svm_test_instanceof(newarray_boolean, boolean[], (1));
    m4svm_test_instanceof(newarray_char, char[], (1));
    m4svm_test_instanceof(newarray_float, float[], (1));
    m4svm_test_instanceof(newarray_double, double[], (1));
    m4svm_test_instanceof(newarray_byte, byte[], (1));
    m4svm_test_instanceof(newarray_short, short[], (1));
    m4svm_test_instanceof(newarray_int, int[], (1));
    m4svm_test_instanceof(newarray_long, long[], (1));
    m4svm_test_instanceof(multianewarray_object, Object[][], (1, 1));
    m4svm_test_instanceof(multianewarray_boolean, boolean[][], (1, 1));
    m4svm_test_instanceof(multianewarray_char, char[][], (1, 1));
    m4svm_test_instanceof(multianewarray_float, float[][], (1, 1));
    m4svm_test_instanceof(multianewarray_double, double[][], (1, 1));
    m4svm_test_instanceof(multianewarray_byte, byte[][], (1, 1));
    m4svm_test_instanceof(multianewarray_short, short[][], (1, 1));
    m4svm_test_instanceof(multianewarray_int, int[][], (1, 1));
    m4svm_test_instanceof(multianewarray_long, long[][], (1, 1));
  }

  /**
   * @method : testTypeCast
   * @description : tests all the instructions converting a value from one basic type to another basic type individually.
   *
   * @author : Christian Arcand
   * @version : 1.0
   * @date : 2003
   */
  public void testTypeCast()
  {
    m4svm_test_equal(d2f,  float_1, (double_1));
    m4svm_test_equal(d2i,    int_1, (double_1));
    m4svm_test_equal(d2l,   long_1, (double_1));
    
    m4svm_test_equal(f2d, double_1, (float_1));
    m4svm_test_equal(f2i,    int_1, (float_1));
    m4svm_test_equal(f2l,   long_1, (float_1));

    m4svm_test_equal(i2b,   byte_1, (int_1));
    m4svm_test_equal(i2c,   char_1, (int_1));
    m4svm_test_equal(i2d, double_1, (int_1));
    m4svm_test_equal(i2f,  float_1, (int_1));
    m4svm_test_equal(i2l,   long_1, (int_1));
    m4svm_test_equal(i2s,  short_1, (int_1));
  }

  public void testTypeCastL2x()
  {
    m4svm_test_equal(l2d, double_1, (long_1));
    m4svm_test_equal(l2f,  float_1, (long_1));
    m4svm_test_equal(l2i,    int_1, (long_1));
  }

  /**
   * @method : testFields
   * @description : tests all the instructions manipulating fields individually.
   *
   * @author : Christian Arcand
   * @version : 1.0
   * @date : 2003
   */
  public void testFields_empty() {}
  public void testFields()
  {
    m4svm_test_equal_twomod(getfield_byte,           byte_0, (zeFields));
    m4svm_test_equal_twomod(getfield_char,           char_0, (zeFields));
    m4svm_test_equal_twomod(getfield_double,       double_0, (zeFields));
    m4svm_test_equal_twomod(getfield_float,         float_0, (zeFields));
    m4svm_test_equal_twomod(getfield_int,             int_0, (zeFields));
    m4svm_test_equal_twomod(getfield_long,           long_0, (zeFields));
    m4svm_test_equal_twomod(getfield_reference,        null, (zeFields));
    m4svm_test_equal_twomod(getfield_short,         short_0, (zeFields));
    m4svm_test_equal_twomod(getfield_boolean, boolean_False, (zeFields));
    m4svm_test_equal_twomod(getfield_array,            null, (zeFields));

    m4svm_test_equal_twomod(getstatic_byte,           byte_0, ());
    m4svm_test_equal_twomod(getstatic_char,           char_0, ());
    m4svm_test_equal_twomod(getstatic_double,       double_0, ());
    m4svm_test_equal_twomod(getstatic_float,         float_0, ());
    m4svm_test_equal_twomod(getstatic_int,             int_0, ());
    m4svm_test_equal_twomod(getstatic_long,           long_0, ());
    m4svm_test_equal_twomod(getstatic_reference,        null, ());
    m4svm_test_equal_twomod(getstatic_short,         short_0, ());
    m4svm_test_equal_twomod(getstatic_boolean, boolean_False, ());
    m4svm_test_equal_twomod(getstatic_array,            null, ());

    m4svm_test_equal_twomod(putfield_byte,           byte_1, (zeFields, byte_1));
    m4svm_test_equal_twomod(putfield_char,           char_1, (zeFields, char_1));
    m4svm_test_equal_twomod(putfield_double,       double_1, (zeFields, double_1));
    m4svm_test_equal_twomod(putfield_float,         float_1, (zeFields, float_1));
    m4svm_test_equal_twomod(putfield_int,             int_1, (zeFields, int_1));
    m4svm_test_equal_twomod(putfield_long,           long_1, (zeFields, long_1));
    m4svm_test_equal_twomod(putfield_reference,    anObject, (zeFields, anObject));
    m4svm_test_equal_twomod(putfield_short,         short_1, (zeFields, short_1));
    m4svm_test_equal_twomod(putfield_boolean,  boolean_True, (zeFields, boolean_True));
    m4svm_test_equal_twomod(putfield_array,   anObjectArray, (zeFields, anObjectArray));

    m4svm_test_equal_twomod(putstatic_byte,           byte_1, (byte_1));
    m4svm_test_equal_twomod(putstatic_char,           char_1, (char_1));
    m4svm_test_equal_twomod(putstatic_double,       double_1, (double_1));
    m4svm_test_equal_twomod(putstatic_float,         float_1, (float_1));
    m4svm_test_equal_twomod(putstatic_int,             int_1, (int_1));
    m4svm_test_equal_twomod(putstatic_long,           long_1, (long_1));
    m4svm_test_equal_twomod(putstatic_reference,    anObject, (anObject));
    m4svm_test_equal_twomod(putstatic_short,         short_1, (short_1));
    m4svm_test_equal_twomod(putstatic_boolean,  boolean_True, (boolean_True));
    m4svm_test_equal_twomod(putstatic_array,   anObjectArray, (anObjectArray));
  }

  public void testFieldsNullExceptions()
  { /* Warning - these test ONLY the fast versions and HAVE TO be
       called AFTER testFields() ! */
    m4svm_test_exception(getfield_byte,      NullPointerException, (null));
    m4svm_test_exception(getfield_char,      NullPointerException, (null));
    m4svm_test_exception(getfield_double,    NullPointerException, (null));
    m4svm_test_exception(getfield_float,     NullPointerException, (null));
    m4svm_test_exception(getfield_int,       NullPointerException, (null));
    m4svm_test_exception(getfield_long,      NullPointerException, (null));
    m4svm_test_exception(getfield_reference, NullPointerException, (null));
    m4svm_test_exception(getfield_short,     NullPointerException, (null));
    m4svm_test_exception(getfield_boolean,   NullPointerException, (null));
    m4svm_test_exception(getfield_array,     NullPointerException, (null));

    m4svm_test_exception(putfield_byte,      NullPointerException, (null, byte_1));
    m4svm_test_exception(putfield_char,      NullPointerException, (null, char_1));
    m4svm_test_exception(putfield_double,    NullPointerException, (null, double_1));
    m4svm_test_exception(putfield_float,     NullPointerException, (null, float_1));
    m4svm_test_exception(putfield_int,       NullPointerException, (null, int_1));
    m4svm_test_exception(putfield_long,      NullPointerException, (null, long_1));
    m4svm_test_exception(putfield_reference, NullPointerException, (null, anObject));
    m4svm_test_exception(putfield_short,     NullPointerException, (null, short_1));
    m4svm_test_exception(putfield_boolean,   NullPointerException, (null, boolean_True));
    m4svm_test_exception(putfield_array,     NullPointerException, (null, anObjectArray));
  }

  /**
   * @method : testArithmetic
   * @description : tests all the arithmetic instructions individually.
   *
   * @author : Christian Arcand
   * @version : 1.0
   * @date : 2003
   */

  m4svm_test_Xadd(DADD, dadd, Double, double, d);

  m4svm_test_Xadd(FADD, fadd, Float, float, f);
 
  m4svm_test_conditional_2(DCMPG, dcmpg, double_0, double_1, 0, -1, 1, 0);

  m4svm_test_conditional_NaNs(DCMPG_NaNs, dcmpg, Double, double, 1, 1);
  
  m4svm_test_conditional_2(DCMPL, dcmpl, double_0, double_1, 0, -1, 1, 0);

  m4svm_test_conditional_NaNs(DCMPL_NaNs, dcmpl, Double, double, -1, -1);

  m4svm_test_Xdiv(DDIV, ddiv, Double, double);

  m4svm_test_Xmul(DMUL, dmul, Double, double, d);
  
  m4svm_test_Xneg(DNEG, d, Double, double);
  
  m4svm_test_Xrem(DREM, d, Double, double);

  m4svm_test_Xsub(DSUB, d, Double, double);
  
  m4svm_test_conditional_2(FCMPG, fcmpg, float_0, float_1, 0, -1, 1, 0);

  m4svm_test_conditional_NaNs(FCMPG_NaNs, fcmpg, Float, float, 1, 1);
 
  m4svm_test_conditional_2(FCMPL, fcmpl, float_0, float_1, 0, -1, 1, 0);
  
  m4svm_test_conditional_NaNs(FCMPL_NaNs, fcmpl, Float, float, -1, -1);

  m4svm_test_Xdiv(FDIV, fdiv, Float, float);
  
  m4svm_test_Xmul(FMUL, fmul, Float, float);

  m4svm_test_Xneg(FNEG, f, Float, float);

  m4svm_test_Xrem(FREM, f, Float, float);

  m4svm_test_Xsub(FSUB, f, Float, float);
  
  public void testIntArithm()
  { 
    m4svm_test_equal(iadd, int_1, (int_1, int_0));
    m4svm_test_equal(iand, int_1, (int_1, int_minus_1));
    m4svm_test_equal(idiv, int_0, (int_0, int_1));
    m4svm_test_equal(idiv, Integer.MIN_VALUE, (Integer.MIN_VALUE, int_minus_1));
    m4svm_test_exception(idiv, ArithmeticException, (int_1, int_0));
    m4svm_test_equal(iinc, int_1, (int_0));
    m4svm_test_equal(imul, int_minus_1, (int_1, int_minus_1));
    m4svm_test_equal(ineg, int_minus_1, (int_1));
    m4svm_test_equal(ior, int_minus_1, (int_1, int_minus_1));
    m4svm_test_equal(irem, int_0, (int_1, int_1));
    m4svm_test_exception(irem, ArithmeticException, (int_1, int_0));
    m4svm_test_equal(ishl, 2, (int_1, int_1));
    m4svm_test_equal(ishr, int_0, (int_1, int_1));
    m4svm_test_equal(isub, int_0, (int_1, int_1));
    m4svm_test_equal(iushr, Integer.MAX_VALUE, (int_minus_1, int_1));
    m4svm_test_equal(ixor, -2, (int_1, int_minus_1));
  }

  public void testLongArithm()
  { 
    m4svm_test_equal(ladd, long_1, (long_1, long_0));
    m4svm_test_equal(land, long_1, (long_1, long_minus_1));
    m4svm_test_equal(lcmp, int_1, (long_1, long_0));
    m4svm_test_equal(lcmp, int_0, (long_1, long_1));
    m4svm_test_equal(lcmp, int_minus_1, (long_0, long_1));
    m4svm_test_equal(ldiv, long_0, (long_0, long_1));
    m4svm_test_equal(ldiv, Long.MIN_VALUE, (Long.MIN_VALUE, long_minus_1));
    m4svm_test_exception(ldiv, ArithmeticException, (long_1, long_0));
    m4svm_test_equal(lmul, long_minus_1, (long_1, long_minus_1));
    m4svm_test_equal(lneg, long_minus_1, (long_1));
    m4svm_test_equal(lor, long_minus_1, (long_1, long_minus_1));
    m4svm_test_equal(lrem, long_0, (long_1, long_1));
    m4svm_test_exception(lrem, ArithmeticException, (long_1, long_0));
    m4svm_test_equal(lshl, 2, (long_1, int_1));
    m4svm_test_equal(lshr, long_0, (long_1, int_1));
    m4svm_test_equal(lsub, long_0, (long_1, long_1));
    m4svm_test_equal(lushr, Long.MAX_VALUE, (long_minus_1, int_1));
    m4svm_test_equal(lxor, -2, (long_1, long_minus_1));
  }
  
  /**
   * @method : testWideLoad
   * @description : tests all the wide_<type>load instructions individually.
   *
   * @author : Christian Arcand
   * @version : 1.0
   * @date : 2003
   */

  m4svm_test_wide_Xload_std(WideALoad, wide_aload, anObject, anotherObject);

  m4svm_test_wide_Xload_std(WideFLoad, wide_fload, float_1, float_0);

  m4svm_test_wide_Xload_std(WideILoad, wide_iload, int_1, int_0);
 
  m4svm_test_wide_Xload_big(WideDLoad, wide_dload, double_1, double_0, int_0);

  m4svm_test_wide_Xload_big(WideLLoad, wide_lload, long_1, long_0, int_0);

  /**
   * @method : testWideStore
   * @description : tests all the wide_<type>store instructions individually.
   *
   * @author : Christian Arcand
   * @version : 1.0
   * @date : 2003
   */

  m4svm_test_Xstore_std(WideAStore, wide_astore, anObject, anotherObject);

  m4svm_test_Xstore_std(WideFStore, wide_fstore, float_1, float_0);

  m4svm_test_Xstore_std(WideIStore, wide_istore, int_1, int_0);

  public void testWideDLStore()
  {
    m4svm_test_equal(wide_dstore,   double_1, (double_0, double_1));
    m4svm_test_equal(wide_dstore_0, double_1, (double_0, double_1));
    m4svm_test_equal(wide_dstore_1, double_1, (0, double_0, double_1));
    m4svm_test_equal(wide_dstore_2, double_1, (double_1));
    m4svm_test_equal(wide_dstore_3, double_1, (double_1));

    m4svm_test_equal(wide_lstore,   long_1, (long_0, long_1));
    m4svm_test_equal(wide_lstore_0, long_1, (long_0, long_1));
    m4svm_test_equal(wide_lstore_1, long_1, (0, long_0, long_1));
    m4svm_test_equal(wide_lstore_2, long_1, (long_1));
    m4svm_test_equal(wide_lstore_3, long_1, (long_1));

    m4svm_test_equal(wide_iinc, int_1, (int_0));
  }

  /**
   * @method : testLock
   * @description : tests all the instructions monitorenter and monitorexit. It does not tests if the current
   * thread actually gains ownership of the monitor of the object but tests that the execution of the instructions
   * is coherent.
   *
   * @author : Christian Arcand
   * @version : 1.0
   * @date : 2003
   */
  public void testLock()
  {
    m4svm_test_equal(monitorenter, anObject, (anObject));
  }

  /**
   * @method : testArrayLength
   * @description : tests the arraylength instruction.
   *
   * @author : Christian Arcand
   * @version : 1.0
   * @date : 2003
   */
  public void testArrayLength()
  {
    m4svm_test_equal(arraylength, arrayLength, (anObjectArray));
    m4svm_test_exception(arraylength, NullPointerException, (null));
  }

  /**
   * @method : testNop
   * @description : tests the nop instruction.
   *
   * @author : Christian Arcand
   * @version : 1.0
   * @date : 2003
   */
  public void testNop()
  {
    m4svm_test_run(nop,());
  }

  public void testJsrRet()
  {
    m4svm_test_run(jsr,());
    m4svm_test_run(ret,());
  }

  public void testAstoreRet()
  {
    m4svm_test_run(astore_ret,());
    m4svm_test_run(astore_ret_0,());
    m4svm_test_run(astore_ret_1,());
    m4svm_test_run(astore_ret_2,());
    m4svm_test_run(astore_ret_3,());
  }

  public void testAthrow()
  {
    RuntimeException except = new RuntimeException();
    m4svm_test_exception(athrow, RuntimeException, (except));
  }

  m4svm_define_end = ":])";

  void dummy() {

    /* m4_define([:m4svm_call_test:], [: */
    System.out.println("ABOUT to run: test$1");
    test$1();
    System.out.println("DONE: test$1");

    /* :]) */

  }

  m4svm_define_begin v = ":], [:m4svm_doIt_method:])";
  
  private void doIt()
  {
    setUp();

    /* m4svm_call_test(ALoad) */
    /* m4svm_call_test(DLoad) */
    /* m4svm_call_test(FLoad) */
    /* m4svm_call_test(ILoad) */
    /* m4svm_call_test(LLoad) */

    /* m4svm_call_test(AStore) */
    /* m4svm_call_test(DStore) */
    /* m4svm_call_test(FStore) */
    /* m4svm_call_test(IStore) */
    /* m4svm_call_test(LStore) */
   
    /* m4svm_call_test(AConstNull) */
    /* m4svm_call_test(BIPush) */
    /* m4svm_call_test(DConst) */
    /* m4svm_call_test(FConst) */
    /* m4svm_call_test(IConst) */
    /* m4svm_call_test(LConst) */

    /* m4svm_call_test(LDC) */
    /* m4svm_call_test(POP) */
    /* m4svm_call_test(SIPush) */

    /* m4svm_call_test(Goto) */

    /* m4svm_call_test(IFEQ) */
    /* m4svm_call_test(IFGE) */
    /* m4svm_call_test(IFGT) */
    /* m4svm_call_test(IFLE) */
    /* m4svm_call_test(IFLT) */
    /* m4svm_call_test(IFNE) */
    /* m4svm_call_test(IFACMPEQ) */
    /* m4svm_call_test(IFACMPNE) */
    /* m4svm_call_test(IFICMPEQ) */
    /* m4svm_call_test(IFICMPGE) */
    /* m4svm_call_test(IFICMPGT) */
    /* m4svm_call_test(IFICMPLE) */
    /* m4svm_call_test(IFICMPLT) */
    /* m4svm_call_test(IFICMPNE) */
    /* m4svm_call_test(IFNONNULL) */
    /* m4svm_call_test(IFNULL) */


    /* m4svm_call_test(IFEQ_check) */
    /* m4svm_call_test(IFGE_check) */
    /* m4svm_call_test(IFGT_check) */
    /* m4svm_call_test(IFLE_check) */
    /* m4svm_call_test(IFLT_check) */
    /* m4svm_call_test(IFNE_check) */
    /* m4svm_call_test(IFACMPEQ_check) */
    /* m4svm_call_test(IFACMPNE_check) */
    /* m4svm_call_test(IFICMPEQ_check) */
    /* m4svm_call_test(IFICMPGE_check) */
    /* m4svm_call_test(IFICMPGT_check) */
    /* m4svm_call_test(IFICMPLE_check) */
    /* m4svm_call_test(IFICMPLT_check) */
    /* m4svm_call_test(IFICMPNE_check) */

    /* m4svm_call_test(LookupSwitch) */
    /* m4svm_call_test(TableSwitch) */

    /* m4svm_call_test(Swap) */
    /* m4svm_call_test(Dup) */
    /* m4svm_call_test(New) */
    /* m4svm_call_test(TypeCast) */
    /* m4svm_call_test(TypeCastL2x) */

    /* m4svm_call_test(Fields) */
    /* m4svm_call_test(FieldsNullExceptions) */

    /* m4svm_call_test(DADD) */
    /* m4svm_call_test(DCMPG) */
    /* m4svm_call_test(DCMPG_NaNs) */
    /* m4svm_call_test(DCMPL) */
    /* m4svm_call_test(DCMPL_NaNs) */
    /* m4svm_call_test(DDIV) */
    /* m4svm_call_test(DMUL) */
    /* m4svm_call_test(DNEG) */
    /* m4svm_call_test(DREM) */
    /* m4svm_call_test(DSUB) */
    /* m4svm_call_test(FADD) */
    /* m4svm_call_test(FCMPG) */
    /* m4svm_call_test(FCMPG_NaNs) */
    /* m4svm_call_test(FCMPL) */
    /* m4svm_call_test(FCMPL_NaNs) */
    /* m4svm_call_test(FDIV) */
    /* m4svm_call_test(FMUL) */
    /* m4svm_call_test(FNEG) */
    /* m4svm_call_test(FREM) */
    /* m4svm_call_test(FSUB) */
    
    /* m4svm_call_test(ArrayLoadIterations) */
    /* m4svm_call_test(ArrayLoadNullExceptions) */
    /* m4svm_call_test(ArrayLoadIndexBounds) */
    /* m4svm_call_test(ArrayStoreIterations) */
    /* m4svm_call_test(ArrayStoreNullExceptions) */
    /* m4svm_call_test(ArrayStoreIndexBounds) */
    /* m4svm_call_test(ClassCheck) */
    /* m4svm_call_test(IntArithm) */
    /* m4svm_call_test(LongArithm) */
    /* m4svm_call_test(WideALoad) */
    /* m4svm_call_test(WideFLoad) */
    /* m4svm_call_test(WideILoad) */
    /* m4svm_call_test(WideDLoad) */
    /* m4svm_call_test(WideLLoad) */
    /* m4svm_call_test(WideAStore) */
    /* m4svm_call_test(WideFStore) */
    /* m4svm_call_test(WideIStore) */
    /* m4svm_call_test(WideDLStore) */
    /* m4svm_call_test(Lock) */
    /* m4svm_call_test(ArrayLength) */
    /* m4svm_call_test(Nop) */
    /* m4svm_call_test(JsrRet) */
    /* m4svm_call_test(AstoreRet) */
    /* m4svm_call_test(Athrow) */

  }

  m4svm_define_end = ":])";

/*

m4svm_on(0)

m4svm_BytecodeVerificationTest_header
m4svm_setUp_method
m4svm_main_method
m4svm_utils_methods
m4svm_test_methods
m4svm_doIt_method
}

m4svm_off()

*/

