Definition at line 9 of file BinarySearchTest.cs.
◆ TestBinarySearch()
void BGC.Tests.BinarySearchTest.TestBinarySearch |
( |
| ) |
|
|
inline |
Definition at line 12 of file BinarySearchTest.cs.
14 float[] testArray =
new float[] { 2f, 4f, 6f, 7f, 8f, 9f, 10f, 12f, 16f, 17f, 80f };
16 float[] inputValues =
new float[]
17 { 1f, 2f, 2.1f, 4f, 4.1f, 5.99f, 6f, 8.5f, 16.1f, 17f, 50f, 80f, 81f };
18 int[] outputValues =
new int[]
19 { -1, 0, 0, 1, 1, 1, 2, 4, 8, 9, 9, 10, 10 };
21 for (
int i = 0; i < inputValues.Length; i++)
23 Assert.IsTrue(testArray.BinarySearchLowerBound(inputValues[i]) == outputValues[i],
24 $
"Failed Binary Search Test {i}. " +
25 $
"Expected {outputValues[i]}, " +
26 $
"Found {testArray.BinarySearchLowerBound(inputValues[i])}");
The documentation for this class was generated from the following file: