-
Notifications
You must be signed in to change notification settings - Fork 0
Hw3 b tree #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
MikePuzanov
wants to merge
12
commits into
master
Choose a base branch
from
hw3B-tree
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Hw3 b tree #5
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
16a3683
start code Insert function
lykwer 7503173
Split don't finish
lykwer b93fe0e
add GetValue and IsConsist in BTree. connect TestB-tree.cs, and write…
lykwer f7ec8da
add function ChangeValueByKey
lykwer c9ab1e9
add Delete, tests not finished
lykwer 7df6e2a
fix Delete. Add and fix test
lykwer 3ba402d
appveyor.yml
lykwer b66134a
fix mistakes, tests wait me
1b78027
add tests
f143f5a
add tests
3ca4589
clear
240c283
fix mistakes
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| image: Visual Studio 2019 | ||
|
|
||
| build_script: | ||
| - For /R %%I in (*.sln) do dotnet test %%I | ||
|
|
||
| test: off |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,187 @@ | ||
| using NUnit.Framework; | ||
|
|
||
| namespace Hw3B_tree.Test | ||
| { | ||
| public class Tests | ||
| { | ||
| private BTree tree; | ||
|
|
||
| public BTree Setup(int minimumDegreeOfTree) | ||
| { | ||
| tree = new BTree(minimumDegreeOfTree); | ||
| for (int i = 1; i < 19; ++i) | ||
| { | ||
| tree.Insert(i.ToString(), i.ToString()); | ||
| } | ||
| return tree; | ||
| } | ||
|
|
||
| [TestCase] | ||
| public void CheckInsert() | ||
| { | ||
| var tree = Setup(2); | ||
| for (int i = 1; i <= 18; ++i) | ||
| { | ||
| Assert.IsTrue(tree.Exists(i.ToString())); | ||
| } | ||
| } | ||
|
|
||
| [TestCase] | ||
| public void CheckGetValue() | ||
| { | ||
| var tree = Setup(2); | ||
| for (int i = 1; i <= 18; ++i) | ||
| { | ||
| Assert.AreEqual(i.ToString(), tree.GetValue(i.ToString())); | ||
| } | ||
| } | ||
|
|
||
| [TestCase] | ||
| public void CheckChangeValueByKey() | ||
| { | ||
| var tree = Setup(2); | ||
| tree.ChangeValueByKey("5", "ololo"); | ||
| Assert.AreEqual("ololo", tree.GetValue("5")); | ||
| } | ||
|
|
||
| [TestCase] | ||
| public void CheckDeleteFromRoot() | ||
| { | ||
| var tree = Setup(2); | ||
| tree.Delete("8"); | ||
| for (int i = 1; i <= 18; ++i) | ||
| { | ||
| if (i == 8) | ||
| { | ||
| Assert.IsFalse(tree.Exists(i.ToString())); | ||
| continue; | ||
| } | ||
| Assert.IsTrue(tree.Exists(i.ToString())); | ||
| } | ||
| } | ||
|
|
||
| [TestCase] | ||
| public void CheckDeleteFromLeaf() | ||
| { | ||
| var tree = Setup(2); | ||
| tree.Delete("5"); | ||
| for (int i = 1; i <= 18; ++i) | ||
| { | ||
| if (i == 5) | ||
| { | ||
| Assert.IsFalse(tree.Exists(i.ToString())); | ||
| continue; | ||
| } | ||
| Assert.IsTrue(tree.Exists(i.ToString())); | ||
| } | ||
| } | ||
|
|
||
| [TestCase] | ||
| public void CheckDeleteFromNotLeafWithChangeRoot() | ||
| { | ||
| var tree = Setup(2); | ||
| tree.Delete("6"); | ||
| for (int i = 1; i <= 18; ++i) | ||
| { | ||
| if (i == 6) | ||
| { | ||
| Assert.IsFalse(tree.Exists(i.ToString())); | ||
| continue; | ||
| } | ||
| Assert.IsTrue(tree.Exists(i.ToString())); | ||
| } | ||
| } | ||
|
|
||
| [TestCase] | ||
| public void CheckDeleteFromLeafWithChangeValueInLeafs() | ||
| { | ||
| var tree = Setup(2); | ||
| tree.Delete("15"); | ||
| for (int i = 1; i <= 18; ++i) | ||
| { | ||
| if (i == 15) | ||
| { | ||
| Assert.IsFalse(tree.Exists(i.ToString())); | ||
| continue; | ||
| } | ||
| Assert.IsTrue(tree.Exists(i.ToString())); | ||
| } | ||
| } | ||
|
|
||
| [TestCase] | ||
| public void CheckInsertWithAnotherDegree() | ||
| { | ||
| var tree = Setup(4); | ||
| for (int i = 1; i <= 18; ++i) | ||
| { | ||
| Assert.IsTrue(tree.Exists(i.ToString())); | ||
| } | ||
| } | ||
|
|
||
| [TestCase] | ||
| public void CheckGetValueWithAnotherDegree() | ||
| { | ||
| var tree = Setup(4); | ||
| for (int i = 1; i <= 18; ++i) | ||
| { | ||
| Assert.AreEqual(i.ToString(), tree.GetValue(i.ToString())); | ||
| } | ||
| } | ||
|
|
||
| [TestCase] | ||
| public void CheckChangeValueByKeyWithAnotherDegree() | ||
| { | ||
| var tree = Setup(4); | ||
| tree.ChangeValueByKey("5", "ololo"); | ||
| Assert.AreEqual("ololo", tree.GetValue("5")); | ||
| } | ||
|
|
||
| [TestCase] | ||
| public void CheckDeleteFromRootWithAnotherDegree() | ||
| { | ||
| var tree = Setup(4); | ||
| tree.Delete("8"); | ||
| for (int i = 1; i <= 18; ++i) | ||
| { | ||
| if (i == 8) | ||
| { | ||
| Assert.IsFalse(tree.Exists(i.ToString())); | ||
| continue; | ||
| } | ||
| Assert.IsTrue(tree.Exists(i.ToString())); | ||
| } | ||
| } | ||
|
|
||
| [TestCase] | ||
| public void CheckDeleteFromLeafWithMergeLefsWithAnotherDegree() | ||
| { | ||
| var tree = Setup(4); | ||
| tree.Delete("2"); | ||
| for (int i = 1; i <= 18; ++i) | ||
| { | ||
| if (i == 2) | ||
| { | ||
| Assert.IsFalse(tree.Exists(i.ToString())); | ||
| continue; | ||
| } | ||
| Assert.IsTrue(tree.Exists(i.ToString())); | ||
| } | ||
| } | ||
|
|
||
This comment was marked as resolved.
Sorry, something went wrong. |
||
| [TestCase] | ||
| public void CheckDeleteFromLeafWithChangeValueInLeafsWithAnotherDegree() | ||
| { | ||
| var tree = Setup(4); | ||
| tree.Delete("10"); | ||
| for (int i = 1; i <= 18; ++i) | ||
| { | ||
| if (i == 10) | ||
| { | ||
| Assert.IsFalse(tree.Exists(i.ToString())); | ||
| continue; | ||
| } | ||
| Assert.IsTrue(tree.Exists(i.ToString())); | ||
| } | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
|
|
||
| <PropertyGroup> | ||
| <TargetFramework>netcoreapp3.1</TargetFramework> | ||
| <RootNamespace>hw3B_tree.Test</RootNamespace> | ||
|
|
||
| <IsPackable>false</IsPackable> | ||
| </PropertyGroup> | ||
|
|
||
| <ItemGroup> | ||
| <PackageReference Include="NUnit" Version="3.12.0" /> | ||
| <PackageReference Include="NUnit3TestAdapter" Version="3.16.1" /> | ||
| <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" /> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
| <ProjectReference Include="..\hw3B-tree\Hw3B-tree.csproj" /> | ||
| </ItemGroup> | ||
|
|
||
| </Project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| | ||
| Microsoft Visual Studio Solution File, Format Version 12.00 | ||
| # Visual Studio Version 16 | ||
| VisualStudioVersion = 16.0.31005.135 | ||
| MinimumVisualStudioVersion = 10.0.40219.1 | ||
| Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Hw3B-tree", "hw3B-tree\Hw3B-tree.csproj", "{53642C16-3AA3-4A57-8380-46B9C2E9651E}" | ||
| EndProject | ||
| Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "hw3B-tree.Test", "hw3B-tree.Test\hw3B-tree.Test.csproj", "{A2EE96D2-650B-457E-87E5-A6410F6DF06D}" | ||
| EndProject | ||
| Global | ||
| GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
| Debug|Any CPU = Debug|Any CPU | ||
| Release|Any CPU = Release|Any CPU | ||
| EndGlobalSection | ||
| GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
| {53642C16-3AA3-4A57-8380-46B9C2E9651E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
| {53642C16-3AA3-4A57-8380-46B9C2E9651E}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
| {53642C16-3AA3-4A57-8380-46B9C2E9651E}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
| {53642C16-3AA3-4A57-8380-46B9C2E9651E}.Release|Any CPU.Build.0 = Release|Any CPU | ||
| {A2EE96D2-650B-457E-87E5-A6410F6DF06D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
| {A2EE96D2-650B-457E-87E5-A6410F6DF06D}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
| {A2EE96D2-650B-457E-87E5-A6410F6DF06D}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
| {A2EE96D2-650B-457E-87E5-A6410F6DF06D}.Release|Any CPU.Build.0 = Release|Any CPU | ||
| EndGlobalSection | ||
| GlobalSection(SolutionProperties) = preSolution | ||
| HideSolutionNode = FALSE | ||
| EndGlobalSection | ||
| GlobalSection(ExtensibilityGlobals) = postSolution | ||
| SolutionGuid = {A28793F3-951B-4D93-BC1D-F351834FA2F5} | ||
| EndGlobalSection | ||
| EndGlobal |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Можно было через интерполяцию строк,
tree.Insert($"{i}", $"{i}");, но дело вкуса