38#include <gtest/gtest.h>
43using namespace testing;
58 EXPECT_EQ(removed, n2);
59 EXPECT_TRUE(removed->is_empty());
63 EXPECT_EQ(removed, n1);
83 EXPECT_EQ(removed, n2);
84 EXPECT_TRUE(removed->is_empty());
89 EXPECT_EQ(removed, n1);
100 EXPECT_THROW(it.
get_curr(), std::overflow_error);
101 EXPECT_THROW(it.
next(), std::overflow_error);
109 EXPECT_THROW(it2.
get_curr(), std::overflow_error);
110 EXPECT_THROW(it2.
next(), std::overflow_error);
119 for (
int i = 0; i < 5; ++i)
125 ASSERT_NE(it.get_curr(),
nullptr);
constexpr bool is_empty() const noexcept
Return true if this link is empty (points to itself).
Iterator over singly linked nodes.
Node * get_curr()
Return the current node.
void next()
Advance the iterator to the next node.
bool has_curr() const noexcept
Return true if the iterator currently points to a node.
Singly linked list of nodes that store values of type T.
Node * remove_first_ne() noexcept
Remove and return the first node without checking emptiness.
Node * get_first_ne() noexcept
Return the first node without checking emptiness.
Node * get_first()
Return a pointer to the first node; throw if the list is empty.
void insert_first(Node *node)
Insert node right after this sentinel (at the beginning).
Node * remove_first()
Remove the first node of the list.
Singly linked node that stores data of type T.
Main namespace for Aleph-w library functions.
Itor::difference_type count(const Itor &beg, const Itor &end, const T &value)
Count elements equal to a value.
Singly linked list with typed nodes.