OSDN Git Service

unit: The crypto create and cleanup functions are not test cases
authorMarcel Holtmann <marcel@holtmann.org>
Fri, 6 Jun 2014 14:44:39 +0000 (16:44 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Fri, 6 Jun 2014 14:44:39 +0000 (16:44 +0200)
doc/test-coverage.txt
unit/test-crypto.c

index 29a97dc..952e31e 100644 (file)
@@ -13,7 +13,7 @@ test-lib                14    SDP library functions
 test-sdp                133    SDP qualification test cases
 test-uuid                30    UUID conversion handling
 test-mgmt                 2    Management interface handling
-test-crypto               6    Cryptographic toolbox helpers
+test-crypto               4    Cryptographic toolbox helpers
 test-textfile             4    Old textfile storage format
 test-ringbuf              3    Ring buffer functionality
 test-queue                1    Queue handling functionality
@@ -29,7 +29,7 @@ test-gobex-apparam      18    OBEX apparam handling
 test-gobex-transfer      36    OBEX transfer handling
 test-gdbus-client        12    D-Bus client handling
                        -----
-                        520
+                        518
 
 
 Automated end-to-end testing
index c5a6954..fd2ea78 100644 (file)
@@ -107,12 +107,6 @@ static const struct test_data test_data_4 = {
        .t = t_msg_4
 };
 
-static void test_start(void)
-{
-       crypto = bt_crypto_new();
-       g_assert(crypto);
-}
-
 static void print_buf(const uint8_t *t, uint8_t len)
 {
        int i;
@@ -152,21 +146,24 @@ static void test_sign(gconstpointer data)
        g_assert(result_compare(d->t, t));
 }
 
-static void test_stop(void)
-{
-       bt_crypto_unref(crypto);
-}
-
 int main(int argc, char *argv[])
 {
+       int exit_status;
+
+       crypto = bt_crypto_new();
+       if (!crypto)
+               return 0;
+
        g_test_init(&argc, &argv, NULL);
 
-       g_test_add_func("/crypto/start", test_start);
        g_test_add_data_func("/crypto/sign_att_1", &test_data_1, test_sign);
        g_test_add_data_func("/crypto/sign_att_2", &test_data_2, test_sign);
        g_test_add_data_func("/crypto/sign_att_3", &test_data_3, test_sign);
        g_test_add_data_func("/crypto/sign_att_4", &test_data_4, test_sign);
-       g_test_add_func("/crypto/stop", test_stop);
 
-       return g_test_run();
+       exit_status = g_test_run();
+
+       bt_crypto_unref(crypto);
+
+       return exit_status;
 }