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:
@@ -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
|
||||
}
|
@@ -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
|
||||
}
|
@@ -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
|
||||
}
|
37
test/std/language.support/support.initlist/types.pass.cpp
Normal file
37
test/std/language.support/support.initlist/types.pass.cpp
Normal 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
|
||||
}
|
20
test/std/language.support/support.initlist/version.pass.cpp
Normal file
20
test/std/language.support/support.initlist/version.pass.cpp
Normal 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()
|
||||
{
|
||||
}
|
Reference in New Issue
Block a user