Exemplo n.º 1
0
        [InlineData("b <bob+10>", 0b11100_111_1100_0110)]                         // 90 = pc+#*2+4 : pc=100, so #=-74/2 = -3A = 111_1100_0110
        public void ThumbCompilerTests(string input, uint output)
        {
            var bytes = new List <byte> {
                (byte)output, (byte)(output >> 8)
            };
            var model = new PokemonModel(new byte[0x200]);

            model.ObserveAnchorWritten(new ModelDelta(), "bob", new NoInfoRun(0x80)); // random anchor so we can test stuff that points to anchors
            var result = parser.Compile(model, 0x100, new string[] { input });

            Assert.Equal(bytes[0], result[0]);
            Assert.Equal(bytes[1], result[1]);

            if (result.Count > 2)
            {
                bytes.Add((byte)(output >> 16));
                bytes.Add((byte)(output >> 24));
                Assert.Equal(bytes[2], result[2]);
                Assert.Equal(bytes[3], result[3]);
            }
        }
Exemplo n.º 2
0
 public static IReadOnlyList <byte> Compile(this ThumbParser parser, IDataModel model, int start, params string[] lines)
 {
     // added for compatibility: tests are allowed to call the old version of the method.
     return(parser.Compile(model, start, out var _, lines));
 }