diff options
author | Zhang zhengguang <zhengguang.zhang@intel.com> | 2014-07-17 10:37:39 +0800 |
---|---|---|
committer | Zhang zhengguang <zhengguang.zhang@intel.com> | 2014-07-17 10:37:39 +0800 |
commit | 1b9d0a62f59bb48c8deb2f0b98d9acdffdd9abe7 (patch) | |
tree | 6e991827d28537f7f40f20786c2354fd04a9fdad /unit | |
parent | fbe905ab58ecc31fe64c410c5f580cadc30e7f04 (diff) | |
download | connman-1b9d0a62f59bb48c8deb2f0b98d9acdffdd9abe7.tar.gz connman-1b9d0a62f59bb48c8deb2f0b98d9acdffdd9abe7.tar.bz2 connman-1b9d0a62f59bb48c8deb2f0b98d9acdffdd9abe7.zip |
Imported Upstream version 1.24upstream/1.24
Diffstat (limited to 'unit')
-rw-r--r-- | unit/test-ippool.c | 6 | ||||
-rw-r--r-- | unit/test-pbkdf2-sha1.c | 12 | ||||
-rw-r--r-- | unit/test-prf-sha1.c | 6 |
3 files changed, 10 insertions, 14 deletions
diff --git a/unit/test-ippool.c b/unit/test-ippool.c index e5c08ca7..a11220d1 100644 --- a/unit/test-ippool.c +++ b/unit/test-ippool.c @@ -47,7 +47,7 @@ static void test_case_1(void) __connman_ippool_init(); pool = __connman_ippool_create(23, 1, 500, NULL, NULL); - g_assert(pool == NULL); + g_assert(!pool); for (i = 0; i < 100000; i++) { pool = __connman_ippool_create(23, 1, 20, NULL, NULL); @@ -131,7 +131,7 @@ static void test_case_3(void) while (TRUE) { pool = __connman_ippool_create(23, 1, 100, NULL, NULL); - if (pool == NULL) + if (!pool) break; i += 1; @@ -154,7 +154,7 @@ static void test_case_3(void) LOG("Number of blocks %d", i); - for (it = list; it != NULL; it = it->next) { + for (it = list; it; it = it->next) { pool = it->data; __connman_ippool_unref(pool); diff --git a/unit/test-pbkdf2-sha1.c b/unit/test-pbkdf2-sha1.c index 91be03de..71e1d4e2 100644 --- a/unit/test-pbkdf2-sha1.c +++ b/unit/test-pbkdf2-sha1.c @@ -56,7 +56,7 @@ static void pbkdf2_test(gconstpointer data) key_len = test->key_len ? : (strlen(test->key) / 2); - if (g_test_verbose() == TRUE) { + if (g_test_verbose()) { g_print("Password = \"%s\" (%d octects)\n", test->password, password_len); g_print("Salt = \"%s\" (%d octects)\n", @@ -74,9 +74,8 @@ static void pbkdf2_test(gconstpointer data) for (i = 0; i < key_len; i++) sprintf(key + (i * 2), "%02x", output[i]); - if (g_test_verbose() == TRUE) { + if (g_test_verbose()) g_print("Result = %s\n", key); - } g_assert(strcmp(test->key, key) == 0); } @@ -200,7 +199,7 @@ static void psk_test(gconstpointer data) unsigned int i; int result; - if (test->network == NULL) { + if (!test->network) { memcpy(ssid, test->ssid, test->ssid_len); ssid_len = test->ssid_len; } else { @@ -208,7 +207,7 @@ static void psk_test(gconstpointer data) memcpy(ssid, test->network, ssid_len); } - if (g_test_verbose() == TRUE) { + if (g_test_verbose()) { g_print("Passphrase = \"%s\"\n", test->passphrase); g_print("SSID = {"); for (i = 0; i < ssid_len; i++) @@ -228,9 +227,8 @@ static void psk_test(gconstpointer data) for (i = 0; i < sizeof(output); i++) sprintf(psk + (i * 2), "%02x", output[i]); - if (g_test_verbose() == TRUE) { + if (g_test_verbose()) g_print("Result = %s\n", psk); - } g_assert(strcmp(test->psk, psk) == 0); } diff --git a/unit/test-prf-sha1.c b/unit/test-prf-sha1.c index 5f81f4c4..c6a3787d 100644 --- a/unit/test-prf-sha1.c +++ b/unit/test-prf-sha1.c @@ -51,9 +51,8 @@ static void prf_test(gconstpointer data) prf_len = strlen(test->prf) / 2; - if (g_test_verbose() == TRUE) { + if (g_test_verbose()) g_print("PRF = %s (%d octects)\n", test->prf, prf_len); - } result = prf_sha1(test->key, test->key_len, test->prefix, test->prefix_len, test->data, test->data_len, @@ -64,9 +63,8 @@ static void prf_test(gconstpointer data) for (i = 0; i < prf_len; i++) sprintf(prf + (i * 2), "%02x", output[i]); - if (g_test_verbose() == TRUE) { + if (g_test_verbose()) g_print("Result = %s\n", prf); - } g_assert(strcmp(test->prf, prf) == 0); } |