summaryrefslogtreecommitdiff
path: root/tests/std/test_queue.zc
diff options
context:
space:
mode:
authorZuhaitz <zuhaitz.zechhub@gmail.com>2026-01-21 19:12:32 +0000
committerGitHub <noreply@github.com>2026-01-21 19:12:32 +0000
commit9e47e8e2d7c7c589c3c158cd5ef3069289709fa8 (patch)
tree5061720c3451dd1561ba99ac79c78f487cf4de0c /tests/std/test_queue.zc
parent83cf9acfa64b9303064db569c662df5806b464aa (diff)
parente8ef3454880b92a5485a339b3b6fe7b64cfe5305 (diff)
Merge pull request #85 from lamweilun/dev/weilun/update_stack_and_queue
Add length, clear and is_empty methods to Stack and Queue
Diffstat (limited to 'tests/std/test_queue.zc')
-rw-r--r--tests/std/test_queue.zc14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/std/test_queue.zc b/tests/std/test_queue.zc
index 4d40c42..131eb05 100644
--- a/tests/std/test_queue.zc
+++ b/tests/std/test_queue.zc
@@ -28,6 +28,20 @@ test "Queue Push/Pop" {
assert(v.is_none(), "v should not have a valid value");
}
+test "Queue Length and Clear" {
+ print "Testing Queue clear";
+ var queue = Queue<i32>::new();
+ defer queue.free();
+
+ assert(queue.is_empty() && queue.length() == 0, "queue should be empty");
+
+ queue.push(123);
+ assert(!queue.is_empty() && queue.length() == 1, "queue should have 1 value");
+
+ queue.clear();
+ assert(queue.is_empty() && queue.length() == 0, "queue should be empty");
+}
+
test "Queue Clone" {
print "Testing Queue Cloning";
var queue = Queue<i32>::new();