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())); }
public void ToString_LoadConstantInstruction_Double() { var loadInstruction = new LoadConstantInstruction(LoadKind.Double, 0.69); Assert.Equal("ldc.d 0.69", loadInstruction.ToString()); }
public void ToString_LoadConstantInstruction_Integer() { var loadInstruction = new LoadConstantInstruction(LoadKind.Integer, 42); Assert.Equal("ldc.i 42", loadInstruction.ToString()); }
public void VisitLoadConstant(LoadConstantInstruction instruction) => IncrementCallCount(nameof(VisitLoadConstant));