38#include <gtest/gtest.h>
39#include <gsl/gsl_rng.h>
49class DynSkipListTest :
public ::testing::Test
138 int * result = sl.insert(42);
149 int * result = sl.insert(42);
157 for (
int i = 1; i <= 10; ++i)
162 for (
int i = 1; i <= 10; ++i)
168 for (
int i = 10; i >= 1; --i)
178 std::string str =
"hello";
200 int * result = sl.search(42);
289 for (
int i = 1; i <= 5; ++i)
292 for (
int i = 1; i <= 5; ++i)
302 int deleted = sl.del(42);
346 for (
int i = 1; i <= 5; ++i)
364 std::vector<int> result;
365 for (
const auto & key : sl)
380 auto it = sl.begin();
484 sl.for_each([&sum](
int x) {
sum += x; });
495 EXPECT_TRUE(sl.all([](
int x) { return x % 2 == 0; }));
507 EXPECT_TRUE(sl.exists([](
int x) { return x > 2; }));
538 for (
int i = 0; i <
N; ++i)
543 for (
int i = 0; i <
N; ++i)
546 for (
int i = 0; i <
N; i += 2)
551 for (
int i = 0; i <
N; ++i)
608 ::testing::InitGoogleTest(&
argc,
argv);
TEST_F(StaticArenaFixture, simple_fail)
T & insert(const T &item)
Insert a new item by copy.
T remove()
Remove the first item of the list.
Forward iterator for DynSkipList.
bool has_curr() const noexcept
Dynamic ordered set implemented with a Skip List.
Key * search_or_insert(const Key &key)
Search and insert if not found.
const Key & min() const
Return the minimum element (first in sorted order)
Key * insert(const Key &key)
Insert an element into the set.
size_t size() const noexcept
Return the number of elements in the set.
bool has(const Key &key) const noexcept
Return true if the key exists in the set.
const Key & max() const
Return the maximum element (last in sorted order)
size_t size() const noexcept
Count the number of elements of the list.
Main namespace for Aleph-w library functions.
bool completed() const noexcept
Return true if all underlying iterators are finished.
DynList< T > maps(const C &c, Op op)
Classic map operation.
Itor::difference_type count(const Itor &beg, const Itor &end, const T &value)
Count elements equal to a value.
T sum(const Container &container, const T &init=T{})
Compute sum of all elements.
Dynamic ordered set implemented with a Skip List.