diff --git a/libcxx/test/std/containers/associative/map/get_allocator.pass.cpp b/libcxx/test/std/containers/associative/map/get_allocator.pass.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/containers/associative/map/get_allocator.pass.cpp @@ -0,0 +1,37 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// class map + +// allocator_type get_allocator() const + +#include +#include +#include + +#include "test_allocator.h" +#include "test_macros.h" + +int main(int, char**) { + typedef std::pair ValueType; + { + std::allocator alloc; + const std::map m(alloc); + assert(m.get_allocator() == alloc); + } + { + other_allocator alloc(1); + const std::map, + other_allocator > m(alloc); + assert(m.get_allocator() == alloc); + } + + return 0; +} diff --git a/libcxx/test/std/containers/associative/multimap/get_allocator.pass.cpp b/libcxx/test/std/containers/associative/multimap/get_allocator.pass.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/containers/associative/multimap/get_allocator.pass.cpp @@ -0,0 +1,37 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// class multimap + +// allocator_type get_allocator() const + +#include +#include +#include + +#include "test_allocator.h" +#include "test_macros.h" + +int main(int, char**) { + typedef std::pair ValueType; + { + std::allocator alloc; + const std::multimap m(alloc); + assert(m.get_allocator() == alloc); + } + { + other_allocator alloc(1); + const std::multimap, + other_allocator > m(alloc); + assert(m.get_allocator() == alloc); + } + + return 0; +} diff --git a/libcxx/test/std/containers/associative/multiset/get_allocator.pass.cpp b/libcxx/test/std/containers/associative/multiset/get_allocator.pass.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/containers/associative/multiset/get_allocator.pass.cpp @@ -0,0 +1,33 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// class multiset + +// allocator_type get_allocator() const + +#include +#include + +#include "test_allocator.h" +#include "test_macros.h" + +int main(int, char**) { + { + std::allocator alloc; + const std::multiset s(alloc); + assert(s.get_allocator() == alloc); + } + { + other_allocator alloc(1); + const std::multiset, other_allocator > s(alloc); + assert(s.get_allocator() == alloc); + } + return 0; +} diff --git a/libcxx/test/std/containers/associative/set/get_allocator.pass.cpp b/libcxx/test/std/containers/associative/set/get_allocator.pass.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/containers/associative/set/get_allocator.pass.cpp @@ -0,0 +1,33 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// class set + +// allocator_type get_allocator() const + +#include +#include + +#include "test_allocator.h" +#include "test_macros.h" + +int main(int, char**) { + { + std::allocator alloc; + const std::set s(alloc); + assert(s.get_allocator() == alloc); + } + { + other_allocator alloc(1); + const std::set, other_allocator > s(alloc); + assert(s.get_allocator() == alloc); + } + return 0; +} diff --git a/libcxx/test/std/containers/sequences/deque/get_allocator.pass.cpp b/libcxx/test/std/containers/sequences/deque/get_allocator.pass.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/containers/sequences/deque/get_allocator.pass.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// class deque + +// allocator_type get_allocator() const + +#include +#include + +#include "test_allocator.h" +#include "test_macros.h" + +int main(int, char**) { + { + std::allocator alloc; + const std::deque d(alloc); + assert(d.get_allocator() == alloc); + } + { + other_allocator alloc(1); + const std::deque > d(alloc); + assert(d.get_allocator() == alloc); + } + + return 0; +} diff --git a/libcxx/test/std/containers/sequences/forwardlist/get_allocator.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/get_allocator.pass.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/containers/sequences/forwardlist/get_allocator.pass.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// class forward_list + +// allocator_type get_allocator() const + +#include +#include + +#include "test_allocator.h" +#include "test_macros.h" + +int main(int, char**) { + { + std::allocator alloc; + const std::forward_list fl(alloc); + assert(fl.get_allocator() == alloc); + } + { + other_allocator alloc(1); + const std::forward_list > fl(alloc); + assert(fl.get_allocator() == alloc); + } + + return 0; +} diff --git a/libcxx/test/std/containers/sequences/list/get_allocator.pass.cpp b/libcxx/test/std/containers/sequences/list/get_allocator.pass.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/containers/sequences/list/get_allocator.pass.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// class list + +// allocator_type get_allocator() const + +#include +#include + +#include "test_allocator.h" +#include "test_macros.h" + +int main(int, char**) { + { + std::allocator alloc; + const std::list l(alloc); + assert(l.get_allocator() == alloc); + } + { + other_allocator alloc(1); + const std::list > l(alloc); + assert(l.get_allocator() == alloc); + } + + return 0; +} diff --git a/libcxx/test/std/containers/sequences/vector.bool/get_allocator.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/get_allocator.pass.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/containers/sequences/vector.bool/get_allocator.pass.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// class vector + +// allocator_type get_allocator() const + +#include +#include + +#include "test_allocator.h" +#include "test_macros.h" + +int main(int, char**) { + { + std::allocator alloc; + const std::vector vb(alloc); + assert(vb.get_allocator() == alloc); + } + { + other_allocator alloc(1); + const std::vector > vb(alloc); + assert(vb.get_allocator() == alloc); + } + + return 0; +} diff --git a/libcxx/test/std/containers/sequences/vector/get_allocator.pass.cpp b/libcxx/test/std/containers/sequences/vector/get_allocator.pass.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/containers/sequences/vector/get_allocator.pass.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// class vector + +// allocator_type get_allocator() const + +#include +#include + +#include "test_allocator.h" +#include "test_macros.h" + +int main(int, char**) { + { + std::allocator alloc; + const std::vector v(alloc); + assert(v.get_allocator() == alloc); + } + { + other_allocator alloc(1); + const std::vector > v(alloc); + assert(v.get_allocator() == alloc); + } + + return 0; +} diff --git a/libcxx/test/std/containers/unord/unord.map/get_allocator.pass.cpp b/libcxx/test/std/containers/unord/unord.map/get_allocator.pass.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/containers/unord/unord.map/get_allocator.pass.cpp @@ -0,0 +1,38 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// class unordered_map + +// allocator_type get_allocator() const + +#include +#include +#include + +#include "test_allocator.h" +#include "test_macros.h" + +int main(int, char**) { + typedef std::pair ValueType; + { + std::allocator alloc; + const std::unordered_map m(alloc); + assert(m.get_allocator() == alloc); + } + { + other_allocator alloc(1); + const std::unordered_map, + std::equal_to, + other_allocator > m(alloc); + assert(m.get_allocator() == alloc); + } + + return 0; +} diff --git a/libcxx/test/std/containers/unord/unord.multimap/get_allocator.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/get_allocator.pass.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/containers/unord/unord.multimap/get_allocator.pass.cpp @@ -0,0 +1,38 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// class unordered_multimap + +// allocator_type get_allocator() const + +#include +#include +#include + +#include "test_allocator.h" +#include "test_macros.h" + +int main(int, char**) { + typedef std::pair ValueType; + { + std::allocator alloc; + const std::unordered_multimap m(alloc); + assert(m.get_allocator() == alloc); + } + { + other_allocator alloc(1); + const std::unordered_multimap, + std::equal_to, + other_allocator > m(alloc); + assert(m.get_allocator() == alloc); + } + + return 0; +} diff --git a/libcxx/test/std/containers/unord/unord.multiset/get_allocator.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/get_allocator.pass.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/containers/unord/unord.multiset/get_allocator.pass.cpp @@ -0,0 +1,36 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// class unordered_multiset + +// allocator_type get_allocator() const + +#include +#include + +#include "test_allocator.h" +#include "test_macros.h" + +int main(int, char**) { + { + std::allocator alloc; + const std::unordered_multiset s(alloc); + assert(s.get_allocator() == alloc); + } + { + other_allocator alloc(1); + const std::unordered_multiset, + std::equal_to, + other_allocator > s(alloc); + assert(s.get_allocator() == alloc); + } + + return 0; +} diff --git a/libcxx/test/std/containers/unord/unord.set/get_allocator.pass.cpp b/libcxx/test/std/containers/unord/unord.set/get_allocator.pass.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/containers/unord/unord.set/get_allocator.pass.cpp @@ -0,0 +1,36 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// class unordered_set + +// allocator_type get_allocator() const + +#include +#include + +#include "test_allocator.h" +#include "test_macros.h" + +int main(int, char**) { + { + std::allocator alloc; + const std::unordered_set s(alloc); + assert(s.get_allocator() == alloc); + } + { + other_allocator alloc(1); + const std::unordered_set, + std::equal_to, + other_allocator > s(alloc); + assert(s.get_allocator() == alloc); + } + + return 0; +}