summaryrefslogtreecommitdiff
path: root/libcxx/test/std/strings/basic.string/string.iterators
AgeCommit message (Collapse)Author
2023-09-27[libc++] Refactor string unit tests to ease addition of new allocatorsLouis Dionne
While doing this, I also found a few tests that were either clearly incorrect (e.g. testing the wrong function) or that lacked basic test coverage like testing std::string itself (e.g. the test was only checking std::basic_string with a custom allocator). In these cases, I did a few conservative drive-by changes. Differential Revision: https://reviews.llvm.org/D140550 Co-authored-by: Brendan Emery <brendan.emery@esrlabs.com>
2023-09-01[libc++] Apply clang formatting to all string unit testsBrendan Emery
This applies clang-format to the std::string unit tests in preparation for landing https://reviews.llvm.org/D140550. Differential Revision: https://reviews.llvm.org/D140612
2022-06-13[libcxx][AIX] Switch build compiler to clangJake Egan
This patch switches the build compiler for AIX from ibm-clang to clang. ibm-clang++_r has `-pthread` by default, but clang for AIX doesn't, so `-pthread` had to be added to the test config. A bunch of tests now pass, so the `XFAIL` was removed. This patch also switch the build to use the visibility support available in clang-15 to control symbols exported by the shared library (AIX traditionally uses explicit export lists for this purpose). Reviewed By: #libc, #libc_abi, daltenty, #libunwind, ldionne Differential Revision: https://reviews.llvm.org/D127470
2022-04-27[libc++] Implement P0980R1 (constexpr std::string)Nikolas Klauser
Reviewed By: #libc, ldionne Spies: daltenty, sdasgup3, ldionne, arichardson, MTC, ChuanqiXu, mehdi_amini, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, aartbik, liufengdb, stephenneuendorffer, Joonsoo, grosul1, Kayjukh, jurahul, msifontes, tatianashp, rdzhabarov, teijeong, cota, dcaballe, Chia-hungDuan, wrengr, wenzhicui, arphaman, Mordante, miscco, Quuxplusone, smeenai, libcxx-commits Differential Revision: https://reviews.llvm.org/D110598
2022-03-19[libc++] Prepare string tests for constexprNikolas Klauser
These are the last™ changes to the tests for constexpr preparation. Reviewed By: Quuxplusone, #libc, Mordante Spies: Mordante, EricWF, libcxx-commits Differential Revision: https://reviews.llvm.org/D120951
2022-03-13[libc++] Replace _LIBCPP_HAS_NO_CONCEPTS with _LIBCPP_STD_VER > 17. NFCI.Joe Loser
All supported compilers that support C++20 now support concepts. So, remove `_LIB_LIBCPP_HAS_NO_CONCEPTS` in favor of `_LIBCPP_STD_VER > 17`. Similarly in the tests, remove `// UNSUPPORTED: libcpp-no-concepts`. Differential Revision: https://reviews.llvm.org/D121528
2022-02-10[libc++] Prepare string.{contains, ends_with, iterators, require, ↵Nikolas Klauser
starts_with} tests for constexpr Reviewed By: ldionne, #libc Spies: libcxx-commits Differential Revision: https://reviews.llvm.org/D119304
2022-02-02[libc++][ranges] Implement `indirectly_copyable{,_storable}`.Konstantin Varlamov
Also refactor tests for `indirectly_movable{,_storable}`. Differential Revision: https://reviews.llvm.org/D118432
2022-01-24[libcxx][test] the domain of == for forward iterators is iterator values ↵Casey Carter
from the same range * Default-initialized `basic_string` iterators are not portably in the domain of `==`. * Avoid comparing iterators from non-equal string_views which MSVCSTL considers not to be in the domain of equality. * Don't test invalid range `[in, out + N)`. Also silence some truncation warnings by testing with a non-narrowing conversion. Differential Revision: https://reviews.llvm.org/D118049
2022-01-04[libc++] Fix __wrap_iter copy-assignment in constexpr contextsNikolas Klauser
Fixes https://github.com/llvm/llvm-project/issues/52902 In debug mode during constant evaluation the iterator was never assigend. There seem to be no other instances of this bug. Reviewed By: Quuxplusone, Mordante, #libc, ldionne Spies: ldionne, libcxx-commits Differential Revision: https://reviews.llvm.org/D116346
2021-10-12[libc++] Add an option to disable wide character support in libc++Louis Dionne
Some embedded platforms do not wish to support the C library functionality for handling wchar_t because they have no use for it. It makes sense for libc++ to work properly on those platforms, so this commit adds a carve-out of functionality for wchar_t. Unfortunately, unlike some other carve-outs (e.g. random device), this patch touches several parts of the library. However, despite the wide impact of this patch, I still think it is important to support this configuration since it makes it much simpler to port libc++ to some embedded platforms. Differential Revision: https://reviews.llvm.org/D111265
2021-08-12[libc++] Remove Lit annotations for unsupported GCC versions from the test suiteLouis Dionne
Since we officially don't support several older compilers now, we can drop a lot of the markup in the test suite. This helps keep the test suite simple and makes sure that UNSUPPORTED annotations don't rot. This is the first patch of a series that will remove annotations for compilers that are now unsupported. Differential Revision: https://reviews.llvm.org/D107787
2021-07-01[libcxx][ranges] Implement indirectly_swappable.zoecarver
Differential Revision: https://reviews.llvm.org/D105304
2021-06-21[libcxx][ranges] Add `indirectly_movable` and `indirectly_movable_storable`.zoecarver
Differential Revision: https://reviews.llvm.org/D102639
2021-05-14[libcxx][ranges] Add `contiguous_iterator`.zoecarver
Differential Revision: https://reviews.llvm.org/D101396
2021-05-04[libcxx][ranges] Add `random_access_{iterator,range}`.zoecarver
Differential Revision: https://reviews.llvm.org/D101316
2021-05-03[libcxx][iterator][ranges] adds `bidirectional_iterator` and ↵Christopher Di Bella
`bidirectional_range` Implements parts of: * P0896R4 The One Ranges Proposal` Depends on D100275. Differential Revision: https://reviews.llvm.org/D100278
2021-05-03[libcxx][iterator][ranges] adds `forward_iterator` and `forward_range`Christopher Di Bella
Implements parts of: * P0896R4 The One Ranges Proposal` Depends on D100271. Differential Revision: https://reviews.llvm.org/D100275
2021-05-01[libcxx] Reenable ranges for clang-clMartin Storsjö
This reverts a224bf8ec423b42eea251407e7a6cc8398a5edf4 and fixes the underlying issue. The underlying issue is simply that MSVC headers contains a define like "#define __in", where __in is one macro in the MSVC Source Code Annotation Language, defined in sal.h Just use a different variable name than "__in" __indirectly_readable_impl, and add "__in" to nasty_macros.h just like the existing __out. (Also adding a couple more potentially conflicting ones.) Differential Revision: https://reviews.llvm.org/D101613
2021-04-30[libcxx][iterator][ranges] adds `input_iterator` and `input_range`Christopher Di Bella
Implements parts of: * P0896R4 The One Ranges Proposal` Depends on D100269. Differential Revision: https://reviews.llvm.org/D100271
2021-04-29[libcxx][ranges] Fix tests for stdlib types that conform to sized_sentinel_for.zoecarver
Differential Revision: https://reviews.llvm.org/D101371
2021-04-28[libc++] [test] Don't assume iterators are class types.Arthur O'Dwyer
In particular, `span<int>::iterator` may be a raw pointer type and thus have no nested typedef `iterator::value_type`. However, we already know that the value_type we expect for `span<int>` is just `int`. Fix up all other iterator_concept_conformance tests in the same way. Differential Revision: https://reviews.llvm.org/D101420
2021-04-26[libc++][ranges] iterator.concept.sizedsentinel: sized_sentinel_for and ↵zoecarver
disable_sized_sentinel_for. Based on D100160. Reviewed By: cjdb, ldionne, Quuxplusone, #libc, miscco Differential Revision: https://reviews.llvm.org/D100587
2021-04-24[libcxx][iterator] adds `std::input_or_output_iterator` and `std::sentinel_for`Christopher Di Bella
Implements parts of: * P0896R4 The One Ranges Proposal` Depends on D100080 Differential Revision: https://reviews.llvm.org/D100160
2021-04-23[libcxx][iterator] adds `std::weakly_incrementable` and `std::incrementable`Christopher Di Bella
Implements parts of: * P0896R4 The One Ranges Proposal` Depends on D100073. Reviewed By: ldionne, zoecarver, #libc Differential Revision: https://reviews.llvm.org/D100080
2021-04-23[libcxx] disables ranges for clang-clChristopher Di Bella
clang-cl doesn't properly handle concepts right now and is failing CI. Differential Revision: https://reviews.llvm.org/D101205
2021-04-23Implement N3644 "Null Forward Pointers" in _LIBCPP_DEBUG mode.Arthur O'Dwyer
This functionality is tested in std/containers/sequences/vector/iterators.pass.cpp (and similarly for all containers, but vector is the only one to be tested that uses debug iterators). Differential Revision: https://reviews.llvm.org/D100881
2021-04-22[libc++] Re-apply `std::indirectly_readable` and `std::indirectly_writable`Louis Dionne
That was originally committed in 04733181b513 and then reverted in a9f11cc0d965 because it broke several people. The problem was a missing include of __iterator/concepts.h, which has now been fixed. Differential Revision: https://reviews.llvm.org/D100073
2021-04-22Revert "[libcxx][iterator] adds `std::indirectly_readable` and ↵David Zarzycki
`std::indirectly_writable`" This reverts commit 04733181b5136e2b3df2b37c6bdd9e25f8afecd0 which was failing for multiple people.
2021-04-21[libcxx][iterator] adds `std::indirectly_readable` and ↵Christopher Di Bella
`std::indirectly_writable` Implements parts of: * P0896R4 The One Ranges Proposal` Depends on D99873. Reviewed By: ldionne, #libc Differential Revision: https://reviews.llvm.org/D100073
2020-10-05[libc++] Fix several debug mode testsLouis Dionne
These tests were only being run when _LIBCPP_DEBUG was defined, which isn't the case by default when we run the test suite. In other words, all these debug mode tests were never being run. This commit makes sure they are run, and in some cases, extracts them into a file under test/libcxx to separate them from the Standard tests. Differential Revision: https://reviews.llvm.org/D88836
2020-06-03[libc++] Remove the c++98 Lit feature from the test suiteLouis Dionne
C++98 and C++03 are effectively aliases as far as Clang is concerned. As such, allowing both std=c++98 and std=c++03 as Lit parameters is just slightly confusing, but provides no value. It's similar to allowing both std=c++17 and std=c++1z, which we don't do. This was discovered because we had an internal bot that ran the test suite under both c++98 AND c++03 -- one of which is redundant. Differential Revision: https://reviews.llvm.org/D80926
2019-05-31Add include for 'test_macros.h' to all the tests that were missing them. ↵Marshall Clow
Thanks to Zoe for the (big, but simple) patch. NFC intended. llvm-svn: 362252
2019-05-01Get rid of a bunch of 'unused variable' warnings in test when run with ↵Marshall Clow
debug_level set. NFC llvm-svn: 359672
2019-02-04Support tests in freestandingJF Bastien
Summary: Freestanding is *weird*. The standard allows it to differ in a bunch of odd manners from regular C++, and the committee would like to improve that situation. I'd like to make libc++ behave better with what freestanding should be, so that it can be a tool we use in improving the standard. To do that we need to try stuff out, both with "freestanding the language mode" and "freestanding the library subset". Let's start with the super basic: run the libc++ tests in freestanding, using clang as the compiler, and see what works. The easiest hack to do this: In utils/libcxx/test/config.py add: self.cxx.compile_flags += ['-ffreestanding'] Run the tests and they all fail. Why? Because in freestanding `main` isn't special. This "not special" property has two effects: main doesn't get mangled, and main isn't allowed to omit its `return` statement. The first means main gets mangled and the linker can't create a valid executable for us to test. The second means we spew out warnings (ew) and the compiler doesn't insert the `return` we omitted, and main just falls of the end and does whatever undefined behavior (if you're luck, ud2 leading to non-zero return code). Let's start my work with the basics. This patch changes all libc++ tests to declare `main` as `int main(int, char**` so it mangles consistently (enabling us to declare another `extern "C"` main for freestanding which calls the mangled one), and adds `return 0;` to all places where it was missing. This touches 6124 files, and I apologize. The former was done with The Magic Of Sed. The later was done with a (not quite correct but decent) clang tool: https://gist.github.com/jfbastien/793819ff360baa845483dde81170feed This works for most tests, though I did have to adjust a few places when e.g. the test runs with `-x c`, macros are used for main (such as for the filesystem tests), etc. Once this is in we can create a freestanding bot which will prevent further regressions. After that, we can start the real work of supporting C++ freestanding fairly well in libc++. <rdar://problem/47754795> Reviewers: ldionne, mclow.lists, EricWF Subscribers: christof, jkorous, dexonsmith, arphaman, miyuki, libcxx-commits Differential Revision: https://reviews.llvm.org/D57624 llvm-svn: 353086
2019-01-19Update more file headers across all of the LLVM projects in the monorepoChandler Carruth
to reflect the new license. These used slightly different spellings that defeated my regular expressions. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351648
2018-12-11Second part of P0482 - char8_t. Reviewed as https://reviews.llvm.org/D55308Marshall Clow
llvm-svn: 348828
2016-12-06[libcxx] [test] D27022: Fix MSVC warning C4389 "signed/unsigned mismatch", ↵Stephan T. Lavavej
part 9/12. Add static_cast<std::size_t> to more comparisons. (Performed manually, unlike part 8/12.) Also, include <cstddef> when it wasn't already being included. llvm-svn: 288746
2016-06-14Replace __cplusplus comparisons and dialect __has_feature checks with ↵Eric Fiselier
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
2016-06-01Remove trailing whitespace in test suite. Approved by Marshall Clow.Eric Fiselier
llvm-svn: 271435
2016-05-28[libcxx] Improve tests to use the UNSUPPORTED lit directiveAsiri Rathnayake
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
2014-12-20Move test into test/std subdirectory.Eric Fiselier
llvm-svn: 224658