summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/iterators
Commit message (Collapse)AuthorAgeFilesLines
...
* XFAIL test on apple-clang-7.0Eric Fiselier2016-12-141-1/+1
| | | | llvm-svn: 289716
* Recommit r286884: P0503R0, adopted in Issaquah, rewords some requirements on ↵Eric Fiselier2016-12-143-3/+47
| | | | | | | | | | | | | | | nullptr_t and istream_iterator. No code changes were needed, but I updated a few tests. Also resolved P0509 and P0521, which required no changes to the library or tests. This patch was reverted due to llvm.org/PR31016. There is a bug in Clang 3.7 which causes default.pass.cpp to fails. That test is now marked as XFAIL for that clang version. This patch was originally authored by Marshall Clow. llvm-svn: 289708
* [libcxx] [test] Fix MSVC warning C4244 "conversion from 'X' to 'Y', possible ↵Stephan T. Lavavej2016-12-081-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | loss of data", part 7/7. test/std/input.output/iostream.format/input.streams/istream.unformatted/get.pass.cpp Add static_cast<char> because basic_istream::get() returns int_type (N4606 27.7.2.3 [istream.unformatted]/4). test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/minus1.pass.cpp Add static_cast<char> because toupper() returns int (C11 7.4.2.2/1). test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.ops/assign_t.pass.cpp This test is intentionally writing doubles to ostream_iterator<int>. It's silencing -Wliteral-conversion for Clang, so I'm adding C4244 silencing for MSVC. test/std/language.support/support.limits/limits/numeric.limits.members/infinity.pass.cpp Given `extern float zero;`, the expression `1./zero` has type double, which emits a truncation warning when being passed to test<float>() taking float. The fix is to say `1.f/zero` which has type float. test/std/numerics/complex.number/cmplx.over/arg.pass.cpp test/std/numerics/complex.number/cmplx.over/norm.pass.cpp These tests were constructing std::complex<double>(x, 0), emitting truncation warnings when x is long long. Saying static_cast<double>(x) avoids this. test/std/numerics/rand/rand.eng/rand.eng.lcong/seed_result_type.pass.cpp This was using `int s` to construct and seed a linear_congruential_engine<T, stuff>, where T is unsigned short/unsigned int/unsigned long/unsigned long long. That emits a truncation warning in the unsigned short case. Because the range [0, 20) is tiny and we aren't doing anything else with the index, we can just iterate with `T s`. test/std/re/re.traits/value.pass.cpp regex_traits<wchar_t>::value()'s first parameter is wchar_t (N4606 28.7 [re.traits]/13). This loop is using int to iterate through ['g', 0xFFFF), emitting a truncation warning from int to wchar_t (which is 16-bit for some of us). Because the bound is exclusive, we can just iterate with wchar_t. test/std/strings/basic.string/string.cons/size_char_alloc.pass.cpp This test is a little strange. It's trying to verify that basic_string's (InIt, InIt) range constructor isn't confused by "N copies of C" when N and C have the same integral type. To do this, it was testing (100, 65), but that eventually emits truncation warnings from int to char. There's a simple way to avoid this - passing (static_cast<char>(100), static_cast<char>(65)) also exercises the disambiguation. (And 100 is representable even when char has a signed range.) test/std/strings/string.view/string.view.hash/string_view.pass.cpp Add static_cast<char_type> because `'0' + i` has type int. test/std/utilities/function.objects/bind/func.bind/func.bind.bind/nested.pass.cpp What's more horrible than nested bind()? pow() overloads! This operator()(T a, T b) was assuming that std::pow(a, b) can be returned as T. (In this case, T is int.) However, N4606 26.9.1 [cmath.syn]/2 says that pow(int, int) returns double, so this was truncating double to int. Adding static_cast<T> silences this. test/std/utilities/function.objects/unord.hash/integral.pass.cpp This was iterating `for (int i = 0; i <= 5; ++i)` and constructing `T t(i);` but that's truncating when T is short. (And super truncating when T is bool.) Adding static_cast<T> silences this. test/std/utilities/utility/exchange/exchange.pass.cpp First, this was exchanging 67.2 into an int, but that's inherently truncating. Changing this to static_cast<short>(67) avoids the truncation while preserving the "what if T and U are different" test coverage. Second, this was exchanging {} with the explicit type float into an int, and that's also inherently truncating. Specifying short is just as good. test/std/utilities/utility/pairs/pairs.spec/make_pair.pass.cpp Add static_cast<short>. Note that this affects template argument deduction for make_pair(), better fulfilling the test's intent. For example, this was saying `typedef std::pair<int, short> P1; P1 p1 = std::make_pair(3, 4);` but that was asking make_pair() to return pair<int, int>, which was then being converted to pair<int, short>. (pair's converting constructors are tested elsewhere.) Now, std::make_pair(3, static_cast<short>(4)) actually returns pair<int, short>. (There's still a conversion from pair<nullptr_t, short> to pair<unique_ptr<int>, short>.) Fixes D27544. llvm-svn: 289111
* Enable warnings by default for C++ >= 11 and fix -Wshadow occurancesEric Fiselier2016-12-032-31/+26
| | | | llvm-svn: 288557
* [libcxx] [test] D27027: Strip trailing whitespace.Stephan T. Lavavej2016-11-232-3/+3
| | | | llvm-svn: 287829
* Revert "P0503R0, adopted in Issaquah, rewords some requirements on nullptr_t ↵Vedant Kumar2016-11-153-43/+3
| | | | | | | | | | | | | and istream_iterator. No code changes were needed, but I updated a few tests. Also resolved P0509 and P0521, which required no changes to the library or tests." This reverts commit r286884, because it breaks the Xcode 7 builders: http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-expensive/1583 Here is a PR that tracks the issue: https://llvm.org/bugs/show_bug.cgi?id=31016 llvm-svn: 287004
* P0503R0, adopted in Issaquah, rewords some requirements on nullptr_t and ↵Marshall Clow2016-11-143-3/+43
| | | | | | istream_iterator. No code changes were needed, but I updated a few tests. Also resolved P0509 and P0521, which required no changes to the library or tests. llvm-svn: 286884
* [libcxx] [test] Replace _LIBCPP_STD_VER with TEST_STD_VER.Stephan T. Lavavej2016-11-041-6/+6
| | | | | | | | | | | This replaces every occurrence of _LIBCPP_STD_VER in the tests with TEST_STD_VER. Additionally, for every affected file, #include "test_macros.h" is being added explicitly if it wasn't already there. https://reviews.llvm.org/D26294 llvm-svn: 286007
* Implement another part of P0031; adding constexpr to move_iteratorMarshall Clow2016-11-0224-0/+349
| | | | llvm-svn: 285818
* Adding a missing constexpr test for reverse_iterator operator[].Marshall Clow2016-10-201-0/+11
| | | | llvm-svn: 284731
* Implement constexpr support for reverse_iterator. Reviewed as ↵Marshall Clow2016-10-1923-23/+366
| | | | | | https://reviews.llvm.org/D25534 llvm-svn: 284602
* Add tests for LWG2544. We already implement this; just adding tests to make ↵Marshall Clow2016-10-103-0/+66
| | | | | | sure that we keep doing it. llvm-svn: 283749
* [libcxx] Add missing c++98 xfail. NFC.Asiri Rathnayake2016-09-161-1/+1
| | | | | | This is the only test failing in c++98 mode at the moment. llvm-svn: 281731
* Mark test as XFAIL for C++03, rather than providing a dummy pass.Marshall Clow2016-09-041-5/+2
| | | | llvm-svn: 280605
* std:: quailfy the calls for cend/crend/cbegin/cend. Fixes bug 28927.Marshall Clow2016-08-101-0/+51
| | | | llvm-svn: 278282
* Fix ::reference typedef in insert iterators.Eric Fiselier2016-06-303-6/+6
| | | | | | | | | | | | Since at least the C++11 standard insert iterators are specified as having ::reference typedef void. Libc++ was not doing that. This patch corrects the typedef. This patch changes the std::iterator base class of insert_iterator, front_insert_iterator and back_insert_iterator. This should not be an ABI breaking change. llvm-svn: 274209
* Make instreambuf.iterator/types.pass.cpp more portable.Eric Fiselier2016-06-301-6/+12
| | | | llvm-svn: 274207
* Move remaining _LIBCPP_VERSION tests into test/libcxxEric Fiselier2016-06-221-20/+0
| | | | llvm-svn: 273367
* Replace __cplusplus comparisons and dialect __has_feature checks with ↵Eric Fiselier2016-06-147-8/+22
| | | | | | | | | TEST_STD_VER. This is a huge cleanup that helps make the libc++ test suite more portable. Patch from STL@microsoft.com. Thanks STL! llvm-svn: 272716
* Remove trailing whitespace in test suite. Approved by Marshall Clow.Eric Fiselier2016-06-019-19/+19
| | | | llvm-svn: 271435
* [libcxx] Improve tests to use the UNSUPPORTED lit directiveAsiri Rathnayake2016-05-281-5/+2
| | | | | | | | | | | | | | | | | | | Quite a few libcxx tests seem to follow the format: #if _LIBCPP_STD_VER > X // Do test. #else // Empty test. #endif We should instead use the UNSUPPORTED lit directive to exclude the test on earlier C++ standards. This gives us a more accurate number of test passes for those standards and avoids unnecessary conflicts with other lit directives on the same tests. Reviewers: bcraig, ericwf, mclow.lists Differential revision: http://reviews.llvm.org/D20730 llvm-svn: 271108
* Test hijacking ADL for operator& in the stream iterator constructors.Eric Fiselier2016-05-172-3/+30
| | | | llvm-svn: 269838
* Add test for r269789Eric Fiselier2016-05-171-0/+2
| | | | llvm-svn: 269812
* Void cast runtime-unused variables. Patch from STL@microsoft.comEric Fiselier2016-05-025-0/+5
| | | | llvm-svn: 268284
* Rename a few tests that had typos in their names. No functional change. ↵Marshall Clow2016-04-231-0/+0
| | | | | | Thanks to STL for the catch llvm-svn: 267287
* Fix LWG issue #2106: move_iterators returning prvaluesEric Fiselier2016-04-221-1/+40
| | | | llvm-svn: 267091
* Implement LWG#680, which was missed lo these many moons ago, and was ↵Marshall Clow2016-04-111-2/+2
| | | | | | reported as bug #27259. As a drive-by fix, replace the hand-rolled equivalent to addressof in __wrap_iter with the real thing. llvm-svn: 265914
* Mark some test XFAIL for GCC 4.9 due to missing is_trivial* traitsEric Fiselier2016-01-202-0/+6
| | | | llvm-svn: 258287
* Implement LWG#2353: std::next is over-constrainedMarshall Clow2015-11-071-0/+4
| | | | llvm-svn: 252407
* Suppress clang warnings in some testsEric Fiselier2015-08-301-0/+4
| | | | llvm-svn: 246399
* A few bits of N2994 didn't get fully implemented a long time ago. Thanks to ↵Marshall Clow2015-04-165-8/+79
| | | | | | STL@microsoft.com for the bug report llvm-svn: 235134
* [libcxx] Make __wrap_iter work with gcc.Nico Weber2015-01-271-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | he following snippet doesn't build when using gcc and libc++: #include <string> void f(const std::string& s) { s.begin(); } #include <vector> void AppendTo(const std::vector<char>& v) { v.begin(); } The problem is that __wrap_iter has a private constructor. It lists vector<> and basic_string<> as friends, but gcc seems to ignore this for vector<> for some reason. Declaring vector before the friend declaration in __wrap_iter is enough to work around this problem, so do that. With this patch, I'm able to build chromium/android with libc++. Without it, two translation units fail to build. (iosfwd already provides a forward declaration of basic_string.) As far as I can tell, this is due to a gcc bug, which I filed as https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64816. Fixes PR22355. http://reviews.llvm.org/D7201 llvm-svn: 227226
* Cleaning up the test suite; remove some includes of non-standard file <__config>Marshall Clow2015-01-184-11/+0
| | | | llvm-svn: 226411
* One more #include request in the test suite from Walter BrownMarshall Clow2015-01-111-0/+1
| | | | llvm-svn: 225609
* Move test into test/std subdirectory.Eric Fiselier2014-12-20168-0/+6216
llvm-svn: 224658
OpenPOWER on IntegriCloud