about summary refs log tree commit diff
path: root/src/libcore/tests
AgeCommit message (Collapse)AuthorLines
2019-04-03Rollup merge of #55448 - Mokosha:SortAtIndex, r=blussMazdak Farrokhzad-0/+119
Add 'partition_at_index/_by/_by_key' for slices. This is an analog to C++'s std::nth_element (a.k.a. quickselect). Corresponds to tracking bug #55300.
2019-04-02Rollup merge of #59444 - cuviper:steps_between, r=scottmcmMazdak Farrokhzad-0/+61
Implement useful steps_between for all integers We can use `usize::try_from` to convert steps from any size of integer. This enables a meaningful `size_hint()` for larger ranges, rather than always just `(0, None)`. Now they return the true `(len, Some(len))` when it fits, otherwise `(usize::MAX, None)` for overflow.
2019-03-31Stabilize refcell_replace_swap feature, closes #43570Jean-Marie Comets-1/+0
2019-03-28Rollup merge of #58717 - hellow554:nonzero_parse, r=oli-obkMazdak Farrokhzad-3/+24
Add FromStr impl for NonZero types This is a WIP implementation because I do have some questions regarding the solution. Somebody should ping the lang team on this I guess. Please see the annotations on the code for more details. Closes #58604
2019-03-27Rollup merge of #59393 - czipperz:refactor_tuple_comparison_tests, r=shepmasterJosh Stone-20/+24
Refactor tuple comparison tests
2019-03-26Test the size_hint of empty ranges tooJosh Stone-0/+12
2019-03-26Implement useful steps_between for all integersJosh Stone-0/+49
We can use `usize::try_from` to convert steps from any size of integer. This enables a meaningful `size_hint()` for larger ranges, rather than always just `(0, None)`. Now they return the true `(len, Some(len))` when it fits, otherwise `(usize::MAX, None)` for overflow.
2019-03-25Refactor tuple comparison testsChris Gregory-20/+24
2019-03-24Rollup merge of #59328 - koalatux:iter-nth-back, r=scottmcmkennytm-0/+13
Implement specialized nth_back() for Box and Windows. Hi there, this is my first pull request to rust :-) I started implementing some specializations for DoubleEndedIterator::nth_back() and these are the first two. The problem has been discussed in #54054 and nth_back() is tracked in #56995. I'm stuck with the next implementation so I though I do a PR for the ones I'm confident with to get some feedback.
2019-03-19Rollup merge of #59280 - joshlf:sandbox/joshlf/stabilize-refcell-map-split, ↵Mazdak Farrokhzad-1/+0
r=cramertj,Centril Stabilize refcell_map_split feature Closes #51476.
2019-03-19Rollup merge of #58778 - xfix:exact_size_case_mapping_iter, r=SimonSapinMazdak Farrokhzad-0/+4
Implement ExactSizeIterator for ToLowercase and ToUppercase
2019-03-18Stabilize refcell_map_split featureJoshua Liebow-Feeser-1/+0
- Closes #51476
2019-03-16Rollup merge of #59231 - matklad:copied, r=Centrilkennytm-1/+0
Stabilize Option::copied closes https://github.com/rust-lang/rust/issues/57126
2019-03-16Rollup merge of #59206 - sntdevco:master, r=dtolnaykennytm-34/+34
Improved test output
2019-03-16Rollup merge of #59072 - RalfJung:miri-alloc-tests, r=kennytmkennytm-34/+0
we can now skip should_panic tests with the libtest harness
2019-03-16Stabilize Option::copiedAleksey Kladov-1/+0
closes https://github.com/rust-lang/rust/issues/57126
2019-03-15Improved test output for libcore/num/int_macrossntdevco-24/+24
2019-03-15Improved test output for libcore/opssntdevco-4/+4
2019-03-15Improved test output for libcore/cellsntdevco-6/+6
2019-03-13Rollup merge of #59138 - timvermeulen:simplify_select_fold1, r=sfacklerMazdak Farrokhzad-0/+28
Simplify Iterator::{min, max} This PR simplifies the `select_fold1` helper method used to implmement `Iterator::{min, min_by, min_by_key, max, max_by, max_by_key}` by removing the projection argument, which was only used by the implementations of `min_by_key` and `max_by_key`. I also added tests to ensure that the stability as mentioned in the comments of `min` and `max` is preserved, and fixed the `iter::{bench_max, bench_max_by_key}` benchmarks which the compiler presumably was able to collapse into closed-form expressions. None of the benchmark results were impacted, I suspect their generated assembly didn't change.
2019-03-12Add tests to ensure that Iterator::min and Iterator::max are stableTim Vermeulen-0/+28
2019-03-12Replace assert with assert_eq for better debuggingSayan Nandan-118/+118
2019-03-11Add initial implementation of 'sort_at_index' for slices -- analog to C++'s ↵Pavel Krajcevski-0/+119
std::nth_element (a.k.a. quickselect) Add some more notes to the documentation: - Mention that the median can be found if we used `len() / 2`. - Mention that this function is usually called "kth element" in other libraries. Address some comments in PR: - Change wording on some of the documentation - Change recursive function into a loop Update name to `partition_at_index` and add convenience return values. Address reviewer comments: - Don't swap on each iteration when searching for min/max element. - Add some docs about when we panic. - Test that the sum of the lengths of the output matches the length of the input. - Style fix for for-loop. Address more reviewer comments Fix Rng stuff for test Fix doc test build Don't run the partition_at_index test on wasm targets Miri does not support entropy for test partition_at_index
2019-03-10we can now skip should_panic tests with the libtest harnessRalf Jung-34/+0
2019-02-28fixed tests againMarcel Hellwig-14/+12
2019-02-28add feature flag to testMarcel Hellwig-0/+1
2019-02-28fixed nonzero testsMarcel Hellwig-4/+3
2019-02-27replaced nonzeroparseerror with regular interrorMarcel Hellwig-7/+13
2019-02-27Remove copy paste error in char testsOliver Middleton-1/+1
Co-Authored-By: xfix <konrad@borowski.pw>
2019-02-27Implement ExactSizeIterator for ToLowercase and ToUppercaseKonrad Borowski-0/+4
2019-02-25Auto merge of #58302 - SimonSapin:tryfrom, r=alexcrichtonbors-1/+0
Stabilize TryFrom and TryInto with a convert::Infallible empty enum This is the plan proposed in https://github.com/rust-lang/rust/issues/33417#issuecomment-423073898
2019-02-25Add FromStr impl for NonZero typesMarcel Hellwig-0/+17
2019-02-24implement nth_back for WindowsAdrian Friedli-0/+13
2019-02-23Rollup merge of #58122 - matthieu-m:range_incl_perf, r=dtolnayMazdak Farrokhzad-3/+21
RangeInclusive internal iteration performance improvement. Specialize `Iterator::try_fold` and `DoubleEndedIterator::try_rfold` to improve code generation in all internal iteration scenarios. This changes brings the performance of internal iteration with `RangeInclusive` on par with the performance of iteration with `Range`: - Single conditional jump in hot loop, - Unrolling and vectorization, - And even Closed Form substitution. Unfortunately, it only applies to internal iteration. Despite various attempts at stream-lining the implementation of `next` and `next_back`, LLVM has stubbornly refused to optimize external iteration appropriately, leaving me with a choice between: - The current implementation, for which Closed Form substitution is performed, but which uses 2 conditional jumps in the hot loop when optimization fail. - An implementation using a `is_done` boolean, which uses 1 conditional jump in the hot loop when optimization fail, allowing unrolling and vectorization, but for which Closed Form substitution fails. In the absence of any conclusive evidence as to which usecase matters most, and with no assurance that the lack of Closed Form substitution is not indicative of other optimizations being foiled, there is no way to pick one implementation over the other, and thus I defer to the statu quo as far as `next` and `next_back` are concerned.
2019-02-20Rollup merge of #58576 - SimonSapin:successors, r=Centrilkennytm-1/+0
Stabilize iter::successors and iter::from_fn FCP: https://github.com/rust-lang/rust/issues/58045#issuecomment-464674773, https://github.com/rust-lang/rust/issues/55977#issuecomment-463964234
2019-02-19Stabilize iter::from_fnSimon Sapin-1/+0
FCP: https://github.com/rust-lang/rust/issues/55977#issuecomment-463964234
2019-02-17Remove UB in test_ptr_subtraction testKonrad Borowski-2/+4
2019-02-17Remove UB in test_is_null testKonrad Borowski-3/+2
2019-02-13review failures in btree, stringRalf Jung-1/+0
2019-02-13the formatting issue got fixedRalf Jung-3/+3
2019-02-13review or fix remaining miri failures in libcoreRalf Jung-9/+28
2019-02-13Stabilize TryFrom and TryIntoSimon Sapin-1/+0
2019-02-13review or fix miri failures in iter, slice, cell, timeRalf Jung-15/+11
2019-02-13mark failures expected due to panicsRalf Jung-15/+15
2019-02-10libs: doc commentsAlexander Regueiro-2/+2
2019-02-09Fix exhaustion of inclusive range try_fold and try_rfoldMatthieu M-3/+21
2019-02-07disable tests in MiriRalf Jung-0/+38
2019-01-22Auto merge of #57475 - SimonSapin:signed, r=estebankbors-1/+9
Add signed num::NonZeroI* types Multiple people have asked for them in https://github.com/rust-lang/rust/issues/49137. Given that the unsigned ones already exist, they are very easy to add and not an additional maintenance burden.
2019-01-17Add is_sorted impl for [T]Kevin Leimkuhler-0/+15
2019-01-17Add initial impl of is_sorted to IteratorKevin Leimkuhler-0/+14