summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std
Commit message (Collapse)AuthorAgeFilesLines
...
* [libcxx] [test] Fix MSVC warning C4244 "conversion from 'X' to 'Y', possible ↵Stephan T. Lavavej2016-12-0810-85/+85
| | | | | | | | | | | | | | | | | | | | | loss of data", part 5/7. Instead of storing double in double and then truncating to int, store int in long and then widen to long long. This preserves test coverage (as these tests are interested in various tuple conversions) while avoiding truncation warnings. test/std/utilities/tuple/tuple.tuple/tuple.cnstr/const_pair.pass.cpp Since we aren't physically truncating anymore, t1 is equal to p0. test/std/utilities/tuple/tuple.tuple/tuple.cnstr/convert_copy.pass.cpp One edit is different from the usual pattern. Previously, we were storing double in double and then converting to A, which has an implicitly converting constructor from int. Now, we're storing int in int and then converting to A, avoiding the truncation. Fixes D27542. llvm-svn: 289109
* [libcxx] [test] Fix MSVC warning C4244 "conversion from 'X' to 'Y', possible ↵Stephan T. Lavavej2016-12-082-55/+55
| | | | | | | | | | | loss of data", part 4/7. Change char to long and remove some char casts. This preserves test coverage for tuple's heterogeneous comparisons, while avoiding int-to-char truncation warnings. Fixes D27541. llvm-svn: 289108
* [libcxx] [test] Fix MSVC warning C4244 "conversion from 'X' to 'Y', possible ↵Stephan T. Lavavej2016-12-0816-60/+60
| | | | | | | | | | loss of data", part 3/7. Add static_cast<short> when constructing pair<Whatever, short> from (Something, int). Fixes D27540. llvm-svn: 289107
* [libcxx] [test] Fix MSVC warning C4244 "conversion from 'X' to 'Y', possible ↵Stephan T. Lavavej2016-12-085-10/+10
| | | | | | | | | | | | | loss of data", part 2/7. These tests for some guy's transparent operator functors were needlessly truncating their double results to int. Preserving the doubleness makes compilers happier. I'm following existing practice by adding an "// exact in binary" comment when the result isn't a whole number. (The changes from 6 to 6.0 and so forth are stylistic, not critical.) Fixes D27539. llvm-svn: 289106
* [libcxx] [test] Fix MSVC warning C4244 "conversion from 'X' to 'Y', possible ↵Stephan T. Lavavej2016-12-0831-31/+31
| | | | | | | | | | | | | loss of data", part 1/7. Given `std::basic_streambuf<CharT>::int_type __c`, `std::basic_string<CharT> str_`, and having checked `__c != std::basic_streambuf<CharT>::traits_type::eof()` (substituting typedefs for clarity), the line `str_.push_back(__c);` is safe according to humans, but truncates according to compilers. `str_.push_back(static_cast<CharT>(__c));` avoids that problem. Fixes D27538. llvm-svn: 289105
* Add more test cases to packaged_task copyability testEric Fiselier2016-12-081-2/+4
| | | | llvm-svn: 289034
* Avoid C++17 guaranteed copy elision when testing for non-copyabilityEric Fiselier2016-12-082-3/+4
| | | | llvm-svn: 289033
* std::get<0>([std::variant constant expression]) *is* noexcept.Casey Carter2016-12-062-2/+40
| | | | | | Differential review: http://reviews.llvm.org/D27436 llvm-svn: 288760
* [libcxx] [test] D27269: Fix MSVC x64 warning C4267 "conversion from 'size_t' ↵Stephan T. Lavavej2016-12-067-10/+11
| | | | | | | | | | | | | | | | | | | | | | | | to 'int' [or 'unsigned int'], possible loss of data", part 3/4. test/std/containers/sequences/vector.bool/copy.pass.cpp test/std/containers/sequences/vector.bool/copy_alloc.pass.cpp test/std/containers/sequences/vector/vector.cons/copy.pass.cpp test/std/containers/sequences/vector/vector.cons/copy_alloc.pass.cpp Change "unsigned s = x.size();" to "typename C::size_type s = x.size();" because that's what it returns. test/std/strings/basic.string/string.cons/pointer_alloc.pass.cpp Include <cstddef>, then change "unsigned n = T::length(s);" to "std::size_t n = T::length(s);" because that's what char_traits returns. test/std/strings/basic.string/string.cons/substr.pass.cpp Change unsigned to typename S::size_type because that's what str.size() returns. test/std/utilities/template.bitset/bitset.cons/ull_ctor.pass.cpp This was needlessly truncating std::size_t to unsigned. It's being used to compare and initialize std::size_t. llvm-svn: 288753
* [libcxx] [test] D27268: Fix MSVC x64 warning C4267 "conversion from 'size_t' ↵Stephan T. Lavavej2016-12-061-2/+2
| | | | | | | | | | | | | to 'int' [or 'unsigned int'], possible loss of data", part 2/4. Use static_cast<int> when storing size_t in int (or passing size_t to int). Also, remove a spurious semicolon in test/support/archetypes.hpp. test/support/count_new.hpp Additionally, change data members (and parameters) to size_t. llvm-svn: 288752
* [libcxx] [test] D27267: Fix MSVC x64 warning C4267 "conversion from 'size_t' ↵Stephan T. Lavavej2016-12-0635-35/+35
| | | | | | | | | | | | to 'int' [or 'unsigned int'], possible loss of data", part 1/4. Replace "int n = str_.size();" with "int n = static_cast<int>(str_.size());". int is the correct type to use, because we're eventually calling "base::pbump(n+1);" where base is std::basic_streambuf. N4606 27.6.3.3.3 [streambuf.put.area]/4 declares: "void pbump(int n);" llvm-svn: 288751
* [libcxx] [test] D27266: Remove spurious semicolons.Stephan T. Lavavej2016-12-0612-23/+23
| | | | llvm-svn: 288750
* [libcxx] [test] D27025: Fix MSVC warning C4389 "signed/unsigned mismatch", ↵Stephan T. Lavavej2016-12-065-7/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | part 12/12. Various changes: test/std/algorithms/alg.sorting/alg.merge/inplace_merge.pass.cpp This is comparing value_type to unsigned. value_type is sometimes int and sometimes struct S (implicitly constructible from int). static_cast<value_type>(unsigned) silences the warning and doesn't do anything bad (as the values in question are small). test/std/algorithms/alg.sorting/alg.nth.element/nth_element_comp.pass.cpp This is comparing an int remote-element to size_t. The values in question are small and non-negative, so either type is fine. I think that converting int to size_t is marginally better here than the reverse. test/std/containers/sequences/deque/deque.cons/size.pass.cpp DefaultOnly::count is int (and non-negative). When comparing to unsigned, use static_cast<unsigned>. test/std/strings/basic.string/string.access/index.pass.cpp We're comparing char to '0' through '9', but formed with the type size_t. Add static_cast<char>. test/std/utilities/template.bitset/bitset.cons/ull_ctor.pass.cpp Include <cstddef> for pedantic correctness (this test was already mentioning std::size_t). "v[i] == (i & 1)" was comparing bool to size_t. Saying "v[i] == ((i & 1) != 0)" smashes the RHS to bool. llvm-svn: 288749
* [libcxx] [test] D27024: Fix MSVC warning C4389 "signed/unsigned mismatch", ↵Stephan T. Lavavej2016-12-067-17/+17
| | | | | | | | | | | | part 11/12. Change "unsigned n = 0;" to "int n = 0;". It's being compared to int elements and ptrdiff_t distances. test/std/containers/sequences/forwardlist/forwardlist.cons/move.pass.cpp This one's a little special, but not really. "*i == n" is comparing MoveOnly to n. MoveOnly is implicitly constructible from int, so int is the correct type to use here. llvm-svn: 288748
* [libcxx] [test] D27023: Fix MSVC warning C4389 "signed/unsigned mismatch", ↵Stephan T. Lavavej2016-12-066-15/+15
| | | | | | | | | | | | part 10/12. Add static_cast<int>. In these cases, the values are guaranteed to be small-ish, and they're being compared to int elements. test/std/containers/sequences/deque/deque.capacity/access.pass.cpp Use int instead of unsigned to iterate from 0 to 10. llvm-svn: 288747
* [libcxx] [test] D27022: Fix MSVC warning C4389 "signed/unsigned mismatch", ↵Stephan T. Lavavej2016-12-0623-49/+69
| | | | | | | | | | 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
* [libcxx] [test] D27021: Fix MSVC warning C4389 "signed/unsigned mismatch", ↵Stephan T. Lavavej2016-12-06117-943/+1046
| | | | | | | | | | | | | | | | | | | | | part 8/12. Add static_cast<std::size_t> when comparing distance() to size(). These replacements were performed programmatically with regex_replace(): const vector<pair<regex, string>> reg_fmt = { { regex(R"(assert\((\w+)\.size\(\) == std::distance\((\w+, \w+)\)\))"), "assert($1.size() == static_cast<std::size_t>(std::distance($2)))" }, { regex(R"(assert\(distance\((\w+\.begin\(\), \w+\.end\(\))\) == (\w+)\.size\(\)\))"), "assert(static_cast<std::size_t>(distance($1)) == $2.size())" }, { regex(R"(assert\(std::distance\((\w+\.\w*begin\(\), \w+\.\w*end\(\))\) == (\w+)\.size\(\)\))"), "assert(static_cast<std::size_t>(std::distance($1)) == $2.size())" }, }; Also, include <cstddef> when it wasn't already being included. llvm-svn: 288745
* Adjust libc++ test infastructure to fully support modulesEric Fiselier2016-12-0524-55/+39
| | | | | | | | | | | | This patch overhalls the libc++ test format/configuration in order to fully support modules. By "fully support" I mean get almost all of the tests passing. The main hurdle for doing this is handling tests that `#define _LIBCPP_FOO` macros to test a different configuration. This patch deals with these tests in the following ways: 1. For tests that define single `_LIBCPP_ABI_FOO` macros have been annotated with `// MODULES_DEFINES: _LIBCPP_ABI_FOO`. This allows the test suite to define the macro on the command line so it uses a different set of modules. 2. Tests for libc++'s debug mode (which define custom `_LIBCPP_ASSERT`) are automatically detected by the test suite and are compiled and run with modules disabled. This patch also cleans up how the `CXXCompiler` helper class handles enabling/disabling language features. NOTE: This patch uses `LIT` features which were only committed to LLVM today. If this patch breaks running the libc++ tests you probably need to update LLVM. llvm-svn: 288728
* Work around more -Wshadow warningsEric Fiselier2016-12-031-1/+1
| | | | llvm-svn: 288573
* Revert workaround for Clang bug. Thanks to Richard for the quick fixEric Fiselier2016-12-031-5/+1
| | | | llvm-svn: 288566
* XFAIL variant tests for apple-clangEric Fiselier2016-12-032-2/+2
| | | | llvm-svn: 288559
* Enable warnings by default for C++ >= 11 and fix -Wshadow occurancesEric Fiselier2016-12-039-42/+40
| | | | llvm-svn: 288557
* Work around Clang 3.8 bugsEric Fiselier2016-12-034-47/+6
| | | | llvm-svn: 288556
* Make variant's index part of the hash valueEric Fiselier2016-12-021-0/+13
| | | | llvm-svn: 288554
* Implement C++17 <variant>. Patch from Michael Park!Eric Fiselier2016-12-0223-164/+162
| | | | | | This patch was reviewed as https://reviews.llvm.org/D23263. llvm-svn: 288547
* Work around a bug in Clang's implementation of noexcept function typesEric Fiselier2016-12-021-1/+5
| | | | llvm-svn: 288544
* Fix copy/paste errors in new variant testsEric Fiselier2016-12-022-6/+6
| | | | llvm-svn: 288538
* Add tests for libc++'s constexpr variant copy/move extensionEric Fiselier2016-12-024-0/+93
| | | | llvm-svn: 288536
* Protect sequences test under libcpp-no-exceptionsRoger Ferrer Ibanez2016-12-012-7/+11
| | | | | | | | Replace throw with TEST_THROW and protect tests that do throw. Also add missing assert(false). Differential Revision: https://reviews.llvm.org/D27252 llvm-svn: 288383
* Protect futures test under libcpp-no-exceptionsRoger Ferrer Ibanez2016-12-011-1/+7
| | | | | | | | Skip tests that expect an exception be thrown. Differential Revision: https://reviews.llvm.org/D27253 llvm-svn: 288382
* Protect optional test under libcpp-no-exceptionsRoger Ferrer Ibanez2016-12-011-3/+6
| | | | | | | | Replace throw with TEST_THROW and skip tests that throw exceptions Differential Revision: https://reviews.llvm.org/D27254 llvm-svn: 288379
* Protect std::ostream::sentry test under libcpp-no-exceptionsRoger Ferrer Ibanez2016-12-011-1/+4
| | | | | | | | Skip test that throws an exception. Differential Revision: https://reviews.llvm.org/D27255 llvm-svn: 288378
* Protect std::array tests under noexceptionsRoger Ferrer Ibanez2016-11-291-3/+14
| | | | | | | | Skip tests that expect exceptions be thrown. Also add missing asserts. Differential Revision: https://reviews.llvm.org/D27095 llvm-svn: 288165
* Protect std::string tests under libcpp-no-exceptionsRoger Ferrer Ibanez2016-11-292-5/+19
| | | | | | | | | Skip tests that expect an exception be thrown and/or disable unreachable catch handlers. Differential Revision: https://reviews.llvm.org/D26612 llvm-svn: 288158
* Protect std::{,unordered_}map tests under noexceptionsRoger Ferrer Ibanez2016-11-292-2/+18
| | | | | | | | Skip tests that use exceptions Differential Revision: https://reviews.llvm.org/D27093 llvm-svn: 288157
* Protect locale tests under noexceptionsRoger Ferrer Ibanez2016-11-294-4/+16
| | | | | | | | Skip tests that expect exceptions be thrown. Differential Revision: https://reviews.llvm.org/D27096 llvm-svn: 288156
* Implement conjuntion/disjuntion/negation for LFTS v2. Same code and tests ↵Marshall Clow2016-11-263-0/+177
| | | | | | for the ones in std:: llvm-svn: 287988
* Implement the 'detection idiom' from LFTS v2Marshall Clow2016-11-265-0/+224
| | | | llvm-svn: 287981
* Reverting wrong diffRoger Ferrer Ibanez2016-11-242-14/+2
| | | | | | I managed to confuse me with two reviews of the same thing and ended commiting the wrong one. llvm-svn: 287868
* Protect tests for std::uninitialized_{copy,fill} under libcpp-no-exceptionsRoger Ferrer Ibanez2016-11-244-8/+44
| | | | | | | | Skip tests that expect an exception be thrown. Differential Revision: https://reviews.llvm.org/D26606 llvm-svn: 287866
* Protect std::string tests under libcpp-no-exceptionsRoger Ferrer Ibanez2016-11-242-2/+14
| | | | | | | | | Skip tests that expect an exception be thrown and/or disable unreachable catch handlers. Differential Revision: https://reviews.llvm.org/D26608 llvm-svn: 287865
* [libcxx] [test] D27027: Strip trailing whitespace.Stephan T. Lavavej2016-11-2358-91/+91
| | | | llvm-svn: 287829
* [libcxx] [test] D27026: Fix copy-paste silliness; ULL can't ever be 32-bit.Stephan T. Lavavej2016-11-231-1/+1
| | | | llvm-svn: 287828
* [libcxx] [test] D27020: Fix MSVC warning C4245 "conversion from 'X' to 'Y', ↵Stephan T. Lavavej2016-11-234-4/+4
| | | | | | | | | | signed/unsigned mismatch", part 7/12. When initializing unsigned integers to their maximum values, change "const T M(~0);" to "const T M(static_cast<T>(-1));". ~0 and -1 are equivalent, but I consider the -1 form to be significantly clearer (and more consistent with other tests). llvm-svn: 287827
* [libcxx] [test] D27019: Fix MSVC warning C4245 "conversion from 'X' to 'Y', ↵Stephan T. Lavavej2016-11-237-15/+15
| | | | | | | | signed/unsigned mismatch", part 6/12. Add static_cast when initializing unsigned integers with negative numbers (in order to obtain big values). llvm-svn: 287826
* [libcxx] [test] D27018: Fix MSVC warning C4018 "signed/unsigned mismatch", ↵Stephan T. Lavavej2016-11-234-5/+5
| | | | | | | | | | | | | | | | | | | part 5/12. Various changes: test/std/algorithms/alg.sorting/alg.binary.search/binary.search/binary_search.pass.cpp Change M from unsigned to int. It's compared against "int x", and we binary_search() for it within a vector<int>. test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval.pass.cpp test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval_param.pass.cpp Add static_cast<unsigned> when comparing int to unsigned. test/std/strings/basic.string/string.cons/size_char_alloc.pass.cpp Change unsigned indices to int when we're being given int as a bound. llvm-svn: 287825
* [libcxx] [test] D27016: Fix MSVC warning C4018 "signed/unsigned mismatch", ↵Stephan T. Lavavej2016-11-236-19/+25
| | | | | | | | | | part 4/12. Change "int j;" indices to "std::size_t j;". Also, include <cstddef> when it wasn't already being included. llvm-svn: 287824
* [libcxx] [test] D27015: Fix MSVC warning C4018 "signed/unsigned mismatch", ↵Stephan T. Lavavej2016-11-2321-29/+29
| | | | | | | | part 3/12. Change unsigned to int in parameters. llvm-svn: 287823
* [libcxx] [test] D27014: Fix MSVC warning C4018 "signed/unsigned mismatch", ↵Stephan T. Lavavej2016-11-2320-65/+83
| | | | | | | | | | part 2/12. Add static_cast<std::size_t> when comparing int to std::size_t. Also, include <cstddef> when it wasn't already being included. llvm-svn: 287822
* [libcxx] [test] D27013: Fix MSVC warning C4018 "signed/unsigned mismatch", ↵Stephan T. Lavavej2016-11-23139-210/+349
| | | | | | | | | | part 1/12. Change loop indices from int to std::size_t. Also, include <cstddef> when it wasn't already being included. llvm-svn: 287820
OpenPOWER on IntegriCloud