Skip to content

Commit

Permalink
Update libcxx/set
Browse files Browse the repository at this point in the history
  • Loading branch information
morzhovets committed Nov 24, 2023
1 parent 0134218 commit d48e440
Show file tree
Hide file tree
Showing 65 changed files with 209 additions and 202 deletions.
24 changes: 15 additions & 9 deletions test/sources/LibcxxTreeSetTester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,22 @@
namespace
{

namespace std
{
using namespace ::std;

template<typename TKey,
typename TLessFunc = std::less<TKey>,
typename TAllocator = std::allocator<TKey>>
using set = momo::stdish::set<TKey, TLessFunc, TAllocator,
momo::TreeSet<TKey, momo::TreeTraitsStd<TKey, TLessFunc, false,
momo::TreeNode<32, 4, momo::MemPoolParams<1>, true>>,
momo::MemManagerStd<TAllocator>,
momo::TreeSetItemTraits<TKey, momo::MemManagerStd<TAllocator>>,
momo::TreeSetSettings>>;
}

#define LIBCXX_TEST_PREFIX "libcxx_test_tree_set"
template<typename TKey,
typename TLessFunc = std::less<TKey>,
typename TAllocator = std::allocator<TKey>>
using set = momo::stdish::set<TKey, TLessFunc, TAllocator,
momo::TreeSet<TKey, momo::TreeTraitsStd<TKey, TLessFunc, false,
momo::TreeNode<32, 4, momo::MemPoolParams<1>, true>>,
momo::MemManagerStd<TAllocator>,
momo::TreeSetItemTraits<TKey, momo::MemManagerStd<TAllocator>>,
momo::TreeSetSettings>>;
#include "LibcxxSetTests.h"
#undef LIBCXX_TEST_PREFIX

Expand Down
4 changes: 2 additions & 2 deletions test/sources/libcxx/set/clear.pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
void main()
{
{
typedef set<int> M;
typedef std::set<int> M;
typedef int V;
V ar[] =
{
Expand All @@ -41,7 +41,7 @@ void main()
#if TEST_STD_VER >= 11
#ifdef LIBCPP_TEST_MIN_ALLOCATOR
{
typedef set<int, std::less<int>, min_allocator<int>> M;
typedef std::set<int, std::less<int>, min_allocator<int>> M;
typedef int V;
V ar[] =
{
Expand Down
4 changes: 2 additions & 2 deletions test/sources/libcxx/set/contains.pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ struct E { int a = 1; double b = 1; char c = 1; };
int main(int, char**)
{
{
test<set<int>, int>(14, 10, 11, 12, 13);
test<set<char>, char>('e', 'a', 'b', 'c', 'd');
test<std::set<int>, int>(14, 10, 11, 12, 13);
test<std::set<char>, char>('e', 'a', 'b', 'c', 'd');
}

return 0;
Expand Down
2 changes: 1 addition & 1 deletion test/sources/libcxx/set/contains_transparent.pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void test() {
}

int main(int, char**) {
test<set<std::pair<int, int>, Comp> >();
test<std::set<std::pair<int, int>, Comp> >();

return 0;
}
8 changes: 4 additions & 4 deletions test/sources/libcxx/set/count.pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ void main()
{
{
typedef int V;
typedef set<int> M;
typedef std::set<int> M;
typedef M::size_type R;
V ar[] =
{
Expand Down Expand Up @@ -57,7 +57,7 @@ void main()
#ifdef LIBCPP_TEST_MIN_ALLOCATOR
{
typedef int V;
typedef set<int, std::less<int>, min_allocator<int>> M;
typedef std::set<int, std::less<int>, min_allocator<int>> M;
typedef M::size_type R;
V ar[] =
{
Expand Down Expand Up @@ -95,7 +95,7 @@ void main()
#if TEST_STD_VER > 11
{
typedef int V;
typedef set<int, std::less<>> M;
typedef std::set<int, std::less<>> M;
typedef M::size_type R;
V ar[] =
{
Expand Down Expand Up @@ -130,7 +130,7 @@ void main()
}
{
typedef PrivateConstructor V;
typedef set<V, std::less<>> M;
typedef std::set<V, std::less<>> M;
typedef M::size_type R;

M m;
Expand Down
2 changes: 1 addition & 1 deletion test/sources/libcxx/set/count_transparent.pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ struct Comp {
};

int main(int, char**) {
set<std::pair<int, int>, Comp> s{{2, 1}, {1, 2}, {1, 3}, {1, 4}, {2, 2}};
std::set<std::pair<int, int>, Comp> s{{2, 1}, {1, 2}, {1, 3}, {1, 4}, {2, 2}};

auto cnt = s.count(1);
assert(cnt == 3);
Expand Down
8 changes: 4 additions & 4 deletions test/sources/libcxx/set/emplace.pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ void main()
{
#ifdef LIBCPP_HAS_BAD_NEWS_FOR_MOMO
{
typedef set<DefaultOnly> M;
typedef std::set<DefaultOnly> M;
typedef std::pair<M::iterator, bool> R;
M m;
assert(DefaultOnly::count == 0);
Expand All @@ -44,7 +44,7 @@ void main()
assert(DefaultOnly::count == 0);
#endif
{
typedef set<Emplaceable> M;
typedef std::set<Emplaceable> M;
typedef std::pair<M::iterator, bool> R;
M m;
R r = m.emplace();
Expand All @@ -64,7 +64,7 @@ void main()
assert(*r.first == Emplaceable(2, 3.5));
}
{
typedef set<int> M;
typedef std::set<int> M;
typedef std::pair<M::iterator, bool> R;
M m;
R r = m.emplace(M::value_type(2));
Expand All @@ -75,7 +75,7 @@ void main()
}
#ifdef LIBCPP_TEST_MIN_ALLOCATOR
{
typedef set<int, std::less<int>, min_allocator<int>> M;
typedef std::set<int, std::less<int>, min_allocator<int>> M;
typedef std::pair<M::iterator, bool> R;
M m;
R r = m.emplace(M::value_type(2));
Expand Down
8 changes: 4 additions & 4 deletions test/sources/libcxx/set/emplace_hint.pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ void main()
{
#ifdef LIBCPP_HAS_BAD_NEWS_FOR_MOMO
{
typedef set<DefaultOnly> M;
typedef std::set<DefaultOnly> M;
typedef M::iterator R;
M m;
assert(DefaultOnly::count == 0);
Expand All @@ -42,7 +42,7 @@ void main()
assert(DefaultOnly::count == 0);
#endif
{
typedef set<Emplaceable> M;
typedef std::set<Emplaceable> M;
typedef M::iterator R;
M m;
R r = m.emplace_hint(m.cend());
Expand All @@ -59,7 +59,7 @@ void main()
assert(*r == Emplaceable(2, 3.5));
}
{
typedef set<int> M;
typedef std::set<int> M;
typedef M::iterator R;
M m;
R r = m.emplace_hint(m.cend(), M::value_type(2));
Expand All @@ -69,7 +69,7 @@ void main()
}
#ifdef LIBCPP_TEST_MIN_ALLOCATOR
{
typedef set<int, std::less<int>, min_allocator<int>> M;
typedef std::set<int, std::less<int>, min_allocator<int>> M;
typedef M::iterator R;
M m;
R r = m.emplace_hint(m.cend(), M::value_type(2));
Expand Down
4 changes: 2 additions & 2 deletions test/sources/libcxx/set/empty.pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
void main()
{
{
typedef set<int> M;
typedef std::set<int> M;
M m;
assert(m.empty());
m.insert(M::value_type(1));
Expand All @@ -30,7 +30,7 @@ void main()
#if TEST_STD_VER >= 11
#ifdef LIBCPP_TEST_MIN_ALLOCATOR
{
typedef set<int, std::less<int>, min_allocator<int>> M;
typedef std::set<int, std::less<int>, min_allocator<int>> M;
M m;
assert(m.empty());
m.insert(M::value_type(1));
Expand Down
8 changes: 4 additions & 4 deletions test/sources/libcxx/set/equal_range.pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ void main()
{
{
typedef int V;
typedef set<int> M;
typedef std::set<int> M;
{
typedef std::pair<M::iterator, M::iterator> R;
V ar[] =
Expand Down Expand Up @@ -159,7 +159,7 @@ void main()
#ifdef LIBCPP_TEST_MIN_ALLOCATOR
{
typedef int V;
typedef set<int, std::less<int>, min_allocator<int>> M;
typedef std::set<int, std::less<int>, min_allocator<int>> M;
typedef std::pair<M::iterator, M::iterator> R;
V ar[] =
{
Expand Down Expand Up @@ -230,7 +230,7 @@ void main()
#if TEST_STD_VER > 11
{
typedef int V;
typedef set<V, std::less<>> M;
typedef std::set<V, std::less<>> M;
{
typedef std::pair<M::iterator, M::iterator> R;
V ar[] =
Expand Down Expand Up @@ -300,7 +300,7 @@ void main()
}
{
typedef PrivateConstructor V;
typedef set<V, std::less<>> M;
typedef std::set<V, std::less<>> M;
typedef std::pair<M::iterator, M::iterator> R;

M m;
Expand Down
2 changes: 1 addition & 1 deletion test/sources/libcxx/set/equal_range_transparent.pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ struct Comp {
};

int main(int, char**) {
set<std::pair<int, int>, Comp> s{{2, 1}, {1, 2}, {1, 3}, {1, 4}, {2, 2}};
std::set<std::pair<int, int>, Comp> s{{2, 1}, {1, 2}, {1, 3}, {1, 4}, {2, 2}};

auto er = s.equal_range(1);
long nels = 0;
Expand Down
6 changes: 3 additions & 3 deletions test/sources/libcxx/set/erase_iter.pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ bool operator<(const TemplateConstructor&, const TemplateConstructor&) { return
void main()
{
{
typedef set<int> M;
typedef std::set<int> M;
typedef int V;
typedef M::iterator I;
V ar[] =
Expand Down Expand Up @@ -107,7 +107,7 @@ void main()
#if TEST_STD_VER >= 11
#ifdef LIBCPP_TEST_MIN_ALLOCATOR
{
typedef set<int, std::less<int>, min_allocator<int>> M;
typedef std::set<int, std::less<int>, min_allocator<int>> M;
typedef int V;
typedef M::iterator I;
V ar[] =
Expand Down Expand Up @@ -190,7 +190,7 @@ void main()
{
// This is LWG #2059
typedef TemplateConstructor T;
typedef set<T> C;
typedef std::set<T> C;
typedef C::iterator I;

C c;
Expand Down
4 changes: 2 additions & 2 deletions test/sources/libcxx/set/erase_iter_iter.pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
void main()
{
{
typedef set<int> M;
typedef std::set<int> M;
typedef int V;
typedef M::iterator I;
V ar[] =
Expand Down Expand Up @@ -79,7 +79,7 @@ void main()
#if TEST_STD_VER >= 11
#ifdef LIBCPP_TEST_MIN_ALLOCATOR
{
typedef set<int, std::less<int>, min_allocator<int>> M;
typedef std::set<int, std::less<int>, min_allocator<int>> M;
typedef int V;
typedef M::iterator I;
V ar[] =
Expand Down
4 changes: 2 additions & 2 deletions test/sources/libcxx/set/erase_key.pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
void main()
{
{
typedef set<int> M;
typedef std::set<int> M;
typedef int V;
typedef M::size_type I;
V ar[] =
Expand Down Expand Up @@ -110,7 +110,7 @@ void main()
#if TEST_STD_VER >= 11
#ifdef LIBCPP_TEST_MIN_ALLOCATOR
{
typedef set<int, std::less<int>, min_allocator<int>> M;
typedef std::set<int, std::less<int>, min_allocator<int>> M;
typedef int V;
typedef M::size_type I;
V ar[] =
Expand Down
6 changes: 3 additions & 3 deletions test/sources/libcxx/set/extract_iterator.pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,20 @@ void test(Container& c)
void main()
{
{
using set_type = set<int>;
using set_type = std::set<int>;
set_type m = {1, 2, 3, 4, 5, 6};
test(m);
}

{
set<Counter<int>> m = {1, 2, 3, 4, 5, 6};
std::set<Counter<int>> m = {1, 2, 3, 4, 5, 6};
assert(Counter_base::gConstructed == 6);
test(m);
assert(Counter_base::gConstructed == 0);
}
#ifdef LIBCPP_TEST_MIN_ALLOCATOR
{
using min_alloc_set = set<int, std::less<int>, min_allocator<int>>;
using min_alloc_set = std::set<int, std::less<int>, min_allocator<int>>;
min_alloc_set m = {1, 2, 3, 4, 5, 6};
test(m);
}
Expand Down
6 changes: 3 additions & 3 deletions test/sources/libcxx/set/extract_key.pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ void test(Container& c, KeyTypeIter first, KeyTypeIter last)
void main()
{
{
set<int> m = {1, 2, 3, 4, 5, 6};
std::set<int> m = {1, 2, 3, 4, 5, 6};
int keys[] = {1, 2, 3, 4, 5, 6};
test(m, std::begin(keys), std::end(keys));
}

{
set<Counter<int>> m = {1, 2, 3, 4, 5, 6};
std::set<Counter<int>> m = {1, 2, 3, 4, 5, 6};
{
Counter<int> keys[] = {1, 2, 3, 4, 5, 6};
assert(Counter_base::gConstructed == 6+6);
Expand All @@ -64,7 +64,7 @@ void main()
}
#ifdef LIBCPP_TEST_MIN_ALLOCATOR
{
using min_alloc_set = set<int, std::less<int>, min_allocator<int>>;
using min_alloc_set = std::set<int, std::less<int>, min_allocator<int>>;
min_alloc_set m = {1, 2, 3, 4, 5, 6};
int keys[] = {1, 2, 3, 4, 5, 6};
test(m, std::begin(keys), std::end(keys));
Expand Down
8 changes: 4 additions & 4 deletions test/sources/libcxx/set/find.pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ void main()
{
{
typedef int V;
typedef set<int> M;
typedef std::set<int> M;
{
typedef M::iterator R;
V ar[] =
Expand Down Expand Up @@ -93,7 +93,7 @@ void main()
#ifdef LIBCPP_TEST_MIN_ALLOCATOR
{
typedef int V;
typedef set<int, std::less<int>, min_allocator<int>> M;
typedef std::set<int, std::less<int>, min_allocator<int>> M;
{
typedef M::iterator R;
V ar[] =
Expand Down Expand Up @@ -166,7 +166,7 @@ void main()
#if TEST_STD_VER > 11
{
typedef int V;
typedef set<V, std::less<>> M;
typedef std::set<V, std::less<>> M;
typedef M::iterator R;

V ar[] =
Expand Down Expand Up @@ -203,7 +203,7 @@ void main()

{
typedef PrivateConstructor V;
typedef set<V, std::less<>> M;
typedef std::set<V, std::less<>> M;
typedef M::iterator R;

M m;
Expand Down
Loading

0 comments on commit d48e440

Please sign in to comment.