aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2016-09-29 17:09:37 +0200
committerJustin M. Keyes <justinkz@gmail.com>2016-10-02 00:24:49 +0200
commit6186df3562e33e92f04ed8c850204ceabc4746e1 (patch)
tree90cc5779b0ba395e1b07069573ddb836a7d9de1f /test
parentc8b6ec2e6a8599203b4cff762f148f62464d9725 (diff)
downloadrneovim-6186df3562e33e92f04ed8c850204ceabc4746e1.tar.gz
rneovim-6186df3562e33e92f04ed8c850204ceabc4746e1.tar.bz2
rneovim-6186df3562e33e92f04ed8c850204ceabc4746e1.zip
event/multiqueue.c: Rename "queue" to "multiqueue".
`lib/queue.h` implements a basic queue. `event/queue.c` implements a specialized data structure on top of lib/queue.h; it is not a "normal" queue. Rename the specialized multi-level queue implemented in event/queue.c to "multiqueue", to avoid confusion when reading the code. Before this change one can eventually notice that "macros (uppercase symbols) are for the normal queue, lowercase operations are for the multi-level queue", but that is unnecessary friction for new developers (or existing developers just visiting this part of the codebase).
Diffstat (limited to 'test')
-rw-r--r--test/unit/fixtures/multiqueue.c16
-rw-r--r--test/unit/fixtures/multiqueue.h4
-rw-r--r--test/unit/fixtures/queue.c16
-rw-r--r--test/unit/fixtures/queue.h4
-rw-r--r--test/unit/queue_spec.lua18
5 files changed, 29 insertions, 29 deletions
diff --git a/test/unit/fixtures/multiqueue.c b/test/unit/fixtures/multiqueue.c
new file mode 100644
index 0000000000..da63e55919
--- /dev/null
+++ b/test/unit/fixtures/multiqueue.c
@@ -0,0 +1,16 @@
+#include <string.h>
+#include <stdlib.h>
+#include "nvim/event/multiqueue.h"
+#include "multiqueue.h"
+
+
+void ut_multiqueue_put(MultiQueue *this, const char *str)
+{
+ multiqueue_put(this, NULL, 1, str);
+}
+
+const char *ut_multiqueue_get(MultiQueue *this)
+{
+ Event event = multiqueue_get(this);
+ return event.argv[0];
+}
diff --git a/test/unit/fixtures/multiqueue.h b/test/unit/fixtures/multiqueue.h
new file mode 100644
index 0000000000..78a3a89063
--- /dev/null
+++ b/test/unit/fixtures/multiqueue.h
@@ -0,0 +1,4 @@
+#include "nvim/event/multiqueue.h"
+
+void ut_multiqueue_put(MultiQueue *queue, const char *str);
+const char *ut_multiqueue_get(MultiQueue *queue);
diff --git a/test/unit/fixtures/queue.c b/test/unit/fixtures/queue.c
deleted file mode 100644
index bbb6274b21..0000000000
--- a/test/unit/fixtures/queue.c
+++ /dev/null
@@ -1,16 +0,0 @@
-#include <string.h>
-#include <stdlib.h>
-#include "nvim/event/queue.h"
-#include "queue.h"
-
-
-void ut_queue_put(Queue *queue, const char *str)
-{
- queue_put(queue, NULL, 1, str);
-}
-
-const char *ut_queue_get(Queue *queue)
-{
- Event event = queue_get(queue);
- return event.argv[0];
-}
diff --git a/test/unit/fixtures/queue.h b/test/unit/fixtures/queue.h
deleted file mode 100644
index ae949c9f29..0000000000
--- a/test/unit/fixtures/queue.h
+++ /dev/null
@@ -1,4 +0,0 @@
-#include "nvim/event/queue.h"
-
-void ut_queue_put(Queue *queue, const char *str);
-const char *ut_queue_get(Queue *queue);
diff --git a/test/unit/queue_spec.lua b/test/unit/queue_spec.lua
index 9326c1cad6..d802367835 100644
--- a/test/unit/queue_spec.lua
+++ b/test/unit/queue_spec.lua
@@ -3,28 +3,28 @@ local helpers = require("test.unit.helpers")
local ffi = helpers.ffi
local eq = helpers.eq
-local queue = helpers.cimport("./test/unit/fixtures/queue.h")
+local multiqueue = helpers.cimport("./test/unit/fixtures/multiqueue.h")
-describe('queue', function()
+describe("multiqueue (multi-level event-queue)", function()
local parent, child1, child2, child3
local function put(q, str)
- queue.ut_queue_put(q, str)
+ multiqueue.ut_multiqueue_put(q, str)
end
local function get(q)
- return ffi.string(queue.ut_queue_get(q))
+ return ffi.string(multiqueue.ut_multiqueue_get(q))
end
local function free(q)
- queue.queue_free(q)
+ multiqueue.multiqueue_free(q)
end
before_each(function()
- parent = queue.queue_new_parent(ffi.NULL, ffi.NULL)
- child1 = queue.queue_new_child(parent)
- child2 = queue.queue_new_child(parent)
- child3 = queue.queue_new_child(parent)
+ parent = multiqueue.multiqueue_new_parent(ffi.NULL, ffi.NULL)
+ child1 = multiqueue.multiqueue_new_child(parent)
+ child2 = multiqueue.multiqueue_new_child(parent)
+ child3 = multiqueue.multiqueue_new_child(parent)
put(child1, 'c1i1')
put(child1, 'c1i2')
put(child2, 'c2i1')