-
Notifications
You must be signed in to change notification settings - Fork 0
/
SplayTreeTests.cs
67 lines (61 loc) · 1.67 KB
/
SplayTreeTests.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
using System;
using SplayTree;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace SplayTree
{
class SplayTreeTests
{
[TestClass]
public class Tests
{
[TestMethod]
public void CountTest()
{
SplayTree<int> s = new SplayTree<int>();
s.Add(5);
Assert.AreEqual(s.Count, 1);
s.Add(1);
Assert.AreEqual(s.Count, 2);
s.Add(2);
Assert.AreEqual(s.Count, 3);
}
[TestMethod]
public void ContainsTest()
{
SplayTree<int> s = new SplayTree<int>();
s.Add(5);
s.Add(1);
s.Add(2);
Assert.IsTrue(s.Contains(5));
Assert.IsFalse(s.Contains(3));
}
[TestMethod]
public void MinimumMaximumTest()
{
SplayTree<int> s = new SplayTree<int>();
s.Add(5);
s.Add(1);
s.Add(2);
Assert.AreEqual(s.Maximum(), 5);
Assert.AreEqual(s.Minimum(), 1);
}
[TestMethod]
public void EnumTest()
{
SplayTree<int> s = new SplayTree<int>();
s.Add(5);
s.Add(1);
s.Add(2);
s.Add(10);
s.Add(3);
s.Add(-2);
int prev = -9999;
foreach (int i in s)
{
Assert.IsTrue(prev < i);
prev = i;
}
}
}
}
}