38# include <gtest/gtest.h>
45using namespace testing;
55 std::memset(buf, 0x5a,
sizeof(buf));
56 auto * p = ::new (
static_cast<void *
>(buf))
Dnode<long>;
57 EXPECT_EQ(p->get_data(), 0);
58 EXPECT_TRUE(p->is_empty());
62 EXPECT_EQ(q.get_data(),
nullptr);
70 EXPECT_EQ(ptr->
to_dnode<
int>(), &node);
71 EXPECT_EQ(ptr->
to_data<
int>(), 10);
76 const Dlink * ptr = &node;
77 EXPECT_EQ(ptr->
to_dnode<
int>(), &node);
78 EXPECT_EQ(ptr->
to_data<
int>(), 10);
105 EXPECT_EQ(list.get_next()->get_data(), 1);
106 EXPECT_EQ(list.get_prev()->get_data(), 5);
110 EXPECT_EQ(it.get_curr()->to_data<
int>(), i);
112 auto ptr = list.remove_first();
113 EXPECT_EQ(ptr->get_data(), 1);
114 EXPECT_TRUE(ptr->is_empty());
116 EXPECT_EQ(list.get_next()->get_data(), 1);
bool has_curr() const noexcept
Return true if the iterator has current item.
Doubly linked circular list node.
T & to_data() noexcept
Return the item of the Dnode<T> whose link is this.
Dnode< T > * to_dnode() noexcept
Convert this, which must be the link of a Dnode<T>, to that node.
void insert(Dlink *node) noexcept
Insert node after this.
Dlink * remove_next() noexcept
Remove the item that is after this
Iterator on a list of Dnode objects.
Node belonging to a double circular linked list with header node.
TEST_F(List_of_5_nodes, Basic_operations)
Main namespace for Aleph-w library functions.
Doubly linked list node with typed data.