-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathStringMeasureTests.cs
80 lines (74 loc) · 2.34 KB
/
StringMeasureTests.cs
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
using MySQLCLRFunctions;
using Xunit;
using static MySQLCLRFunctions.StringMeasure;
namespace MySQLCLRFunctions.Tests
{
public class StringMeasureTests
{
[Fact]
[PositiveTest]
public void HowManySTest()
{
const string input = "This.3.3.3";
const int validoutput = 3;
var output = HowManyS(input, ".");
Assert.Equal(expected: validoutput, output);
}
[Fact]
[PositiveTest]
public void MinTest()
{
var inputs = new int[] { 1, 2, 3 };
const int validoutput = 1;
var output = Min(inputs);
Assert.Equal(expected: validoutput, output);
}
[Fact]
[PositiveTest]
public void MinOverTest()
{
int[] inputs = new int[] { 0, -1, 4 };
const int validoutput = 0;
var output = MinOver(0, inputs);
Assert.Equal(expected: validoutput, output);
}
[Fact]
[PositiveTest]
public void MaxTest()
{
var inputs = new int[] { 0, -1, 4 };
const int validoutput = 4;
var output = Max(inputs);
Assert.Equal(expected: validoutput, output);
}
[Fact]
[PositiveTest]
public void HowManyXTest()
{
const string input = "Print the %s for %d times.";
const int validoutput = 2;
var output = HowManyX(input, "(%s|%d)");
Assert.Equal(expected: validoutput, output);
}
[Fact()]
[PositiveTest]
public void InTest()
{
string[] possiblegenerationalsuffixes = new string[] { "I", "II", "III", "IV", "JR", "SR", "Jr", "Sr" };
string input = "Jr";
bool? validoutput = true;
var output = input.INL(possiblegenerationalsuffixes);
Assert.Equal(expected: validoutput, output);
}
[Fact()]
[NegativeTest]
public void InTestFail()
{
string[] possiblegenerationalsuffixes = new string[] { "I", "II", "III", "IV", "JR", "SR", "Jr", "Sr" };
string input = "jR";
bool? validoutput = false;
var output = input.INL(possiblegenerationalsuffixes);
Assert.Equal(expected: validoutput, output);
}
}
}