-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathABIRegexTests.cs
More file actions
41 lines (39 loc) · 1.41 KB
/
ABIRegexTests.cs
File metadata and controls
41 lines (39 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using NUnit.Framework;
using Sequence.Contracts;
using Assert = UnityEngine.Assertions.Assert;
namespace Sequence.Ethereum.Tests
{
public class ABIRegexTests
{
[TestCase("", false)]
[TestCase("functionName", true)]
[TestCase("functionName()", false)]
[TestCase("functionName123", true)]
[TestCase("functionName_s", true)]
[TestCase("function-Name", true)]
[TestCase("functionName ", false)]
public void TestMatchesFunctionName(string input, bool expected)
{
bool result = ABIRegex.MatchesFunctionName(input);
Assert.AreEqual(expected, result);
}
[TestCase("", false)]
[TestCase("functionName", false)]
[TestCase("functionName(", false)]
[TestCase("functionName()", true)]
[TestCase("functionName(a)", true)]
[TestCase("functionName(a a)", false)]
[TestCase("functionName(a, a)", true)]
[TestCase("functionName(a,a)", true)]
[TestCase("functionName(,)", false)]
[TestCase("functionName(Aa123)", true)]
[TestCase("functionName(a,)", false)]
[TestCase("functionName() ", false)]
[TestCase("function_-123Name()", true)]
public void TestMatchesFunctionABI(string input, bool expected)
{
bool result = ABIRegex.MatchesFunctionABI(input);
Assert.AreEqual(expected, result);
}
}
}