Skip to content

Commit

Permalink
Merge branch 'master' into migrate-uts-2
Browse files Browse the repository at this point in the history
  • Loading branch information
shargon committed May 22, 2024
2 parents dc60de3 + 0504733 commit 3d28184
Show file tree
Hide file tree
Showing 22 changed files with 208 additions and 286 deletions.
2 changes: 1 addition & 1 deletion neo
Submodule neo updated 224 files

This file was deleted.

20 changes: 0 additions & 20 deletions tests/Neo.Compiler.CSharp.UnitTests/OldEngine/UnitTest_ABI_Safe.cs

This file was deleted.

28 changes: 0 additions & 28 deletions tests/Neo.Compiler.CSharp.UnitTests/OldEngine/UnitTest_Delegate.cs

This file was deleted.

This file was deleted.

This file was deleted.

33 changes: 0 additions & 33 deletions tests/Neo.Compiler.CSharp.UnitTests/OldEngine/UnitTest_GoTo.cs

This file was deleted.

18 changes: 0 additions & 18 deletions tests/Neo.Compiler.CSharp.UnitTests/OldEngine/UnitTest_Params.cs

This file was deleted.

26 changes: 0 additions & 26 deletions tests/Neo.Compiler.CSharp.UnitTests/OldEngine/UnitTest_Property.cs

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion tests/Neo.Compiler.CSharp.UnitTests/TestCleanup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ internal static CompilationContext[] EnsureArtifactsUpToDateInternal()

// Get all artifacts loaded in this assembly

compilationContexts = results.ToArray();
var b = Assembly.GetExecutingAssembly().GetTypes();
foreach (var type in b)
{
Expand Down Expand Up @@ -89,7 +90,6 @@ internal static CompilationContext[] EnsureArtifactsUpToDateInternal()
Assert.Fail("Error compiling templates");
}

compilationContexts = results.ToArray();
return compilationContexts;
}

Expand Down
20 changes: 20 additions & 0 deletions tests/Neo.Compiler.CSharp.UnitTests/UnitTest_ABI_Attributes.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Neo.Json;
using Neo.SmartContract.Testing;
using System.Linq;

namespace Neo.Compiler.CSharp.UnitTests
{
[TestClass]
public class UnitTest_ABI_Attributes
{
[TestMethod]
public void TestAbiAttributes()
{
var permissions = new JArray(Contract_ABIAttributes.Manifest.Permissions.Select(p => p.ToJson()).ToArray()).ToString(false);
Assert.AreEqual(@"[{""contract"":""0x0102030405060708090a0102030405060708090a"",""methods"":[""testArgs1"",""testVoid""]},{""contract"":""0x01ff00ff00ff00ff00ff00ff00ff00ff00ff00a4"",""methods"":[""a"",""b""]},{""contract"":""*"",""methods"":[""c""]}]", permissions);
var trust = Contract_ABIAttributes.Manifest.Trusts.ToJson(p => p.ToJson());
Assert.AreEqual(@"[""0x0a0b00ff00ff00ff00ff00ff00ff00ff00ff00a4""]", trust.ToString(false));
}
}
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Neo.SmartContract.TestEngine;
using Neo.SmartContract.Testing;

namespace Neo.Compiler.CSharp.UnitTests.OldEngine
namespace Neo.Compiler.CSharp.UnitTests
{
[TestClass]
public class UnitTest_ABI_Event
{
[TestMethod]
public void Test_Good()
{
var testengine = new TestEngine();
testengine.AddEntryScript(Utils.Extensions.TestContractRoot + "Contract_Event.cs");
var abi = testengine.Manifest.Abi;
var abi = Contract_Event.Manifest.Abi;
var events = abi.Events[0].ToJson().ToString(false);

string expecteventabi = @"{""name"":""transfer"",""parameters"":[{""name"":""arg1"",""type"":""ByteArray""},{""name"":""arg2"",""type"":""ByteArray""},{""name"":""arg3"",""type"":""Integer""}]}";
Expand Down
17 changes: 17 additions & 0 deletions tests/Neo.Compiler.CSharp.UnitTests/UnitTest_ABI_Safe.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Neo.SmartContract.Testing;

namespace Neo.Compiler.CSharp.UnitTests
{
[TestClass]
public class UnitTest_ABI_Safe
{
[TestMethod]
public void UnitTest_TestSafe()
{
Assert.IsFalse(Contract_ABISafe.Manifest.Abi.Methods[0].Safe);
Assert.IsTrue(Contract_ABISafe.Manifest.Abi.Methods[1].Safe);
Assert.IsFalse(Contract_ABISafe.Manifest.Abi.Methods[2].Safe);
}
}
}
18 changes: 18 additions & 0 deletions tests/Neo.Compiler.CSharp.UnitTests/UnitTest_Delegate.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Neo.SmartContract.Testing;
using Neo.SmartContract.Testing.TestingStandards;

namespace Neo.Compiler.CSharp.UnitTests
{
[TestClass]
public class UnitTest_Delegate : TestBase<Contract_Delegate>
{
public UnitTest_Delegate() : base(Contract_Delegate.Nef, Contract_Delegate.Manifest) { }

[TestMethod]
public void TestFunc()
{
Assert.AreEqual(5, Contract.SumFunc(2, 3));
}
}
}
Loading

0 comments on commit 3d28184

Please sign in to comment.