summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/containers/views
Commit message (Collapse)AuthorAgeFilesLines
* [libcxx][test] Fix span tests.Stephan T. Lavavej2020-01-086-38/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | span.cons/container.pass.cpp N4842 22.7.3.2 [span.cons]/13 constrains span's range constructor for ranges::contiguous_range (among other criteria). 24.4.5 [range.refinements]/2 says that contiguous_range requires data(), and (via contiguous_range, random_access_range, bidirectional_range, forward_range, input_range, range) it also requires begin() and end() (see 24.4.2 [range.range]/1). Therefore, IsAContainer needs to provide begin() and end(). (Detected by MSVC's concept-constrained implementation.) span.cons/stdarray.pass.cpp This test uses std::array, so it must include <array>. <span> isn't guaranteed to drag in <array>. (Detected by MSVC's implementation which uses a forward declaration to avoid dragging in <array>, for increased compiler throughput.) span.objectrep/as_bytes.pass.cpp span.objectrep/as_writable_bytes.pass.cpp Testing `sp.extent == std::dynamic_extent` triggers MSVC warning C4127 "conditional expression is constant". Using `if constexpr` is a simple way to avoid this without disrupting anyone else (as span requires C++20 mode). span.tuple/get.pass.cpp 22.7.3.2 [span.cons]/4.3: "Preconditions: If extent is not equal to dynamic_extent, then count is equal to extent." These lines were triggering undefined behavior (detected by assertions in MSVC's implementation). I changed the count arguments in the first two chunks, followed by changing the span extents, in order to preserve the test's coverage and follow the existing pattern. span.cons/span.pass.cpp 22.7.3.2 [span.cons]/18.1 constrains span's converting constructor with "Extent == dynamic_extent || Extent == OtherExtent is true". This means that converting from dynamic extent to static extent is not allowed. (Other constructors tested elsewhere, like span(It first, size_type count), can be used to write such code.) As this is the test for the converting constructor, I have: * Removed the "dynamic -> static" case from checkCV(), which is comprehensive. * Changed the initialization of std::span<T, 0> s1{}; in testConstexprSpan() and testRuntimeSpan(), because s1 is used below. * Removed ASSERT_NOEXCEPT(std::span<T, 0>{s0}); from those functions, as they are otherwise comprehensive. * Deleted testConversionSpan() entirely. Note that this could never compile (it had a bool return type, but forgot to say `return`). And it couldn't have provided useful coverage, as the /18.2 constraint "OtherElementType(*)[] is convertible to ElementType(*)[]" permits only cv-qualifications, which are already tested by checkCV().
* [libc++][P1872] span should have size_type, not index_type.Louis Dionne2019-11-1411-16/+16
| | | | | | Thanks to Marek Kurdej for the patch. Differential Revision: https://reviews.llvm.org/D70206
* [NFC] Strip trailing whitespace from libc++Louis Dionne2019-10-231-1/+1
|
* Fix test failures when using a custom ABI namespace.Richard Smith2019-06-241-2/+2
| | | | llvm-svn: 364239
* Add include for 'test_macros.h' to all the tests that were missing them. ↵Marshall Clow2019-05-311-0/+2
| | | | | | Thanks to Zoe for the (big, but simple) patch. NFC intended. llvm-svn: 362252
* [libc++] Rename span's as_writeable_bytes to as_writable_bytesLouis Dionne2019-03-283-52/+52
| | | | | | | | | | | | Summary: The Standard says as_writable_bytes. Reviewers: mclow.lists, EricWF Subscribers: christof, jkorous, dexonsmith, libcxx-commits Differential Revision: https://reviews.llvm.org/D59882 llvm-svn: 357139
* Fix occurrences of _LIBCPP_ASSERT in span testsCasey Carter2019-03-273-8/+8
| | | | llvm-svn: 357092
* Eradicate all the ptrdiff_ts in span left over from applying P1227. A couple ↵Marshall Clow2019-03-0611-26/+26
| | | | | | of other minor cleanups. NFC llvm-svn: 355481
* Implment the last part of P1024: tuple-like interface to span. Reviewed as ↵Marshall Clow2019-02-276-0/+248
| | | | | | https://reviews.llvm.org/D58706. llvm-svn: 354988
* Fix an ambiguity in the tests that gcc-tot complained about.Marshall Clow2019-02-2711-22/+22
| | | | llvm-svn: 354944
* First part of P1227R2 - change span over to use 'size_t' instead of ↵Marshall Clow2019-02-275-18/+18
| | | | | | 'ptrdiff_t'. Reviewed as https://reviews.llvm.org/D58639. llvm-svn: 354936
* LWG3101 - span's Container constructors need another constraint. Reviewed as ↵Marshall Clow2019-02-252-50/+10
| | | | | | https://reviews.llvm.org/D57058. llvm-svn: 354805
* Commit LWG3144 - span does not have a const_pointer typedef. Reviewed as D57039.Marshall Clow2019-02-251-0/+4
| | | | llvm-svn: 354802
* First part of P1024: Usability Enhancements for std::span. Remove operator() ↵Marshall Clow2019-02-253-8/+154
| | | | | | for indexing, and add 'front' and 'back' calls. llvm-svn: 354801
* Support tests in freestandingJF Bastien2019-02-0432-32/+96
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* While reviewing D57058, Louis had some questions about the existing span ↵Marshall Clow2019-01-222-36/+69
| | | | | | constructor tests. They were not testing the stuff that they said they were. Updated the tests to test what they should have been doing llvm-svn: 351887
* Update more file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-1932-128/+96
| | | | | | | | | | | | | | | | | | 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
* Fix static assert diagnostic checks in i386Eric Fiselier2018-12-151-1/+1
| | | | llvm-svn: 349252
* Tolerate Clangs new static_assert messagesEric Fiselier2018-12-141-1/+1
| | | | llvm-svn: 349189
* Implement P1085R2 - Should Span be Regular?. This consists entirely of deletionsMarshall Clow2018-11-276-950/+0
| | | | llvm-svn: 347672
* [libcxx] [test] Strip trailing whitespace. NFC.Stephan T. Lavavej2018-11-1438-154/+154
| | | | llvm-svn: 346826
* Mark LWG#3102 as complete. No code changes, but I updated a test or twoMarshall Clow2018-09-131-0/+6
| | | | llvm-svn: 342103
* Disable 'suggest braces' warnings for std::array in testsMarshall Clow2018-07-242-0/+7
| | | | llvm-svn: 337808
* Implement <span>. Reviewed as https://reviews.llvm.org/D49338Marshall Clow2018-07-2438-0/+4408
llvm-svn: 337804
OpenPOWER on IntegriCloud