コード例 #1
0
        public void GetBytes_LoadConstantInstruction(LoadKind loadKind, object value)
        {
            var instruction   = new LoadConstantInstruction(loadKind, value);
            var expectedBytes = InstructionByteBuilder.Create()
                                .Opcode(Opcode.Load, loadKind, value)
                                .AsSpan();

            Assert.True(expectedBytes.SequenceEqual(instruction.GetBytes()));
        }
コード例 #2
0
        public void ToString_LoadConstantInstruction_Double()
        {
            var loadInstruction = new LoadConstantInstruction(LoadKind.Double, 0.69);

            Assert.Equal("ldc.d 0.69", loadInstruction.ToString());
        }
コード例 #3
0
        public void ToString_LoadConstantInstruction_Integer()
        {
            var loadInstruction = new LoadConstantInstruction(LoadKind.Integer, 42);

            Assert.Equal("ldc.i 42", loadInstruction.ToString());
        }
コード例 #4
0
 public void VisitLoadConstant(LoadConstantInstruction instruction) => IncrementCallCount(nameof(VisitLoadConstant));