-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from jnyrup/MinMax
Fix Min/Max copy-paste error
- Loading branch information
Showing
3 changed files
with
92 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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,71 @@ | ||
using NUnit.Framework; | ||
using RangeTree; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace RangeTreeTests | ||
{ | ||
[TestFixture] | ||
public class RangeTreeTests | ||
{ | ||
[Test] | ||
public void GettingMin_InnerItems() | ||
{ | ||
var tree = new RangeTree<int, int> | ||
{ | ||
{ 1, 5, -1 }, | ||
{ 2, 5, -1 }, | ||
{ 3, 5, -1 }, | ||
}; | ||
|
||
var min = tree.Min; | ||
|
||
Assert.AreEqual(1, min); | ||
} | ||
|
||
[Test] | ||
public void GettingMin_LeftRecurse() | ||
{ | ||
var tree = new RangeTree<int, int> | ||
{ | ||
{ 1, 2, -1 }, | ||
{ 3, 4, -1 } | ||
}; | ||
|
||
var min = tree.Min; | ||
|
||
Assert.AreEqual(1, min); | ||
} | ||
|
||
[Test] | ||
public void GettingMax_InnerItems() | ||
{ | ||
var tree = new RangeTree<int, int> | ||
{ | ||
{ 1, 2, -1 }, | ||
{ 1, 3, -1 }, | ||
{ 1, 4, -1 }, | ||
}; | ||
|
||
var max = tree.Max; | ||
|
||
Assert.AreEqual(4, max); | ||
} | ||
|
||
[Test] | ||
public void GettingMax_RightRecurse() | ||
{ | ||
var tree = new RangeTree<int, int> | ||
{ | ||
{ 1, 2, -1 }, | ||
{ 3, 4, -1 }, | ||
{ 5, 6, -1 } | ||
}; | ||
|
||
var max = tree.Max; | ||
|
||
Assert.AreEqual(6, max); | ||
} | ||
} | ||
} |