Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Neo to 958 #317

Merged
merged 1 commit into from
Jul 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Neo.Compiler.MSIL/Neo.Compiler.MSIL.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.4.0" />
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic" Version="3.4.0" />
<PackageReference Include="Mono.Cecil" Version="0.11.2" />
<PackageReference Include="Neo" Version="3.0.0-CI00953" />
<PackageReference Include="Neo" Version="3.0.0-CI00958" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion tests/Neo.Compiler.MSIL.UnitTests/UnitTest1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public void Test_ByteArrayPick()

var result = testengine.GetMethod("unitTest_002").Run("hello", 1);

Assert.AreEqual(3, result.GetBigInteger());
Assert.AreEqual(3, result.GetInteger());
}
}
}
6 changes: 3 additions & 3 deletions tests/Neo.Compiler.MSIL.UnitTests/UnitTest_Array.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public void Test_IntArray()

//test 0,1,2
var arr = result.Pop<Array>();
CollectionAssert.AreEqual(new int[] { 0, 1, 2 }, arr.Cast<PrimitiveType>().Select(u => (int)u.ToBigInteger()).ToArray());
CollectionAssert.AreEqual(new int[] { 0, 1, 2 }, arr.Cast<PrimitiveType>().Select(u => (int)u.GetInteger()).ToArray());
}

[TestMethod]
Expand All @@ -29,7 +29,7 @@ public void Test_IntArrayInit()

//test 1,4,5
var arr = result.Pop<Array>();
CollectionAssert.AreEqual(new int[] { 1, 4, 5 }, arr.Cast<Integer>().Select(u => (int)u.ToBigInteger()).ToArray());
CollectionAssert.AreEqual(new int[] { 1, 4, 5 }, arr.Cast<Integer>().Select(u => (int)u.GetInteger()).ToArray());
}

/* TODO: We should uncomment this when NEWARRAY_T was done
Expand All @@ -41,7 +41,7 @@ public void Test_DefaultArray()
var result = testengine.ExecuteTestCaseStandard("TestDefaultArray");

//test true
Assert.IsTrue(result.TryPop(out Boolean b) && b.ToBoolean());
Assert.IsTrue(result.TryPop(out Boolean b) && b.GetBoolean());
}
*/

Expand Down
26 changes: 13 additions & 13 deletions tests/Neo.Compiler.MSIL.UnitTests/UnitTest_NULL.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public void IsNull()
var item = result.Pop();

Assert.IsInstanceOfType(item, typeof(Boolean));
Assert.IsTrue(item.ToBoolean());
Assert.IsTrue(item.GetBoolean());

// False

Expand All @@ -36,7 +36,7 @@ public void IsNull()
item = result.Pop();

Assert.IsInstanceOfType(item, typeof(Boolean));
Assert.IsFalse(item.ToBoolean());
Assert.IsFalse(item.GetBoolean());
}

[TestMethod]
Expand All @@ -47,7 +47,7 @@ public void IfNull()
var item = result.Pop();

Assert.IsInstanceOfType(item, typeof(Integer));
Assert.IsFalse(item.ToBoolean());
Assert.IsFalse(item.GetBoolean());
}

[TestMethod]
Expand Down Expand Up @@ -118,7 +118,7 @@ public void NullCollationAndCollation()
{
var result = _testengine.ExecuteTestCaseStandard("nullCollationAndCollation", "nes");
var item = result.Pop() as Integer;
var num = item.ToBigInteger();
var num = item.GetInteger();
Assert.IsTrue(num == 123);
}
}
Expand All @@ -141,7 +141,7 @@ public void NullCollationAndCollation2()
var bts = System.Text.Encoding.ASCII.GetBytes("111");
var num = new System.Numerics.BigInteger(bts);

Assert.IsTrue(item.ToBigInteger() == num);
Assert.IsTrue(item.GetInteger() == num);
}
}
[TestMethod]
Expand All @@ -154,7 +154,7 @@ public void EqualNull()
var item = result.Pop();

Assert.IsInstanceOfType(item, typeof(Boolean));
Assert.IsTrue(item.ToBoolean());
Assert.IsTrue(item.GetBoolean());

// False

Expand All @@ -163,7 +163,7 @@ public void EqualNull()
item = result.Pop();

