libcxx initial import
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@103490 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
28
test/utilities/type.index/type.index.hash/hash.pass.cpp
Normal file
28
test/utilities/type.index/type.index.hash/hash.pass.cpp
Normal file
@@ -0,0 +1,28 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <typeindex>
|
||||
|
||||
// class type_index
|
||||
|
||||
// template <>
|
||||
// struct hash<type_index>
|
||||
// : public unary_function<type_index, size_t>
|
||||
// {
|
||||
// size_t operator()(type_index index) const;
|
||||
// };
|
||||
|
||||
#include <typeindex>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::type_index t1 = typeid(int);
|
||||
assert(std::hash<std::type_index>()(t1) == t1.hash_code());
|
||||
}
|
22
test/utilities/type.index/type.index.members/ctor.pass.cpp
Normal file
22
test/utilities/type.index/type.index.members/ctor.pass.cpp
Normal file
@@ -0,0 +1,22 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <typeindex>
|
||||
|
||||
// class type_index
|
||||
|
||||
// type_index(const type_info& rhs);
|
||||
|
||||
#include <typeindex>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::type_index t1 = typeid(int);
|
||||
}
|
27
test/utilities/type.index/type.index.members/eq.pass.cpp
Normal file
27
test/utilities/type.index/type.index.members/eq.pass.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <typeindex>
|
||||
|
||||
// class type_index
|
||||
|
||||
// bool operator==(const type_index& rhs) const;
|
||||
// bool operator!=(const type_index& rhs) const;
|
||||
|
||||
#include <typeindex>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::type_index t1 = typeid(int);
|
||||
std::type_index t2 = typeid(int);
|
||||
std::type_index t3 = typeid(long);
|
||||
assert(t1 == t2);
|
||||
assert(t1 != t3);
|
||||
}
|
@@ -0,0 +1,24 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <typeindex>
|
||||
|
||||
// class type_index
|
||||
|
||||
// size_t hash_code() const;
|
||||
|
||||
#include <typeindex>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
const std::type_info& ti = typeid(int);
|
||||
std::type_index t1 = typeid(int);
|
||||
assert(t1.hash_code() == ti.hash_code());
|
||||
}
|
35
test/utilities/type.index/type.index.members/lt.pass.cpp
Normal file
35
test/utilities/type.index/type.index.members/lt.pass.cpp
Normal file
@@ -0,0 +1,35 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <typeindex>
|
||||
|
||||
// class type_index
|
||||
|
||||
// bool operator< (const type_index& rhs) const;
|
||||
// bool operator<=(const type_index& rhs) const;
|
||||
// bool operator> (const type_index& rhs) const;
|
||||
// bool operator>=(const type_index& rhs) const;
|
||||
|
||||
#include <typeindex>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::type_index t1 = typeid(int);
|
||||
std::type_index t2 = typeid(int);
|
||||
std::type_index t3 = typeid(long);
|
||||
assert(!(t1 < t2));
|
||||
assert( (t1 <= t2));
|
||||
assert(!(t1 > t2));
|
||||
assert( (t1 >= t2));
|
||||
assert(!(t1 < t3));
|
||||
assert(!(t1 <= t3));
|
||||
assert( (t1 > t3));
|
||||
assert( (t1 >= t3));
|
||||
}
|
25
test/utilities/type.index/type.index.members/name.pass.cpp
Normal file
25
test/utilities/type.index/type.index.members/name.pass.cpp
Normal file
@@ -0,0 +1,25 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <typeindex>
|
||||
|
||||
// class type_index
|
||||
|
||||
// const char* name() const;
|
||||
|
||||
#include <typeindex>
|
||||
#include <string>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
const std::type_info& ti = typeid(int);
|
||||
std::type_index t1 = typeid(int);
|
||||
assert(std::string(t1.name()) == ti.name());
|
||||
}
|
@@ -0,0 +1,26 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <typeindex>
|
||||
|
||||
// class type_index
|
||||
|
||||
// type_index& operator=(const type_index& ti);
|
||||
|
||||
#include <typeindex>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::type_index t1(typeid(int));
|
||||
std::type_index t2(typeid(double));
|
||||
assert(t2 != t1);
|
||||
t2 = t1;
|
||||
assert(t2 == t1);
|
||||
}
|
@@ -0,0 +1,24 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <typeindex>
|
||||
|
||||
// class type_index
|
||||
|
||||
// type_index(const type_index& ti);
|
||||
|
||||
#include <typeindex>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::type_index t1(typeid(int));
|
||||
std::type_index t2 = t1;
|
||||
assert(t2 == t1);
|
||||
}
|
@@ -0,0 +1,25 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <typeindex>
|
||||
|
||||
// struct hash<type_index>
|
||||
// : public unary_function<type_index, size_t>
|
||||
// {
|
||||
// size_t operator()(type_index index) const;
|
||||
// };
|
||||
|
||||
#include <typeindex>
|
||||
#include <type_traits>
|
||||
|
||||
int main()
|
||||
{
|
||||
static_assert((std::is_base_of<std::unary_function<std::type_index, std::size_t>,
|
||||
std::hash<std::type_index> >::value), "");
|
||||
}
|
20
test/utilities/type.index/version.pass.cpp
Normal file
20
test/utilities/type.index/version.pass.cpp
Normal file
@@ -0,0 +1,20 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <typeindex>
|
||||
|
||||
#include <typeindex>
|
||||
|
||||
#ifndef _LIBCPP_VERSION
|
||||
#error _LIBCPP_VERSION not defined
|
||||
#endif
|
||||
|
||||
int main()
|
||||
{
|
||||
}
|
Reference in New Issue
Block a user