]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: test-array - fatal tests
authorPhil Carmody <phil@dovecot.fi>
Tue, 25 Nov 2014 01:44:55 +0000 (03:44 +0200)
committerPhil Carmody <phil@dovecot.fi>
Tue, 25 Nov 2014 01:44:55 +0000 (03:44 +0200)
Tests both of the i_asserts which aren't already protected by TYPEOF compile-time
checks.

Signed-off-by: Phil Carmody <phil@dovecot.fi>
src/lib/test-array.c
src/lib/test-lib.c
src/lib/test-lib.h

index 2b407c8ed8042971f9213214438f80bb121ee652..2c8a7a99974e13313415f80cd7468c908606c8cb 100644 (file)
@@ -176,3 +176,28 @@ void test_array(void)
        test_array_cmp();
        test_array_cmp_str();
 }
+
+enum fatal_test_state fatal_array(int stage)
+{
+       switch(stage) {
+       case 0: {
+               ARRAY(double) ad;
+               test_begin("fatal_array");
+               t_array_init(&ad, 3);
+               (void)array_idx(&ad, 3);
+               return FATAL_TEST_FAILURE;
+       } break;
+
+       case 1: {
+               ARRAY(double) ad;
+               ARRAY(short) as;
+               t_array_init(&ad, 2);
+               t_array_init(&as, 8);
+               array_copy(&ad.arr, 1, &as.arr, 0, 4);
+               return FATAL_TEST_FAILURE;
+       } break;
+
+       }
+       test_end();
+       return FATAL_TEST_FINISHED;
+}
index 5c264eb9c1c686866fca13fd020882e73cc8b35b..829cb1858137c51b70dde8cfc00f0b3bd88f99fa 100644 (file)
@@ -52,6 +52,7 @@ int main(void)
                NULL
        };
        static enum fatal_test_state (*fatal_functions[])(int) = {
+               fatal_array,
                fatal_data_stack,
                fatal_mempool,
                fatal_printf_format_fix,
index fe19f6bca7f3c7416e3397114877498cc0a90b3d..5eea844328381f42c48778ee0258a73b1cc8cbeb 100644 (file)
@@ -6,6 +6,7 @@
 
 void test_aqueue(void);
 void test_array(void);
+enum fatal_test_state fatal_array(int);
 void test_base32(void);
 void test_base64(void);
 void test_bits(void);