libpurple/tests/tests.h

Mon, 14 Feb 2011 03:10:09 +0000

author
Mark Doliner <markdoliner@pidgin.im>
date
Mon, 14 Feb 2011 03:10:09 +0000
changeset 31416
a1f75d2eb19c
parent 31394
dd9b4ed08d0a
child 31684
f351c7834b76
permissions
-rw-r--r--

Add unit tests for oscar_util_name_compare. I suspected that this
function missed a few cases, but I was wrong, it's good.
I used ck_assert_int_eq and ck_assert_ne, which look like they
might be newer API. If that causes a problem we can change them
to fail_if and fail_unless

15104
d71bd6517e5e [gaim-migrate @ 17825]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
1 #ifndef TESTS_H
d71bd6517e5e [gaim-migrate @ 17825]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
2 # define TESTS_H
d71bd6517e5e [gaim-migrate @ 17825]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
3
21919
9be7eb0e891c A couple compile fixes to the tests from Elliott Sales de Andrade. Fixes #4313.
Daniel Atallah <datallah@pidgin.im>
parents: 15950
diff changeset
4 #include "../purple.h"
9be7eb0e891c A couple compile fixes to the tests from Elliott Sales de Andrade. Fixes #4313.
Daniel Atallah <datallah@pidgin.im>
parents: 15950
diff changeset
5
15104
d71bd6517e5e [gaim-migrate @ 17825]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
6 #include <check.h>
d71bd6517e5e [gaim-migrate @ 17825]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
7
d71bd6517e5e [gaim-migrate @ 17825]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
8 /* define the test suites here */
15867
27d45557637d libpurplify the 'make check' tests so they work again
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 15435
diff changeset
9 /* remember to add the suite to the runner in check_libpurple.c */
15950
0f01bb61c5d3 Fix compiler warnings and errors in tests resulting from using DEBUG_CFLAGS
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 15867
diff changeset
10 Suite * master_suite(void);
15154
40b03e555de9 [gaim-migrate @ 17878]
Nathan Walp <nwalp@pidgin.im>
parents: 15107
diff changeset
11 Suite * cipher_suite(void);
30507
10c522a4c93a jabber: Start adding some caps tests
Paul Aurich <darkrain42@pidgin.im>
parents: 28862
diff changeset
12 Suite * jabber_caps_suite(void);
31394
dd9b4ed08d0a jabber: Test harness for DIGEST-MD5 parsing function.
Paul Aurich <darkrain42@pidgin.im>
parents: 30507
diff changeset
13 Suite * jabber_digest_md5_suite(void);
15154
40b03e555de9 [gaim-migrate @ 17878]
Nathan Walp <nwalp@pidgin.im>
parents: 15107
diff changeset
14 Suite * jabber_jutil_suite(void);
28862
8a37b7df0850 jabber: Add the Hi() function (PBKDF2).
Paul Aurich <darkrain42@pidgin.im>
parents: 28491
diff changeset
15 Suite * jabber_scram_suite(void);
31416
a1f75d2eb19c Add unit tests for oscar_util_name_compare. I suspected that this
Mark Doliner <markdoliner@pidgin.im>
parents: 31394
diff changeset
16 Suite * oscar_util_suite(void);
28490
fdf38a8ff87e Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <markdoliner@pidgin.im>
parents: 28013
diff changeset
17 Suite * qq_suite(void);
28013
cb4d0ca2e550 Add a super simple test for yahoo_codes_to_html(). I'm planning on
Mark Doliner <markdoliner@pidgin.im>
parents: 21919
diff changeset
18 Suite * yahoo_util_suite(void);
15104
d71bd6517e5e [gaim-migrate @ 17825]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
19 Suite * util_suite(void);
d71bd6517e5e [gaim-migrate @ 17825]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
20
d71bd6517e5e [gaim-migrate @ 17825]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
21 /* helper macros */
28490
fdf38a8ff87e Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <markdoliner@pidgin.im>
parents: 28013
diff changeset
22 #define assert_int_equal(expected, actual) { \
28491
b991000ed0d3 Keep our tenses the same
Mark Doliner <markdoliner@pidgin.im>
parents: 28490
diff changeset
23 fail_if(expected != actual, "Expected '%d' but got '%d'", expected, actual); \
28490
fdf38a8ff87e Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <markdoliner@pidgin.im>
parents: 28013
diff changeset
24 }
fdf38a8ff87e Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <markdoliner@pidgin.im>
parents: 28013
diff changeset
25
15104
d71bd6517e5e [gaim-migrate @ 17825]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
26 #define assert_string_equal(expected, actual) { \
d71bd6517e5e [gaim-migrate @ 17825]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
27 const gchar *a = actual; \
28491
b991000ed0d3 Keep our tenses the same
Mark Doliner <markdoliner@pidgin.im>
parents: 28490
diff changeset
28 fail_unless(strcmp(expected, a) == 0, "Expected '%s' but got '%s'", expected, a); \
15104
d71bd6517e5e [gaim-migrate @ 17825]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
29 }
d71bd6517e5e [gaim-migrate @ 17825]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
30
d71bd6517e5e [gaim-migrate @ 17825]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
31 #define assert_string_equal_free(expected, actual) { \
15107
9873435e156d [gaim-migrate @ 17829]
Nathan Walp <nwalp@pidgin.im>
parents: 15105
diff changeset
32 gchar *b = actual; \
9873435e156d [gaim-migrate @ 17829]
Nathan Walp <nwalp@pidgin.im>
parents: 15105
diff changeset
33 assert_string_equal(expected, b); \
9873435e156d [gaim-migrate @ 17829]
Nathan Walp <nwalp@pidgin.im>
parents: 15105
diff changeset
34 g_free(b); \
15104
d71bd6517e5e [gaim-migrate @ 17825]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
35 }
d71bd6517e5e [gaim-migrate @ 17825]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
36
d71bd6517e5e [gaim-migrate @ 17825]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
37
d71bd6517e5e [gaim-migrate @ 17825]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
38 #endif /* ifndef TESTS_H */
d71bd6517e5e [gaim-migrate @ 17825]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
39

mercurial