Skip to content

Commit 22b7c2f

Browse files
gregfraaalhour
authored andcommitted
fixed #76 AVLTreeTest failing - Case 5 (delete root of AVL tree) (#85)
1 parent 3a18599 commit 22b7c2f

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

UnitTest/DataStructuresTests/AVLTreeTest.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,11 @@ public static void DoTest()
118118
//
119119
/**************************************************************************
120120
** UNBALANCED ===> TRANSITION (1st R) ===> BALANCED (2nd Rt)
121-
** null .6..
121+
** null .5..
122122
** / \ / \
123-
** 2 6 ===> ===> 2 7
124-
** / \ / \ / \ /
125-
** 1 3 5 7 1 3 5
123+
** 2 6 ===> ===> 2 6
124+
** / \ / \ / \ \
125+
** 1 3 5 7 1 3 7
126126
**
127127
**************************************************************************
128128
*/
@@ -251,18 +251,18 @@ private static void AssertCase_5(AVLTree<int> avlTree)
251251
{
252252
var avlRoot = avlTree.Root;
253253
Assert.True(avlRoot.Height == 2, "Wrong root height!");
254-
Assert.True(avlRoot.Value == 6, "Wrong root.");
254+
Assert.True(avlRoot.Value == 5, "Wrong root.");
255255
Assert.True(avlRoot.LeftChild.Value == 2, "Wrong left child from root.");
256-
Assert.True(avlRoot.RightChild.Value == 7, "Wrong right child from root.");
256+
Assert.True(avlRoot.RightChild.Value == 6, "Wrong right child from root.");
257257
Assert.True(avlRoot.LeftChild.LeftChild.Value == 1, "Wrong value at {root->left->left}.");
258258
Assert.True(avlRoot.LeftChild.RightChild.Value == 3, "Wrong value at {root->left->right}.");
259-
Assert.True(avlRoot.RightChild.LeftChild.Value == 5, "Wrong value at {root->right->left}.");
260-
Assert.True(avlRoot.RightChild.RightChild == null, "Wrong value at {root->right->right}.");
259+
Assert.True(avlRoot.RightChild.LeftChild == null, "Wrong value at {root->right->left}.");
260+
Assert.True(avlRoot.RightChild.RightChild.Value == 7, "Wrong value at {root->right->right}.");
261261

262262
Assert.True(
263263
avlRoot.LeftChild.LeftChild.Height == 0
264264
&& avlRoot.LeftChild.RightChild.Height == 0
265-
&& avlRoot.RightChild.LeftChild.Height == 0
265+
&& avlRoot.RightChild.RightChild.Height == 0
266266
,
267267
"Wrong heights at the leaf nodes!.");
268268

UnitTest/UnitTest.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
<ItemGroup>
77
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
8-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" />
8+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
99
<PackageReference Include="xunit" Version="2.4.0" />
1010
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
1111
</ItemGroup>

0 commit comments

Comments
 (0)