dovecot-2.2: lib: array - test count/isempty/nonepty
dovecot at dovecot.org
dovecot at dovecot.org
Mon Feb 2 08:27:01 UTC 2015
details: http://hg.dovecot.org/dovecot-2.2/rev/90e1829ba80e
changeset: 18212:90e1829ba80e
user: Phil Carmody <phil at dovecot.fi>
date: Mon Feb 02 10:26:44 2015 +0200
description:
lib: array - test count/isempty/nonepty
Signed-off-by: Phil Carmody <phil at dovecot.fi>
diffstat:
src/lib/test-array.c | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
diffs (37 lines):
diff -r b0ac11ef7f51 -r 90e1829ba80e src/lib/test-array.c
--- a/src/lib/test-array.c Mon Feb 02 10:24:42 2015 +0200
+++ b/src/lib/test-array.c Mon Feb 02 10:26:44 2015 +0200
@@ -9,6 +9,25 @@
unsigned int a, b, c;
};
+static void test_array_count(void)
+{
+ ARRAY(struct foo) foos;
+ struct foo nfoo;
+
+ test_begin("array count/empty");
+ t_array_init(&foos, 32);
+
+ test_assert(array_count(&foos) == 0);
+ test_assert(array_is_empty(&foos));
+ test_assert(!array_not_empty(&foos));
+ nfoo.a = nfoo.b = nfoo.c = 9;
+ array_append(&foos, &nfoo, 1);
+ test_assert(array_count(&foos) == 1);
+ test_assert(!array_is_empty(&foos));
+ test_assert(array_not_empty(&foos));
+
+ test_end();
+}
static void test_array_foreach(void)
{
ARRAY(struct foo) foos;
@@ -210,6 +229,7 @@
void test_array(void)
{
+ test_array_count();
test_array_foreach();
test_array_reverse();
test_array_cmp();
More information about the dovecot-cvs
mailing list