public class BinarySearchTreeTester
extends java.lang.Object
BinarySearchTree
for
correctness by comparing it with a complex, pre-constructed tree.Constructor and Description |
---|
BinarySearchTreeTester() |
Modifier and Type | Method and Description |
---|---|
static void |
afterAllTests()
Eliminates the shared static variables after all tests have completed.
|
static void |
beforeAllTests()
Set up the shared static variables.
|
void |
checkConstructorExceptions()
Checks that a search tree cannot be constructed from a null list or a
list with no non-null values.
|
void |
checkFindFifthElement()
Checks that the element at index 5 in the tree can be found with the
appropriate search values (anything between 45.0--exclusive--to
55.0--inclusive).
|
void |
checkFindFirstElement()
Checks that the element at index 1 in the tree can be found with the
appropriate search values (anything between 5.0--exclusive--to
15.0--inclusive).
|
void |
checkFindFourthElement()
Checks that the element at index 4 in the tree can be found with the
appropriate search values (anything between 35.0--exclusive--to
45.0--inclusive).
|
void |
checkFindSecondElement()
Checks that the element at index 2 in the tree can be found with the
appropriate search values (anything between 15.0--exclusive--to
25.0--inclusive).
|
void |
checkFindSeventhElement()
Checks that the greatest element at index 7 in the tree can be found with
the appropriate search values (anything greater than 65.0--exclusive).
|
void |
checkFindSixthElement()
Checks that the element at index 6 in the tree can be found with the
appropriate search values (anything between 55.0--exclusive--to
65.0--inclusive).
|
void |
checkFindThirdElement()
Checks that the element at index 3 in the tree can be found with the
appropriate search values (anything between 25.0--exclusive--to
35.0--inclusive).
|
void |
checkFindZerothElement()
Checks that the smallest element (index 0) in the tree can be found with
the appropriate search values (anything below 0.0 to 5.0).
|
void |
checkGetValue()
Checks that the index-based getter returns the correct values (the tree
should be backed by an ordered list).
|
void |
checkGetValueIndexExceptions()
Checks that trying to get a value with an invalid index throws
IndexOutOfBoundsExceptions.
|
void |
checkInputIsSafe()
Checks that modifying the input list does not affect the structure of the
tree.
|
void |
checkSingleNodeTree()
Checks search operations on a single-node tree.
|
void |
checkSize()
Checks the expected size of the tree.
|
void |
checkThreeNodeTree()
Checks search operations on a small, evenly balanced, three-node tree.
|
void |
checkTwoNodeTree()
Checks search operations on a small, two-node tree.
|
public static void beforeAllTests()
public static void afterAllTests()
public void checkConstructorExceptions()
public void checkSingleNodeTree()
public void checkTwoNodeTree()
public void checkThreeNodeTree()
public void checkInputIsSafe()
public void checkSize()
public void checkGetValue()
public void checkGetValueIndexExceptions()
public void checkFindZerothElement()
public void checkFindFirstElement()
public void checkFindSecondElement()
public void checkFindThirdElement()
public void checkFindFourthElement()
public void checkFindFifthElement()
public void checkFindSixthElement()
public void checkFindSeventhElement()