mirror of
https://github.com/llvm-mirror/libcxx.git
synced 2025-10-23 18:38:30 +08:00
[libcxx] [test] Fix whitespace, NFC.
test/std almost always uses spaces; now it is entirely tab-free. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@329978 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -24,10 +24,10 @@
|
|||||||
// int ia[] = {1, 2, 3, 4, 5};
|
// int ia[] = {1, 2, 3, 4, 5};
|
||||||
// int ic[] = {6, 6, 6, 6, 6, 6, 6};
|
// int ic[] = {6, 6, 6, 6, 6, 6, 6};
|
||||||
//
|
//
|
||||||
// auto p = std::copy(std::begin(ia), std::end(ia), std::begin(ic));
|
// auto p = std::copy(std::begin(ia), std::end(ia), std::begin(ic));
|
||||||
// return std::equal(std::begin(ia), std::end(ia), std::begin(ic), p)
|
// return std::equal(std::begin(ia), std::end(ia), std::begin(ic), p)
|
||||||
// && std::all_of(p, std::end(ic), [](int a){return a == 6;})
|
// && std::all_of(p, std::end(ic), [](int a){return a == 6;})
|
||||||
// ;
|
// ;
|
||||||
// }
|
// }
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
|
@@ -26,11 +26,11 @@
|
|||||||
// int ia[] = {1, 2, 3, 4, 5};
|
// int ia[] = {1, 2, 3, 4, 5};
|
||||||
// int ic[] = {6, 6, 6, 6, 6, 6, 6};
|
// int ic[] = {6, 6, 6, 6, 6, 6, 6};
|
||||||
//
|
//
|
||||||
// size_t N = std::size(ia);
|
// size_t N = std::size(ia);
|
||||||
// auto p = std::copy_backward(std::begin(ia), std::end(ia), std::begin(ic) + N);
|
// auto p = std::copy_backward(std::begin(ia), std::end(ia), std::begin(ic) + N);
|
||||||
// return std::equal(std::begin(ic), p, std::begin(ia))
|
// return std::equal(std::begin(ic), p, std::begin(ia))
|
||||||
// && std::all_of(p, std::end(ic), [](int a){return a == 6;})
|
// && std::all_of(p, std::end(ic), [](int a){return a == 6;})
|
||||||
// ;
|
// ;
|
||||||
// }
|
// }
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
|
@@ -26,10 +26,10 @@
|
|||||||
// int ia[] = {2, 4, 6, 8, 6};
|
// int ia[] = {2, 4, 6, 8, 6};
|
||||||
// int ic[] = {0, 0, 0, 0, 0, 0};
|
// int ic[] = {0, 0, 0, 0, 0, 0};
|
||||||
//
|
//
|
||||||
// auto p = std::copy_if(std::begin(ia), std::end(ia), std::begin(ic), is6);
|
// auto p = std::copy_if(std::begin(ia), std::end(ia), std::begin(ic), is6);
|
||||||
// return std::all_of(std::begin(ic), p, [](int a){return a == 6;})
|
// return std::all_of(std::begin(ic), p, [](int a){return a == 6;})
|
||||||
// && std::all_of(p, std::end(ic), [](int a){return a == 0;})
|
// && std::all_of(p, std::end(ic), [](int a){return a == 0;})
|
||||||
// ;
|
// ;
|
||||||
// }
|
// }
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
|
@@ -25,10 +25,10 @@
|
|||||||
// int ia[] = {1, 2, 3, 4, 5};
|
// int ia[] = {1, 2, 3, 4, 5};
|
||||||
// int ic[] = {6, 6, 6, 6, 6, 6, 6};
|
// int ic[] = {6, 6, 6, 6, 6, 6, 6};
|
||||||
//
|
//
|
||||||
// auto p = std::copy_n(std::begin(ia), 4, std::begin(ic));
|
// auto p = std::copy_n(std::begin(ia), 4, std::begin(ic));
|
||||||
// return std::equal(std::begin(ic), p, std::begin(ia))
|
// return std::equal(std::begin(ic), p, std::begin(ia))
|
||||||
// && std::all_of(p, std::end(ic), [](int a){return a == 6;})
|
// && std::all_of(p, std::end(ic), [](int a){return a == 6;})
|
||||||
// ;
|
// ;
|
||||||
// }
|
// }
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
|
@@ -26,7 +26,7 @@
|
|||||||
TEST_CONSTEXPR bool test_constexpr() {
|
TEST_CONSTEXPR bool test_constexpr() {
|
||||||
int ia[] = {0, 1, 1, 3, 4};
|
int ia[] = {0, 1, 1, 3, 4};
|
||||||
const int expected[] = {0, 1, 3, 4};
|
const int expected[] = {0, 1, 3, 4};
|
||||||
const size_t N = 4;
|
const size_t N = 4;
|
||||||
|
|
||||||
auto it = std::unique(std::begin(ia), std::end(ia));
|
auto it = std::unique(std::begin(ia), std::end(ia));
|
||||||
return it == (std::begin(ia) + N)
|
return it == (std::begin(ia) + N)
|
||||||
|
@@ -26,7 +26,7 @@
|
|||||||
TEST_CONSTEXPR bool test_constexpr() {
|
TEST_CONSTEXPR bool test_constexpr() {
|
||||||
int ia[] = {0, 1, 1, 3, 4};
|
int ia[] = {0, 1, 1, 3, 4};
|
||||||
const int expected[] = {0, 1, 3, 4};
|
const int expected[] = {0, 1, 3, 4};
|
||||||
const size_t N = 4;
|
const size_t N = 4;
|
||||||
|
|
||||||
auto it = std::unique(std::begin(ia), std::end(ia), [](int a, int b) {return a == b; });
|
auto it = std::unique(std::begin(ia), std::end(ia), [](int a, int b) {return a == b; });
|
||||||
return it == (std::begin(ia) + N)
|
return it == (std::begin(ia) + N)
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
//
|
//
|
||||||
// The LLVM Compiler Infrastructure
|
// The LLVM Compiler Infrastructure
|
||||||
//
|
//
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
// Source Licenses. See LICENSE.TXT for details.
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
// template <class... Args> decltype(auto) emplace(Args&&... args);
|
// template <class... Args> decltype(auto) emplace(Args&&... args);
|
||||||
// return type is 'decltype(auto)' in C++17; 'void' before
|
// return type is 'decltype(auto)' in C++17; 'void' before
|
||||||
// whatever the return type of the underlying container's emplace_back() returns.
|
// whatever the return type of the underlying container's emplace_back() returns.
|
||||||
|
|
||||||
|
|
||||||
#include <queue>
|
#include <queue>
|
||||||
@@ -26,40 +26,40 @@
|
|||||||
|
|
||||||
template <typename Queue>
|
template <typename Queue>
|
||||||
void test_return_type() {
|
void test_return_type() {
|
||||||
typedef typename Queue::container_type Container;
|
typedef typename Queue::container_type Container;
|
||||||
typedef typename Container::value_type value_type;
|
typedef typename Container::value_type value_type;
|
||||||
typedef decltype(std::declval<Queue>().emplace(std::declval<value_type &>())) queue_return_type;
|
typedef decltype(std::declval<Queue>().emplace(std::declval<value_type &>())) queue_return_type;
|
||||||
|
|
||||||
#if TEST_STD_VER > 14
|
#if TEST_STD_VER > 14
|
||||||
typedef decltype(std::declval<Container>().emplace_back(std::declval<value_type>())) container_return_type;
|
typedef decltype(std::declval<Container>().emplace_back(std::declval<value_type>())) container_return_type;
|
||||||
static_assert(std::is_same<queue_return_type, container_return_type>::value, "");
|
static_assert(std::is_same<queue_return_type, container_return_type>::value, "");
|
||||||
#else
|
#else
|
||||||
static_assert(std::is_same<queue_return_type, void>::value, "");
|
static_assert(std::is_same<queue_return_type, void>::value, "");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
test_return_type<std::queue<int> > ();
|
test_return_type<std::queue<int> > ();
|
||||||
test_return_type<std::queue<int, std::list<int> > > ();
|
test_return_type<std::queue<int, std::list<int> > > ();
|
||||||
|
|
||||||
typedef Emplaceable T;
|
typedef Emplaceable T;
|
||||||
std::queue<Emplaceable> q;
|
std::queue<Emplaceable> q;
|
||||||
#if TEST_STD_VER > 14
|
#if TEST_STD_VER > 14
|
||||||
T& r1 = q.emplace(1, 2.5);
|
T& r1 = q.emplace(1, 2.5);
|
||||||
assert(&r1 == &q.back());
|
assert(&r1 == &q.back());
|
||||||
T& r2 = q.emplace(2, 3.5);
|
T& r2 = q.emplace(2, 3.5);
|
||||||
assert(&r2 == &q.back());
|
assert(&r2 == &q.back());
|
||||||
T& r3 = q.emplace(3, 4.5);
|
T& r3 = q.emplace(3, 4.5);
|
||||||
assert(&r3 == &q.back());
|
assert(&r3 == &q.back());
|
||||||
assert(&r1 == &q.front());
|
assert(&r1 == &q.front());
|
||||||
#else
|
#else
|
||||||
q.emplace(1, 2.5);
|
q.emplace(1, 2.5);
|
||||||
q.emplace(2, 3.5);
|
q.emplace(2, 3.5);
|
||||||
q.emplace(3, 4.5);
|
q.emplace(3, 4.5);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
assert(q.size() == 3);
|
assert(q.size() == 3);
|
||||||
assert(q.front() == Emplaceable(1, 2.5));
|
assert(q.front() == Emplaceable(1, 2.5));
|
||||||
assert(q.back() == Emplaceable(3, 4.5));
|
assert(q.back() == Emplaceable(3, 4.5));
|
||||||
}
|
}
|
||||||
|
@@ -37,8 +37,8 @@ public:
|
|||||||
template <class C>
|
template <class C>
|
||||||
class non_const_compare
|
class non_const_compare
|
||||||
{
|
{
|
||||||
// operator() deliberately not marked as 'const'
|
// operator() deliberately not marked as 'const'
|
||||||
bool operator()(const C& x,const C&y) { return x < y; }
|
bool operator()(const C& x, const C& y) { return x < y; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -21,6 +21,6 @@
|
|||||||
|
|
||||||
int main ()
|
int main ()
|
||||||
{
|
{
|
||||||
char buffer[100];
|
char buffer[100];
|
||||||
::operator new[](4, buffer); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
|
::operator new[](4, buffer); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
|
||||||
}
|
}
|
||||||
|
@@ -21,6 +21,6 @@
|
|||||||
|
|
||||||
int main ()
|
int main ()
|
||||||
{
|
{
|
||||||
char buffer[100];
|
char buffer[100];
|
||||||
::operator new(4, buffer); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
|
::operator new(4, buffer); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
|
||||||
}
|
}
|
||||||
|
@@ -22,14 +22,14 @@ constexpr int gi = 5;
|
|||||||
constexpr float gf = 8.f;
|
constexpr float gf = 8.f;
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
static_assert(std::launder(&gi) == &gi, "" );
|
static_assert(std::launder(&gi) == &gi, "" );
|
||||||
static_assert(std::launder(&gf) == &gf, "" );
|
static_assert(std::launder(&gf) == &gf, "" );
|
||||||
|
|
||||||
const int *i = &gi;
|
const int *i = &gi;
|
||||||
const float *f = &gf;
|
const float *f = &gf;
|
||||||
static_assert(std::is_same<decltype(i), decltype(std::launder(i))>::value, "");
|
static_assert(std::is_same<decltype(i), decltype(std::launder(i))>::value, "");
|
||||||
static_assert(std::is_same<decltype(f), decltype(std::launder(f))>::value, "");
|
static_assert(std::is_same<decltype(f), decltype(std::launder(f))>::value, "");
|
||||||
|
|
||||||
assert(std::launder(i) == i);
|
assert(std::launder(i) == i);
|
||||||
assert(std::launder(f) == f);
|
assert(std::launder(f) == f);
|
||||||
}
|
}
|
||||||
|
@@ -15,19 +15,19 @@
|
|||||||
// {
|
// {
|
||||||
// public:
|
// public:
|
||||||
// // types:
|
// // types:
|
||||||
// using traits_type = traits;
|
// using traits_type = traits;
|
||||||
// using value_type = charT;
|
// using value_type = charT;
|
||||||
// using pointer = value_type*;
|
// using pointer = value_type*;
|
||||||
// using const_pointer = const value_type*;
|
// using const_pointer = const value_type*;
|
||||||
// using reference = value_type&;
|
// using reference = value_type&;
|
||||||
// using const_reference = const value_type&;
|
// using const_reference = const value_type&;
|
||||||
// using const_iterator = implementation-defined ; // see 24.4.2.2
|
// using const_iterator = implementation-defined ; // see 24.4.2.2
|
||||||
// using iterator = const_iterator;
|
// using iterator = const_iterator;
|
||||||
// using const_reverse_iterator = reverse_iterator<const_iterator>;
|
// using const_reverse_iterator = reverse_iterator<const_iterator>;
|
||||||
// using iterator = const_reverse_iterator;
|
// using iterator = const_reverse_iterator;
|
||||||
// using size_type = size_t;
|
// using size_type = size_t;
|
||||||
// using difference_type = ptrdiff_t;
|
// using difference_type = ptrdiff_t;
|
||||||
// static constexpr size_type npos = size_type(-1);
|
// static constexpr size_type npos = size_type(-1);
|
||||||
//
|
//
|
||||||
// };
|
// };
|
||||||
|
|
||||||
|
@@ -33,6 +33,6 @@ int foo (int x) { return x; }
|
|||||||
|
|
||||||
int main ()
|
int main ()
|
||||||
{
|
{
|
||||||
std::async( foo, 3); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
|
std::async( foo, 3); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
|
||||||
std::async(std::launch::async, foo, 3); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
|
std::async(std::launch::async, foo, 3); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
|
||||||
}
|
}
|
||||||
|
@@ -32,7 +32,7 @@ int main()
|
|||||||
test_remove_cvref<const volatile int, int>();
|
test_remove_cvref<const volatile int, int>();
|
||||||
test_remove_cvref<volatile int, int>();
|
test_remove_cvref<volatile int, int>();
|
||||||
|
|
||||||
// Doesn't decay
|
// Doesn't decay
|
||||||
test_remove_cvref<int[3], int[3]>();
|
test_remove_cvref<int[3], int[3]>();
|
||||||
test_remove_cvref<int const [3], int[3]>();
|
test_remove_cvref<int const [3], int[3]>();
|
||||||
test_remove_cvref<int volatile [3], int[3]>();
|
test_remove_cvref<int volatile [3], int[3]>();
|
||||||
|
Reference in New Issue
Block a user