public void TestSetElem() { var acc = new Access(new Id(new Word("arr", Tag.ID), Sara.Type.Int,0x20), new Constant(20),Sara.Type.Int); var setElem = new SetElem(acc, new Constant(42)); setElem.Gen(10, 20); //Output: // arr [ 20 ] = 42 }
public void TestAccess() { var acc = new Access(new Id(new Word("val", Tag.ID), Sara.Type.Int, 0xcf), new Constant(42), Sara.Type.Int); Assert.AreEqual("val [ 42 ]", acc.ToString()); Assert.IsTrue(acc.Gen() is Access); acc.Jumping(10, 100); //output: // t1 = val [ 42 ] // if t1 goto L10 // goto L100 }