Mercurial > pidgin
comparison libpurple/tests/test_cipher.c @ 15888:6577b292e7b4
Fix compiler warnings and errors in tests resulting from using DEBUG_CFLAGS
author | Stu Tomlinson <stu@nosnilmot.com> |
---|---|
date | Sat, 24 Mar 2007 19:51:48 +0000 |
parents | 32c366eeeb99 |
children | 24ce4fcce5b0 05795b14f70b |
comparison
equal
deleted
inserted
replaced
15887:8a2e7b406b4e | 15888:6577b292e7b4 |
---|---|
3 #include <stdlib.h> | 3 #include <stdlib.h> |
4 #include <string.h> | 4 #include <string.h> |
5 | 5 |
6 #undef HAVE_DBUS | 6 #undef HAVE_DBUS |
7 | 7 |
8 #include "tests.h" | |
9 | |
8 #include "../cipher.h" | 10 #include "../cipher.h" |
9 #include "../signal.h" | 11 #include "../signal.h" |
10 | 12 |
11 /****************************************************************************** | 13 /****************************************************************************** |
12 * MD4 Tests | 14 * MD4 Tests |
13 *****************************************************************************/ | 15 *****************************************************************************/ |
14 #define MD4_TEST(data, digest) { \ | 16 #define MD4_TEST(data, digest) { \ |
15 PurpleCipher *cipher = NULL; \ | 17 PurpleCipher *cipher = NULL; \ |
16 PurpleCipherContext *context = NULL; \ | 18 PurpleCipherContext *context = NULL; \ |
17 gchar cdigest[33]; \ | 19 gchar cdigest[33]; \ |
18 gchar *sdigest = NULL; \ | |
19 gboolean ret = FALSE; \ | 20 gboolean ret = FALSE; \ |
20 \ | 21 \ |
21 cipher = purple_ciphers_find_cipher("md4"); \ | 22 cipher = purple_ciphers_find_cipher("md4"); \ |
22 context = purple_cipher_context_new(cipher, NULL); \ | 23 context = purple_cipher_context_new(cipher, NULL); \ |
23 purple_cipher_context_append(context, (guchar *)(data), strlen((data))); \ | 24 purple_cipher_context_append(context, (guchar *)(data), strlen((data))); \ |
77 *****************************************************************************/ | 78 *****************************************************************************/ |
78 #define MD5_TEST(data, digest) { \ | 79 #define MD5_TEST(data, digest) { \ |
79 PurpleCipher *cipher = NULL; \ | 80 PurpleCipher *cipher = NULL; \ |
80 PurpleCipherContext *context = NULL; \ | 81 PurpleCipherContext *context = NULL; \ |
81 gchar cdigest[33]; \ | 82 gchar cdigest[33]; \ |
82 gchar *sdigest = NULL; \ | |
83 gboolean ret = FALSE; \ | 83 gboolean ret = FALSE; \ |
84 \ | 84 \ |
85 cipher = purple_ciphers_find_cipher("md5"); \ | 85 cipher = purple_ciphers_find_cipher("md5"); \ |
86 context = purple_cipher_context_new(cipher, NULL); \ | 86 context = purple_cipher_context_new(cipher, NULL); \ |
87 purple_cipher_context_append(context, (guchar *)(data), strlen((data))); \ | 87 purple_cipher_context_append(context, (guchar *)(data), strlen((data))); \ |
140 *****************************************************************************/ | 140 *****************************************************************************/ |
141 #define SHA1_TEST(data, digest) { \ | 141 #define SHA1_TEST(data, digest) { \ |
142 PurpleCipher *cipher = NULL; \ | 142 PurpleCipher *cipher = NULL; \ |
143 PurpleCipherContext *context = NULL; \ | 143 PurpleCipherContext *context = NULL; \ |
144 gchar cdigest[41]; \ | 144 gchar cdigest[41]; \ |
145 gchar *sdigest = NULL; \ | |
146 gboolean ret = FALSE; \ | 145 gboolean ret = FALSE; \ |
147 \ | 146 \ |
148 cipher = purple_ciphers_find_cipher("sha1"); \ | 147 cipher = purple_ciphers_find_cipher("sha1"); \ |
149 context = purple_cipher_context_new(cipher, NULL); \ | 148 context = purple_cipher_context_new(cipher, NULL); \ |
150 \ | 149 \ |
196 *****************************************************************************/ | 195 *****************************************************************************/ |
197 Suite * | 196 Suite * |
198 cipher_suite(void) { | 197 cipher_suite(void) { |
199 Suite *s = suite_create("Cipher Suite"); | 198 Suite *s = suite_create("Cipher Suite"); |
200 TCase *tc = NULL; | 199 TCase *tc = NULL; |
201 | 200 |
202 /* md4 tests */ | 201 /* md4 tests */ |
203 tc = tcase_create("MD4"); | 202 tc = tcase_create("MD4"); |
204 tcase_add_test(tc, test_md4_empty_string); | 203 tcase_add_test(tc, test_md4_empty_string); |
205 tcase_add_test(tc, test_md4_a); | 204 tcase_add_test(tc, test_md4_a); |
206 tcase_add_test(tc, test_md4_abc); | 205 tcase_add_test(tc, test_md4_abc); |