-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathStringReduceTests.cs
92 lines (83 loc) · 2.7 KB
/
StringReduceTests.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
81
82
83
84
85
86
87
88
89
90
91
92
using Xunit;
using static MySQLCLRFunctions.StringReduce;
namespace MySQLCLRFunctions.Tests
{
public class StringReduceTests
{
[Fact]
public void TrimBracketsTest()
{
const string input = "[test]";
const string validoutput = "test";
var output = TrimBrackets(input);
Assert.Equal(expected: validoutput, output);
}
[Fact]
public void TrimIfStartsWithSTest()
{
const string input = "-This is a test";
const string marker = "-";
const string validoutput = "This is a test";
var output = LTrimIfStartsWithS(input, marker);
Assert.Equal(expected: validoutput, output);
}
[Fact]
public void TrimEndTest()
{
const string input = "input";
const string validoutput = input + "not implemented";
var output = "not implemented yet";
Assert.Equal(expected: validoutput, output);
}
[Fact]
public void TrimLeftNTest()
{
const string input = "input";
const string validoutput = input + "not implemented";
var output = "not implemented yet";
Assert.Equal(expected: validoutput, output);
}
[Fact]
public void BlankOutTest()
{
const string input = "input";
const string validoutput = input + "not implemented";
var output = "not implemented yet";
Assert.Equal(expected: validoutput, output);
}
[Fact]
public void RTrimCTest()
{
const string input = "1.2.1.1";
const string marker = "1xy.";
const string validoutput = "1.2";
var output = RTrimAnyC(input, marker); // So it's recursive.
Assert.Equal(expected: validoutput, output);
}
[Fact]
public void RTrimNTest()
{
const string input = "1.1.1.1";
const int howmany = 2;
const string validoutput = "1.1.1";
var output = RTrimN(input, howmany);
Assert.Equal(expected: validoutput, output);
}
[Fact]
public void RTrimOneTest()
{
const string input = "1.1.1.1";
const string validoutput = "1.1.1.";
var output = RTrimOne(input);
Assert.Equal(expected: validoutput, output);
}
[Fact]
public void LTrimOneTest()
{
const string input = "1.1.1.1";
const string validoutput = ".1.1.1";
var output = LTrimOne(input);
Assert.Equal(expected: validoutput, output);
}
}
}