Assert.IsInstanceOfType(item, typeof(Boolean));
Assert.IsFalse(item.ToBoolean());
Assert.IsFalse(item.GetBoolean());

// True

Expand All @@ -172,7 +172,7 @@ public void EqualNull()
item = result.Pop();

Assert.IsInstanceOfType(item, typeof(Boolean));
Assert.IsTrue(item.ToBoolean());
Assert.IsTrue(item.GetBoolean());

// False

Expand All @@ -181,7 +181,7 @@ public void EqualNull()
item = result.Pop();

Assert.IsInstanceOfType(item, typeof(Boolean));
Assert.IsFalse(item.ToBoolean());
Assert.IsFalse(item.GetBoolean());
}

[TestMethod]
Expand All @@ -194,7 +194,7 @@ public void EqualNotNull()
var item = result.Pop();

Assert.IsInstanceOfType(item, typeof(Boolean));
Assert.IsFalse(item.ToBoolean());
Assert.IsFalse(item.GetBoolean());

// False

Expand All @@ -203,7 +203,7 @@ public void EqualNotNull()
item = result.Pop();

Assert.IsInstanceOfType(item, typeof(Boolean));
Assert.IsTrue(item.ToBoolean());
Assert.IsTrue(item.GetBoolean());

// True

Expand All @@ -212,7 +212,7 @@ public void EqualNotNull()
item = result.Pop();

Assert.IsInstanceOfType(item, typeof(Boolean));
Assert.IsFalse(item.ToBoolean());
Assert.IsFalse(item.GetBoolean());

// False

Expand All @@ -221,7 +221,7 @@ public void EqualNotNull()
item = result.Pop();

Assert.IsInstanceOfType(item, typeof(Boolean));
Assert.IsTrue(item.ToBoolean());
Assert.IsTrue(item.GetBoolean());
}
}
}
4 changes: 2 additions & 2 deletions tests/Neo.Compiler.MSIL.UnitTests/UnitTest_Shift.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class UnitTest_Shift
public void Test_Shift()
{
var list = new List<BigInteger>();
var method = new EventHandler<NotifyEventArgs>((sender, e) => list.Add(((VM.Types.Integer)((VM.Types.Array)e.State)[0]).ToBigInteger()));
var method = new EventHandler<NotifyEventArgs>((sender, e) => list.Add(((VM.Types.Integer)((VM.Types.Array)e.State)[0]).GetInteger()));
ApplicationEngine.Notify += method;

var testengine = new TestEngine();
Expand All @@ -30,7 +30,7 @@ public void Test_Shift()
public void Test_Shift_BigInteger()
{
var list = new List<BigInteger>();
var method = new EventHandler<NotifyEventArgs>((sender, e) => list.Add(((VM.Types.Integer)((VM.Types.Array)e.State)[0]).ToBigInteger()));
var method = new EventHandler<NotifyEventArgs>((sender, e) => list.Add(((VM.Types.Integer)((VM.Types.Array)e.State)[0]).GetInteger()));
ApplicationEngine.Notify += method;

var testengine = new TestEngine();
Expand Down
34 changes: 17 additions & 17 deletions tests/Neo.Compiler.MSIL.UnitTests/UnitTest_Switch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ public void Test_SwitchLong()
{
testengine.Reset();
result = testengine.ExecuteTestCaseStandard("main", x.ToString());
Assert.AreEqual(result.Pop().GetBigInteger(), x + 1);
Assert.AreEqual(result.Pop().GetInteger(), x + 1);
}

// Test default

testengine.Reset();
result = testengine.ExecuteTestCaseStandard("main", 21.ToString());
Assert.AreEqual(result.Pop().GetBigInteger(), 99);
Assert.AreEqual(result.Pop().GetInteger(), 99);
}

[TestMethod]
Expand Down Expand Up @@ -62,13 +62,13 @@ public void Test_SwitchLongLong()

// Test default

Assert.AreEqual(resulta.GetBigInteger(), awant);
Assert.AreEqual(resultb.GetBigInteger(), bwant);
Assert.AreEqual(resultc.GetBigInteger(), cwant);
Assert.AreEqual(resultd.GetBigInteger(), dwant);
Assert.AreEqual(resulte.GetBigInteger(), ewant);
Assert.AreEqual(resultf.GetBigInteger(), fwant);
Assert.AreEqual(resultg.GetBigInteger(), gwant);
Assert.AreEqual(resulta.GetInteger(), awant);
Assert.AreEqual(resultb.GetInteger(), bwant);
Assert.AreEqual(resultc.GetInteger(), cwant);
Assert.AreEqual(resultd.GetInteger(), dwant);
Assert.AreEqual(resulte.GetInteger(), ewant);
Assert.AreEqual(resultf.GetInteger(), fwant);
Assert.AreEqual(resultg.GetInteger(), gwant);
}

