-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* shift for bigint * unittest for static var. without jsonconfig. * Fix tests
- Loading branch information
1 parent
22981e1
commit 6a042d6
Showing
2 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract_StaticVar.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace Neo.Compiler.MSIL.TestClasses | ||
{ | ||
|
||
class Contract_staticvar : SmartContract.Framework.SmartContract | ||
{ | ||
static int a1 = 1; | ||
|
||
public static object Main(string method, object[] args) | ||
{ | ||
testadd(); | ||
testmulti(); | ||
return a1; | ||
} | ||
|
||
static void testadd() | ||
{ | ||
a1 += 5; | ||
} | ||
static void testmulti() | ||
{ | ||
a1 *= 7; | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using Neo.Compiler.MSIL.Utils; | ||
using Neo.VM; | ||
|
||
namespace Neo.Compiler.MSIL | ||
{ | ||
[TestClass] | ||
public class UnitTest_StaticVar | ||
{ | ||
[TestMethod] | ||
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); | ||
} | ||
|
||
} | ||
} |