TestKthOrderStatistic.cxx
Go to the documentation of this file.
1 /*===========================================================================================================
7 * Licensed under the MIT License, you may not use this file except in compliance with the License.
12 * Unless required by applicable law or agreed to in writing, software distributed under the License is
13 * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and limitations under the License.
19 *=========================================================================================================*/
30 const int SortedArrayInt[] = {-3, -2, 0, 2, 8, 15, 36, 212, 366}; // Simple sorted array of integers with negative values
31 const int RandomArrayInt[] = {4, 3, 5, 2, -18, 3, 2, 3, 4, 5, -5}; // Simple random array of integers with negative values
52 EXPECT_EQ(ksortedArray.begin() + 4, KthOrderStatistic<IT>(ksortedArray.begin(), ksortedArray.end(), 4));
55 EXPECT_EQ(ksortedArray.begin(), KthOrderStatistic<IT>(ksortedArray.begin(), ksortedArray.begin(), 0));
58 EXPECT_EQ(ksortedArray.begin(), KthOrderStatistic<IT>(ksortedArray.begin(), ksortedArray.begin() + 1, 0));
61 EXPECT_EQ(ksortedArray.begin(), KthOrderStatistic<IT>(ksortedArray.begin(), ksortedArray.end(), 0));
64 EXPECT_EQ(ksortedArray.end(), KthOrderStatistic<IT>(ksortedArray.begin(), ksortedArray.end(), 100));
80 IT::value_type value = *KthOrderStatistic<IT, GR_Compare>(krandomdArray.begin(), krandomdArray.end(), 1);
Definition: binary.hxx:28
IT KthOrderStatistic(const IT &begin, const IT &end, unsigned int k)
Definition: kth_order_statistic.hxx:48