Exemplo n.º 1
0
        public void Test_Shift_BigInteger()
        {
            var testengine = new TestEngine();

            testengine.AddEntryScript("./TestClasses/Contract_shift_bigint.cs");
            testengine.ScriptEntry.DumpNEF();
            StackItem[] _params = new StackItem[] { "testfunc", new StackItem[0] };
            var         result  = testengine.ExecuteTestCase(_params);
        }
        public void Test_StaticVar()
        {
            var testengine = new TestEngine();

            testengine.AddEntryScript("./TestClasses/Contract_StaticVar.cs");
            StackItem[] _params = new StackItem[] { "testfunc", new StackItem[0] };
            var         result  = testengine.ExecuteTestCase(_params);

            //test (1+5)*7 == 42
            StackItem wantresult = 42;
            var       bequal     = wantresult.Equals(result.Pop());

            Assert.IsTrue(bequal);
        }
Exemplo n.º 3
0
        public void Test_AutoEntry_private()
        {
            var testengine = new TestEngine();

            testengine.AddEntryScript("./TestClasses/Contract_autoentrypoint.cs");
            testengine.ScriptEntry.DumpNEF();
            StackItem[] _params = new StackItem[] { "privateMethod", new StackItem[0] };
            var         result  = testengine.ExecuteTestCase(_params);//new test method02

            bool hadFault = (testengine.State & VMState.FAULT) > 0;

            Assert.AreEqual(0, result.Count); //because no methodname had found, it do not return anything.
            Assert.IsTrue(hadFault);          ///because no methodname had found,vm state=fault.
        }
Exemplo n.º 4
0
        public void Test_ByteArrayPick()
        {
            var testengine = new TestEngine();

            testengine.AddEntryScript("./TestClasses/Contract2.cs");


            StackItem[] _params    = new StackItem[] { "testfunc", new StackItem[0] };
            var         result     = testengine.ExecuteTestCase(_params);
            StackItem   wantresult = 3;

            var bequal = wantresult.Equals(result.Pop());

            Assert.IsTrue(bequal);
        }
        public void Test_Appcall()
        {
            var testengine = new TestEngine();

            testengine.AddAppcallScript("./TestClasses/Contract1.cs", "0102030405060708090A0102030405060708090A");
            //will appcall 0102030405060708090A0102030405060708090A
            testengine.AddEntryScript("./TestClasses/Contract_appcall.cs");

            StackItem[] _params    = new StackItem[] { "testfunc", new StackItem[0] };
            var         result     = testengine.ExecuteTestCase(_params);
            StackItem   wantresult = new byte[] { 1, 2, 3, 4 };

            var bequal = wantresult.Equals(result.Pop());

            Assert.IsTrue(bequal);
        }