public void testVariableStaticAssignment() { var block = new Block("1"); block.addOp(new Load(-1, var(1))); block.addOp(new PutField(-1, new FieldInfo(null, "abc", Object, false, true, false))); IList<Operation> operations = new Stack2Turing(block).translate(); Assert.AreEqual("[ 0:null::abc{System.Object} <- 1{System.Object} ]", operations.ToString()); }
public void testGetField() { var block = new Block("1"); block.addOp(new GetField(-1, new FieldInfo(null, "src", Object, false, true, false))); block.addOp(new PutField(-1, new FieldInfo(null, "dst", Object, false, true, false))); IList<Operation> operations = new Stack2Turing(block).translate(); Assert.AreEqual("[ 0:null::dst{System.Object} <- null::src{System.Object} ]", operations.ToString()); }
public void testMethodInvocation() { Block block = new Block("1"); block.addOp(new Load(-1, var("methodThis"))); // this block.addOp(new GetField(-1, new FieldInfo(null, "p1", Object, false, true, false))); block.addOp(new GetField(-1, new FieldInfo(null, "p2", Object, false, true, false))); block.addOp(new Invoke(-1, null, "methodA", "(System.Int32, System.Int32)System.Object", new ArrayList<Type>() { ClrType.Int32, ClrType.Int32 }, false, Object)); block.addOp(new PutField(-1, new FieldInfo(null, "dst", Object, false, true, false))); IList<Operation> operations = new Stack2Turing(block).translate(); Assert.AreEqual("[ 0:null.methodA(System.Int32, System.Int32)System.Object, 1:null::dst{System.Object} <- ?{System.Object} ]", operations.ToString()); }