Mercurial > pidgin.yaz
annotate libpurple/tests/test_qq.c @ 31220:3ccddae82532
Add P2PFooter helper functions.
author | masca@cpw.pidgin.im |
---|---|
date | Tue, 08 Jun 2010 21:08:13 +0000 |
parents | 2da9e4266742 |
children |
rev | line source |
---|---|
28560
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
1 #include <string.h> |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
2 |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
3 #include "tests.h" |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
4 #include "../protocols/qq/qq_crypt.h" |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
5 |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
6 START_TEST(test_qq_encrypt) |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
7 { |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
8 const guint8 * const key = (guint8 *)"hamburger"; |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
9 guint8 crypted[80]; |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
10 gint ret; |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
11 |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
12 ret = qq_encrypt(crypted, (const guint8 * const)"a", 1, key); |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
13 assert_int_equal(16, ret); |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
14 |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
15 ret = qq_encrypt(crypted, (const guint8 * const)"aa", 2, key); |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
16 assert_int_equal(16, ret); |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
17 |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
18 ret = qq_encrypt(crypted, (const guint8 * const)"aaa", 3, key); |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
19 assert_int_equal(16, ret); |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
20 |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
21 ret = qq_encrypt(crypted, (const guint8 * const)"aaaa", 4, key); |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
22 assert_int_equal(16, ret); |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
23 |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
24 ret = qq_encrypt(crypted, (const guint8 * const)"aaaaa", 5, key); |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
25 assert_int_equal(16, ret); |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
26 |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
27 ret = qq_encrypt(crypted, (const guint8 * const)"aaaaaa", 6, key); |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
28 assert_int_equal(16, ret); |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
29 |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
30 ret = qq_encrypt(crypted, (const guint8 * const)"aaaaaaa", 7, key); |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
31 assert_int_equal(24, ret); |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
32 |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
33 ret = qq_encrypt(crypted, (const guint8 * const)"aaaaaaaa", 8, key); |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
34 assert_int_equal(24, ret); |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
35 |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
36 ret = qq_encrypt(crypted, (const guint8 * const)"aaaaaaaaa", 9, key); |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
37 assert_int_equal(24, ret); |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
38 |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
39 ret = qq_encrypt(crypted, (const guint8 * const)"aaaaaaaaaa", 10, key); |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
40 assert_int_equal(24, ret); |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
41 |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
42 ret = qq_encrypt(crypted, |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
43 (const guint8 * const)"aaaaaaaaaaa", 11, key); |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
44 assert_int_equal(24, ret); |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
45 |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
46 ret = qq_encrypt(crypted, |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
47 (const guint8 * const)"aaaaaaaaaaaa", 12, key); |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
48 assert_int_equal(24, ret); |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
49 |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
50 ret = qq_encrypt(crypted, |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
51 (const guint8 * const)"aaaaaaaaaaaaa", 13, key); |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
52 assert_int_equal(24, ret); |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
53 |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
54 ret = qq_encrypt(crypted, |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
55 (const guint8 * const)"aaaaaaaaaaaaaa", 14, key); |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
56 assert_int_equal(24, ret); |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
57 |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
58 ret = qq_encrypt(crypted, |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
59 (const guint8 * const)"aaaaaaaaaaaaaaa", 15, key); |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
60 assert_int_equal(32, ret); |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
61 |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
62 ret = qq_encrypt(crypted, |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
63 (const guint8 * const)"aaaaaaaaaaaaaaaa", 16, key); |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
64 assert_int_equal(32, ret); |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
65 |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
66 ret = qq_encrypt(crypted, |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
67 (const guint8 * const)"aaaaaaaaaaaaaaaaa", 17, key); |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
68 assert_int_equal(32, ret); |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
69 |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
70 ret = qq_encrypt(crypted, |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
71 (const guint8 * const)"aaaaaaaaaaaaaaaaaa", 18, key); |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
72 assert_int_equal(32, ret); |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
73 |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
74 ret = qq_encrypt(crypted, |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
75 (const guint8 * const)"aaaaaaaaaaaaaaaaaaa", 19, key); |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
76 assert_int_equal(32, ret); |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
77 |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
78 /* |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
79 fprintf(stderr, "crypted=%s\n", crypted); |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
80 assert_string_equal_free("plain", |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
81 yahoo_codes_to_html("plain")); |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
82 */ |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
83 } |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
84 END_TEST |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
85 |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
86 START_TEST(test_qq_decrypt) |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
87 { |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
88 } |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
89 END_TEST |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
90 |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
91 Suite * |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
92 qq_suite(void) |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
93 { |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
94 Suite *s; |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
95 TCase *tc; |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
96 |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
97 s = suite_create("QQ"); |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
98 |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
99 tc = tcase_create("QQ Crypt Functions"); |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
100 tcase_add_test(tc, test_qq_encrypt); |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
101 tcase_add_test(tc, test_qq_decrypt); |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
102 suite_add_tcase(s, tc); |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
103 |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
104 return s; |
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
105 } |