Mercurial > prosody-hg
comparison tests/test_util_queue.lua @ 7509:d4bd036e679b
test_util_queue: finish stress-test by emptying the queue
| author | Anton Shestakov <av6@dwimlabs.net> |
|---|---|
| date | Thu, 21 Jul 2016 01:23:32 +0800 |
| parents | 736dea7b99ec |
| children |
comparison
equal
deleted
inserted
replaced
| 7508:736dea7b99ec | 7509:d4bd036e679b |
|---|---|
| 44 assert_is(q:push(1)); | 44 assert_is(q:push(1)); |
| 45 for i = 1, 1000 do | 45 for i = 1, 1000 do |
| 46 assert_equal(q:pop(), i); | 46 assert_equal(q:pop(), i); |
| 47 assert_is(q:push(i+1)); | 47 assert_is(q:push(i+1)); |
| 48 end | 48 end |
| 49 assert_equal(q:pop(), 1001); | |
| 50 assert_equal(q:count(), 0); | |
| 49 end | 51 end |
| 50 | 52 |
| 51 do | 53 do |
| 52 -- Test queues that purge old items when pushing to a full queue | 54 -- Test queues that purge old items when pushing to a full queue |
| 53 local q = new(10, true); | 55 local q = new(10, true); |
