Skip to content

Commit

Permalink
add simple tests for list(size, value) ctor and get_allocator function
Browse files Browse the repository at this point in the history
  • Loading branch information
Emmanuel Nyarko authored and Emmanuel Nyarko committed Apr 24, 2024
1 parent d1328c9 commit b90e65c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion source/stdcpp/test/list.d
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,19 @@ unittest
p.resize(3);
assert(p.size == 3);

list!int cp_obj = p; //opAssign
list!int cp_obj = p; // copy ctor
assert(cp_obj.size == 3);
cp_obj.clear();
cp_obj.push_back(45);
cp_obj.push_back(56);
assert(cp_obj.front == 45);
assert(cp_obj.back == 56);
}

unittest
{
import stdcpp.allocator;
allocator!int alloc_instance = allocator!(int).init;
auto q = list!int(8, 9);
assert(q.get_allocator == alloc_instance);
}

0 comments on commit b90e65c

Please sign in to comment.