diff options
| author | Stjepan Glavina <stjepang@gmail.com> | 2017-03-21 02:38:03 +0100 |
|---|---|---|
| committer | Stjepan Glavina <stjepang@gmail.com> | 2017-03-21 20:46:20 +0100 |
| commit | a718051f63308638ecf40a7570dbd18f4fc99703 (patch) | |
| tree | 4a0c488b1fa8fcef586b4fc81459675435134e60 /src/libcore/slice/mod.rs | |
| parent | a18b2aa641da7c000fea9e9ac62d2da89fa034ad (diff) | |
Unit test heapsort
Diffstat (limited to 'src/libcore/slice/mod.rs')
| -rw-r--r-- | src/libcore/slice/mod.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/libcore/slice/mod.rs b/src/libcore/slice/mod.rs index 53cbdd84c3a..6f8b199f886 100644 --- a/src/libcore/slice/mod.rs +++ b/src/libcore/slice/mod.rs @@ -2253,6 +2253,15 @@ pub unsafe fn from_raw_parts_mut<'a, T>(p: *mut T, len: usize) -> &'a mut [T] { mem::transmute(Repr { data: p, len: len }) } +// This function is public only because there is no other way to unit test heapsort. +#[unstable(feature = "sort_internals", reason = "internal to sort module", issue = "0")] +#[doc(hidden)] +pub fn heapsort<T, F>(v: &mut [T], mut is_less: F) + where F: FnMut(&T, &T) -> bool +{ + sort::heapsort(v, &mut is_less); +} + // // Comparison traits // |