[TestMethod]
Expand All @@ -91,10 +91,10 @@ public void Test_SwitchInteger()

// Test default

Assert.AreEqual(result1.GetBigInteger(), onewant);
Assert.AreEqual(result2.GetBigInteger(), twowant);
Assert.AreEqual(result3.GetBigInteger(), threewant);
Assert.AreEqual(result0.GetBigInteger(), zerowant);
Assert.AreEqual(result1.GetInteger(), onewant);
Assert.AreEqual(result2.GetInteger(), twowant);
Assert.AreEqual(result3.GetInteger(), threewant);
Assert.AreEqual(result0.GetInteger(), zerowant);
}

[TestMethod]
Expand All @@ -110,14 +110,14 @@ public void Test_SwitchLong_Release()
{
testengine.Reset();
result = testengine.ExecuteTestCaseStandard("main", x.ToString());
Assert.AreEqual(result.Pop().GetBigInteger(), x + 1);
Assert.AreEqual(result.Pop().GetInteger(), x + 1);
}

// Test default

testengine.Reset();
result = testengine.ExecuteTestCaseStandard("main", 21.ToString());
Assert.AreEqual(result.Pop().GetBigInteger(), 99);
Assert.AreEqual(result.Pop().GetInteger(), 99);
}

[TestMethod]
Expand All @@ -133,14 +133,14 @@ public void Test_Switch6()
{
testengine.Reset();
result = testengine.ExecuteTestCaseStandard("main", x.ToString());
Assert.AreEqual(result.Pop().GetBigInteger(), x + 1);
Assert.AreEqual(result.Pop().GetInteger(), x + 1);
}

// Test default

testengine.Reset();
result = testengine.ExecuteTestCaseStandard("main", 6.ToString());
Assert.AreEqual(result.Pop().GetBigInteger(), 99);
Assert.AreEqual(result.Pop().GetInteger(), 99);
}
}
}
28 changes: 14 additions & 14 deletions tests/Neo.Compiler.MSIL.UnitTests/UnitTest_TryCatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ public void Test_TryCatch_Succ()
var value = result.Pop();
Console.WriteLine("result:" + value.Type + " " + value.ToString());
var num = value as Neo.VM.Types.Integer;
Console.WriteLine("result = " + num.ToBigInteger().ToString());
Assert.AreEqual(num.ToBigInteger(), 3);
Console.WriteLine("result = " + num.GetInteger().ToString());
Assert.AreEqual(num.GetInteger(), 3);
}

[TestMethod]
Expand All @@ -33,8 +33,8 @@ public void Test_TryCatch_ThrowByCall()
var value = result.Pop();
Console.WriteLine("result:" + value.Type + " " + value.ToString());
var num = value as Neo.VM.Types.Integer;
Console.WriteLine("result = " + num.ToBigInteger().ToString());
Assert.AreEqual(num.ToBigInteger(), 4);
Console.WriteLine("result = " + num.GetInteger().ToString());
Assert.AreEqual(num.GetInteger(), 4);
}

[TestMethod]
Expand All @@ -48,8 +48,8 @@ public void Test_TryCatch_Throw()
var value = result.Pop();
Console.WriteLine("result:" + value.Type + " " + value.ToString());
var num = value as Neo.VM.Types.Integer;
Console.WriteLine("result = " + num.ToBigInteger().ToString());
Assert.AreEqual(num.ToBigInteger(), 4);
Console.WriteLine("result = " + num.GetInteger().ToString());
Assert.AreEqual(num.GetInteger(), 4);
}

