public void Init() { snapshot = new TestDataCache(); testengine = new TestEngine(snapshot: snapshot); testengine.AddEntryScript("./TestClasses/Contract_Delegate.cs"); }
public void Init() { testengine = new TestEngine(); testengine.AddEntryScript("./TestClasses/Contract_InvokeCsNef.cs"); }
public void Init() { _engine = new TestEngine(snapshot: new TestDataCache()); _engine.AddEntryScript("./TestClasses/Contract_String.cs"); }
public void Init() { testengine = new TestEngine(); testengine.AddEntryScript("./TestClasses/Contract_Returns.cs"); }
public void Init() { _engine = new TestEngine(); _engine.AddEntryScript("./TestClasses/Contract_Foreach.cs"); }
public void Init() { _engine = new TestEngine(); _engine.AddEntryScript("./TestClasses/Contract_Concat.cs", false, false); }
public void LongParse_Test() { using var testengine = new TestEngine(snapshot: new TestDataCache()); testengine.AddEntryScript("./TestClasses/Contract_IntegerParse.cs"); string methodname = "testLongparse"; var result = testengine.ExecuteTestCaseStandard(methodname, " -9223372036854775808"); var value = result.Pop().GetInteger(); Assert.AreEqual(-9223372036854775808, value); testengine.Reset(); result = testengine.ExecuteTestCaseStandard(methodname, "9223372036854775807"); value = result.Pop().GetInteger(); Assert.AreEqual(9223372036854775807, value); //test backspace trip testengine.Reset(); result = testengine.ExecuteTestCaseStandard(methodname, "20 "); value = result.Pop().GetInteger(); Assert.AreEqual(20, value); testengine.Reset(); result = testengine.ExecuteTestCaseStandard(methodname, " 20 "); value = result.Pop().GetInteger(); Assert.AreEqual(20, value); testengine.Reset(); result = testengine.ExecuteTestCaseStandard(methodname, "-9223372036854775809"); Assert.AreEqual(VMState.FAULT, testengine.State); Assert.IsNotNull(testengine.FaultException); testengine.Reset(); result = testengine.ExecuteTestCaseStandard(methodname, "9223372036854775808"); Assert.AreEqual(VMState.FAULT, testengine.State); Assert.IsNotNull(testengine.FaultException); testengine.Reset(); result = testengine.ExecuteTestCaseStandard(methodname, ""); Assert.AreEqual(VMState.FAULT, testengine.State); Assert.IsNotNull(testengine.FaultException); testengine.Reset(); result = testengine.ExecuteTestCaseStandard(methodname, "abc"); Assert.AreEqual(VMState.FAULT, testengine.State); Assert.IsNotNull(testengine.FaultException); testengine.Reset(); result = testengine.ExecuteTestCaseStandard(methodname, "@"); Assert.AreEqual(VMState.FAULT, testengine.State); Assert.IsNotNull(testengine.FaultException); }
public void Init() { _engine = new TestEngine(); _engine.AddEntryScript("./TestClasses/Contract_Enumerator.cs"); }
public void Test_MultipleContracts() { using (var testengine = new TestEngine()) { Assert.AreEqual(2, Assert.ThrowsException <EntryPointException>(() => testengine.AddEntryScript("./TestClasses/Contract_MultipleContracts.cs")).Count); } using (var testengine = new TestEngine()) { Assert.AreEqual(2, Assert.ThrowsException <EntryPointException>(() => testengine.AddEntryScript("./TestClasses/Contract_MultipleContracts2.cs")).Count); } }
public void Init() { _engine = new TestEngine(); Assert.IsTrue(_engine.AddEntryScript("./TestClasses/Contract_Attribute.cs").Success); }
public void Test_NoEntryPoint() { using (var testengine = new TestEngine()) { Assert.AreEqual(0, Assert.ThrowsException <EntryPointException>(() => testengine.AddEntryScript("./TestClasses/NoContract.cs")).Count); } }
public void Test_Wrong() { var testengine = new TestEngine(); Assert.ThrowsException <NotSupportedException>(() => testengine.AddEntryScript("./TestClasses/Contract_WrongEvent.cs")); }
public void Init() { _engine = new TestEngine(); _engine.AddEntryScript("./TestClasses/Contract_Extensions.cs"); }
public void Init() { _engine = new TestEngine(SmartContract.TriggerType.Application, new DummyVerificable()); _engine.AddEntryScript("./TestClasses/Contract_ExecutionEngine.cs"); }
public void UInt160_ValidateAddress() { var address = "NiNmXL8FjEUEs1nfX9uHFBNaenxDHJtmuB".ToScriptHash(ProtocolSettings.Default.AddressVersion); using var testengine = new TestEngine(); testengine.AddEntryScript("./TestClasses/Contract_UIntTypes.cs"); // True var result = testengine.ExecuteTestCaseStandard("validateAddress", address.ToArray()); Assert.AreEqual(1, result.Count); var item = result.Pop(); Assert.IsTrue(item.GetBoolean()); testengine.Reset(); result = testengine.ExecuteTestCaseStandard("validateAddress", new ByteString(address.ToArray())); Assert.AreEqual(1, result.Count); item = result.Pop(); Assert.IsTrue(item.GetBoolean()); // False testengine.Reset(); result = testengine.ExecuteTestCaseStandard("validateAddress", new byte[1] { 1 }.Concat(address.ToArray()).ToArray()); Assert.AreEqual(1, result.Count); item = result.Pop(); Assert.IsFalse(item.GetBoolean()); testengine.Reset(); result = testengine.ExecuteTestCaseStandard("validateAddress", BigInteger.One); Assert.AreEqual(1, result.Count); item = result.Pop(); Assert.IsFalse(item.GetBoolean()); testengine.Reset(); testengine.ExecuteTestCaseStandard("validateAddress", StackItem.Null); Assert.AreEqual(VMState.FAULT, testengine.State); testengine.Reset(); result = testengine.ExecuteTestCaseStandard("validateAddress", new VM.Types.Array()); Assert.AreEqual(1, result.Count); item = result.Pop(); Assert.IsFalse(item.GetBoolean()); testengine.Reset(); result = testengine.ExecuteTestCaseStandard("validateAddress", new Struct()); Assert.AreEqual(1, result.Count); item = result.Pop(); Assert.IsFalse(item.GetBoolean()); testengine.Reset(); result = testengine.ExecuteTestCaseStandard("validateAddress", new Map()); Assert.AreEqual(1, result.Count); item = result.Pop(); Assert.IsFalse(item.GetBoolean()); testengine.Reset(); result = testengine.ExecuteTestCaseStandard("validateAddress", StackItem.True); Assert.AreEqual(1, result.Count); item = result.Pop(); Assert.IsFalse(item.GetBoolean()); }
public void Init() { testengine = new TestEngine(snapshot: null); testengine.AddEntryScript("./TestClasses/Contract_Instance.cs"); }
public void Init() { testEngine = new TestEngine(); testEngine.AddEntryScript("./TestClasses/Contract_Property.cs"); }
public void TestByteArrayMap() { Assert.ThrowsException <System.Exception>(() => _engine.AddEntryScript("./TestClasses/Contract_MapException.cs")); }
public void Init() { _engine = new TestEngine(TriggerType.Application, new DummyVerificable()); _engine.AddEntryScript("./TestClasses/Contract_ExecutionEngine.cs"); scriptHash = _engine.Nef.Script.Span.ToScriptHash().ToArray().ToHexString(); }
public void double_Test() { using var testengine = new TestEngine(); Assert.IsFalse(testengine.AddEntryScript("./TestClasses/Contract_Types_Double.cs").Success); }
public void Test_MultipleContracts() { using var testengine = new TestEngine(); Assert.ThrowsException <Exception>(() => testengine.AddEntryScript("./TestClasses/Contract_MultipleContracts.cs")); }