diff options
author | Eric Fiselier <eric@efcs.ca> | 2014-12-20 01:40:03 +0000 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2014-12-20 01:40:03 +0000 |
commit | 5a83710e371fe68a06e6e3876c6a2c8b820a8976 (patch) | |
tree | afde4c82ad6704681781c5cd49baa3fbd05c85db /libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.hash | |
parent | f11e8eab527fba316c64112f6e05de1a79693a3e (diff) | |
download | bcm5719-llvm-5a83710e371fe68a06e6e3876c6a2c8b820a8976.tar.gz bcm5719-llvm-5a83710e371fe68a06e6e3876c6a2c8b820a8976.zip |
Move test into test/std subdirectory.
llvm-svn: 224658
Diffstat (limited to 'libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.hash')
2 files changed, 60 insertions, 0 deletions
diff --git a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.hash/hash_shared_ptr.pass.cpp b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.hash/hash_shared_ptr.pass.cpp new file mode 100644 index 00000000000..990cb58722b --- /dev/null +++ b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.hash/hash_shared_ptr.pass.cpp @@ -0,0 +1,30 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// <memory> + +// template <class T> +// struct hash<shared_ptr<T>> +// { +// typedef shared_ptr<T> argument_type; +// typedef size_t result_type; +// size_t operator()(const shared_ptr<T>& p) const; +// }; + +#include <memory> +#include <cassert> + +int main() +{ + int* ptr = new int; + std::shared_ptr<int> p(ptr); + std::hash<std::shared_ptr<int> > f; + std::size_t h = f(p); + assert(h == std::hash<int*>()(ptr)); +} diff --git a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.hash/hash_unique_ptr.pass.cpp b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.hash/hash_unique_ptr.pass.cpp new file mode 100644 index 00000000000..5cd4ab1f83d --- /dev/null +++ b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.hash/hash_unique_ptr.pass.cpp @@ -0,0 +1,30 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// <memory> + +// template <class T, class D> +// struct hash<unique_ptr<T, D>> +// { +// typedef unique_ptr<T, D> argument_type; +// typedef size_t result_type; +// size_t operator()(const unique_ptr<T, D>& p) const; +// }; + +#include <memory> +#include <cassert> + +int main() +{ + int* ptr = new int; + std::unique_ptr<int> p(ptr); + std::hash<std::unique_ptr<int> > f; + std::size_t h = f(p); + assert(h == std::hash<int*>()(ptr)); +} |