[TestMethod]
Expand All @@ -63,8 +63,8 @@ public void Test_TryNest()
var value = result.Pop();
Console.WriteLine("result:" + value.Type + " " + value.ToString());
var num = value as Neo.VM.Types.Integer;
Console.WriteLine("result = " + num.ToBigInteger().ToString());
Assert.AreEqual(num.ToBigInteger(), 4);
Console.WriteLine("result = " + num.GetInteger().ToString());
Assert.AreEqual(num.GetInteger(), 4);
}

[TestMethod]
Expand All @@ -78,8 +78,8 @@ public void Test_TryFinally()
var value = result.Pop();
Console.WriteLine("result:" + value.Type + " " + value.ToString());
var num = value as Neo.VM.Types.Integer;
Console.WriteLine("result = " + num.ToBigInteger().ToString());
Assert.AreEqual(num.ToBigInteger(), 3);
Console.WriteLine("result = " + num.GetInteger().ToString());
Assert.AreEqual(num.GetInteger(), 3);
}

[TestMethod]
Expand All @@ -104,8 +104,8 @@ public void Test_TryCatch()
var value = result.Pop();
Console.WriteLine("result:" + value.Type + " " + value.ToString());
var num = value as Neo.VM.Types.Integer;
Console.WriteLine("result = " + num.ToBigInteger().ToString());
Assert.AreEqual(num.ToBigInteger(), 3);
Console.WriteLine("result = " + num.GetInteger().ToString());
Assert.AreEqual(num.GetInteger(), 3);
}

[TestMethod]
Expand All @@ -119,8 +119,8 @@ public void Test_TryWithTwoFinally()
var value = result.Pop();
Console.WriteLine("result:" + value.Type + " " + value.ToString());
var num = value as Neo.VM.Types.Integer;
Console.WriteLine("result = " + num.ToBigInteger().ToString());
Assert.AreEqual(num.ToBigInteger(), 9);
Console.WriteLine("result = " + num.GetInteger().ToString());
Assert.AreEqual(num.GetInteger(), 9);
}
}
}
8 changes: 4 additions & 4 deletions tests/Neo.Compiler.MSIL.UnitTests/UnitTest_TypeConvert.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@ public void UnitTest_TestTypeConvert()
var arr = result.Pop<Array>();
Assert.IsTrue(arr[0].Type == StackItemType.Integer);
Assert.IsTrue(arr[1].Type == StackItemType.Buffer);
Assert.IsTrue((arr[1].ConvertTo(StackItemType.ByteString) as PrimitiveType).ToBigInteger() == (arr[0] as PrimitiveType).ToBigInteger());
Assert.IsTrue((arr[1].ConvertTo(StackItemType.ByteString) as PrimitiveType).GetInteger() == (arr[0] as PrimitiveType).GetInteger());

Assert.IsTrue(arr[2].Type == StackItemType.Integer);
Assert.IsTrue(arr[3].Type == StackItemType.Buffer);
Assert.IsTrue((arr[3].ConvertTo(StackItemType.ByteString) as PrimitiveType).ToBigInteger() == (arr[2] as PrimitiveType).ToBigInteger());
Assert.IsTrue((arr[3].ConvertTo(StackItemType.ByteString) as PrimitiveType).GetInteger() == (arr[2] as PrimitiveType).GetInteger());

Assert.IsTrue(arr[4].Type == StackItemType.Buffer);
Assert.IsTrue(arr[5].Type == StackItemType.Integer);
Assert.IsTrue((arr[4].ConvertTo(StackItemType.ByteString) as PrimitiveType).ToBigInteger() == (arr[5] as PrimitiveType).ToBigInteger());
Assert.IsTrue((arr[4].ConvertTo(StackItemType.ByteString) as PrimitiveType).GetInteger() == (arr[5] as PrimitiveType).GetInteger());

Assert.IsTrue(arr[6].Type == StackItemType.Buffer);
Assert.IsTrue(arr[7].Type == StackItemType.Integer);
Assert.IsTrue((arr[6].ConvertTo(StackItemType.ByteString) as PrimitiveType).ToBigInteger() == (arr[7] as PrimitiveType).ToBigInteger());
Assert.IsTrue((arr[6].ConvertTo(StackItemType.ByteString) as PrimitiveType).GetInteger() == (arr[7] as PrimitiveType).GetInteger());
}
}
}
Loading