-
Notifications
You must be signed in to change notification settings - Fork 294
/
Copy pathCircularLinkedList_Tests.cs
69 lines (52 loc) · 1.69 KB
/
CircularLinkedList_Tests.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
using System.Linq;
using Advanced.Algorithms.DataStructures;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Advanced.Algorithms.Tests.DataStructures
{
[TestClass]
public class CircularLinkedListTests
{
/// <summary>
/// doubly linked list tests
/// </summary>
[TestMethod]
public void CircularLinkedList_Test()
{
var list = new CircularLinkedList<string>();
list.Insert("a");
list.Insert("b");
list.Insert("c");
list.Insert("c");
Assert.AreEqual(list.Count(), 4);
list.Delete("a");
Assert.AreEqual(list.Count(), 3);
list.Delete("b");
Assert.AreEqual(list.Count(), 2);
list.Delete("c");
Assert.AreEqual(list.Count(), 1);
list.Insert("a");
Assert.AreEqual(list.Count(), 2);
list.Delete("a");
Assert.AreEqual(list.Count(), 1);
list.Delete("c");
Assert.AreEqual(list.Count(), 0);
list.Insert("a");
list.Insert("b");
list.Insert("c");
list.Insert("c");
Assert.AreEqual(list.Count(), 4);
list.Delete("a");
Assert.AreEqual(list.Count(), 3);
list.Delete("b");
Assert.AreEqual(list.Count(), 2);
list.Delete("c");
Assert.AreEqual(list.Count(), 1);
list.Insert("a");
Assert.AreEqual(list.Count(), 2);
list.Delete("a");
Assert.AreEqual(list.Count(), 1);
list.Delete("c");
Assert.AreEqual(list.Count(), 0);
}
}
}