Exemple #1
0
        public void TestSymbol()
        {
            var inputs = DataNode.CreateArray();

            inputs.AddValue("symbol");
            inputs.AddValue(null);

            emulator.Reset(inputs);
            emulator.Run();

            var result = emulator.GetOutput();

            Assert.NotNull(result);

            var symbol = result.GetString();

            Assert.IsTrue(symbol.Equals("DEMO"));
        }
Exemple #2
0
    public void PutSomething()
    {
        var inputs = MakeParameters("xx");

        emulator.Reset(inputs);
        emulator.Run();

        // obtain the smart contract output
        var result = emulator.GetOutput();

        // validate output
        var symbol = result.GetString();

        Debug.WriteLine(symbol);
    }
Exemple #3
0
        private void UpdateState()
        {
            currentLine = ResolveLine(debugState.offset);

            switch (debugState.state)
            {
            case DebuggerState.State.Finished:
            {
                shouldReset = true;
                RemoveCurrentHighlight();
                var val = debugger.GetOutput();

                BlockchainSave();

                var gasStr = string.Format("{0:N4}", debugger.GetUsedGas());

                MessageBox.Show("Execution finished.\nGAS cost: " + gasStr + "\nResult: " + FormattingUtils.StackItemAsString(val));

                break;
            }

            case DebuggerState.State.Exception:
            {
                shouldReset = true;
                MessageBox.Show("Execution failed with an exception at address " + debugger.GetInstructionPtr().ToString() + " lastOffset: " + debugState.offset.ToString());
                JumpToLine(currentLine);
                break;
            }

            case DebuggerState.State.Break:
            {
                MessageBox.Show("Execution hit an breakpoint");
                JumpToLine(currentLine);
                break;
            }
            }
        }