Move test into test/std subdirectory.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224658 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eric Fiselier
2014-12-20 01:40:03 +00:00
parent 669a8a5a19
commit a90c6dd460
4817 changed files with 13 additions and 0 deletions

View File

@@ -0,0 +1,62 @@
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// template<class E> class initializer_list;
// const E* begin() const;
// const E* end() const;
// size_t size() const;
#include <initializer_list>
#include <cassert>
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
struct A
{
A(std::initializer_list<int> il)
{
const int* b = il.begin();
const int* e = il.end();
assert(il.size() == 3);
assert(e - b == il.size());
assert(*b++ == 3);
assert(*b++ == 2);
assert(*b++ == 1);
}
};
#if _LIBCPP_STD_VER > 11
struct B
{
constexpr B(std::initializer_list<int> il)
{
const int* b = il.begin();
const int* e = il.end();
assert(il.size() == 3);
assert(e - b == il.size());
assert(*b++ == 3);
assert(*b++ == 2);
assert(*b++ == 1);
}
};
#endif // _LIBCPP_STD_VER > 11
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
A test1 = {3, 2, 1};
#endif
#if _LIBCPP_STD_VER > 11
constexpr B test2 = {3, 2, 1};
#endif // _LIBCPP_STD_VER > 11
}

View File

@@ -0,0 +1,29 @@
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// template<class E> class initializer_list;
// initializer_list();
#include <initializer_list>
#include <cassert>
struct A {};
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
std::initializer_list<A> il;
assert(il.size() == 0);
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#if _LIBCPP_STD_VER > 11
constexpr std::initializer_list<A> il2;
static_assert(il2.size() == 0, "");
#endif // _LIBCPP_STD_VER > 11
}

View File

@@ -0,0 +1,59 @@
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <initializer_list>
// template<class E> const E* begin(initializer_list<E> il);
#include <initializer_list>
#include <cassert>
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
struct A
{
A(std::initializer_list<int> il)
{
const int* b = begin(il);
const int* e = end(il);
assert(il.size() == 3);
assert(e - b == il.size());
assert(*b++ == 3);
assert(*b++ == 2);
assert(*b++ == 1);
}
};
#if _LIBCPP_STD_VER > 11
struct B
{
constexpr B(std::initializer_list<int> il)
{
const int* b = begin(il);
const int* e = end(il);
assert(il.size() == 3);
assert(e - b == il.size());
assert(*b++ == 3);
assert(*b++ == 2);
assert(*b++ == 1);
}
};
#endif // _LIBCPP_STD_VER > 11
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
A test1 = {3, 2, 1};
#endif
#if _LIBCPP_STD_VER > 11
constexpr B test2 = {3, 2, 1};
#endif // _LIBCPP_STD_VER > 11
}

View File

@@ -0,0 +1,37 @@
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// template<class E>
// class initializer_list
// {
// public:
// typedef E value_type;
// typedef const E& reference;
// typedef const E& const_reference;
// typedef size_t size_type;
//
// typedef const E* iterator;
// typedef const E* const_iterator;
#include <initializer_list>
#include <type_traits>
struct A {};
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
static_assert((std::is_same<std::initializer_list<A>::value_type, A>::value), "");
static_assert((std::is_same<std::initializer_list<A>::reference, const A&>::value), "");
static_assert((std::is_same<std::initializer_list<A>::const_reference, const A&>::value), "");
static_assert((std::is_same<std::initializer_list<A>::size_type, std::size_t>::value), "");
static_assert((std::is_same<std::initializer_list<A>::iterator, const A*>::value), "");
static_assert((std::is_same<std::initializer_list<A>::const_iterator, const A*>::value), "");
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}

View File

@@ -0,0 +1,20 @@
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <initializer_list>
#include <initializer_list>
#ifndef _LIBCPP_VERSION
#error _LIBCPP_VERSION not defined
#endif
int main()
{
}