Mercurial > pidgin
annotate libpurple/tests/check_libpurple.c @ 31373:6c660dc7cb6a
Moved the conversation attributes API and the IRC periodic WHO updates to i.p.p.next.minor, where they belong.
applied changes from 3de680fff7ddd1b00149657afb7f6cd833000a90
through 7ee5e1d431651ed2b1a54bc942d63f35580af55c
applied changes from e7c103fdfbc59bb2ca41a3c8813c4ff2847a673f
through 22937ab220c41cd0c4a3f9e21e3db687db80da75
applied changes from 22937ab220c41cd0c4a3f9e21e3db687db80da75
through cba010d1c097d4e6599f08276ed9d894710c1074
applied changes from a694289accbec14c593b3636ef1f626fd8279805
through 8a43e3ddd7adacb208afe2d7ee3ea983c95901be
author | Evan Schoenberg <evan.s@dreskin.net> |
---|---|
date | Mon, 21 Feb 2011 23:08:47 +0000 |
parents | 6362579b3d2e |
children | e743507b3767 |
rev | line source |
---|---|
15805
a0a5e323a6ac
libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1 #include <glib.h> |
a0a5e323a6ac
libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2 #include <stdlib.h> |
a0a5e323a6ac
libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3 |
21804
fb73a6ed8197
A couple compile fixes to the tests from Elliott Sales de Andrade. Fixes #4313.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18368
diff
changeset
|
4 #include "tests.h" |
fb73a6ed8197
A couple compile fixes to the tests from Elliott Sales de Andrade. Fixes #4313.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18368
diff
changeset
|
5 |
15805
a0a5e323a6ac
libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
6 #include "../core.h" |
a0a5e323a6ac
libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
7 #include "../eventloop.h" |
15888
6577b292e7b4
Fix compiler warnings and errors in tests resulting from using DEBUG_CFLAGS
Stu Tomlinson <stu@nosnilmot.com>
parents:
15822
diff
changeset
|
8 #include "../util.h" |
15805
a0a5e323a6ac
libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
9 |
a0a5e323a6ac
libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
10 |
a0a5e323a6ac
libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
11 /****************************************************************************** |
a0a5e323a6ac
libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
12 * libpurple goodies |
a0a5e323a6ac
libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
13 *****************************************************************************/ |
a0a5e323a6ac
libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
14 static guint |
15822 | 15 purple_check_input_add(gint fd, PurpleInputCondition condition, |
16 PurpleInputFunction function, gpointer data) | |
15805
a0a5e323a6ac
libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
17 { |
a0a5e323a6ac
libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
18 /* this is a no-op for now, feel free to implement it */ |
a0a5e323a6ac
libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
19 return 0; |
a0a5e323a6ac
libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
20 } |
a0a5e323a6ac
libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
21 |
15822 | 22 static PurpleEventLoopUiOps eventloop_ui_ops = { |
15805
a0a5e323a6ac
libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
23 g_timeout_add, |
18368
743ff8e14b17
Fix warnings and add a call to g_timeout_add_seconds() just because.
Richard Laager <rlaager@wiktel.com>
parents:
16526
diff
changeset
|
24 g_source_remove, |
15822 | 25 purple_check_input_add, |
18368
743ff8e14b17
Fix warnings and add a call to g_timeout_add_seconds() just because.
Richard Laager <rlaager@wiktel.com>
parents:
16526
diff
changeset
|
26 g_source_remove, |
743ff8e14b17
Fix warnings and add a call to g_timeout_add_seconds() just because.
Richard Laager <rlaager@wiktel.com>
parents:
16526
diff
changeset
|
27 NULL, /* input_get_error */ |
743ff8e14b17
Fix warnings and add a call to g_timeout_add_seconds() just because.
Richard Laager <rlaager@wiktel.com>
parents:
16526
diff
changeset
|
28 #if GLIB_CHECK_VERSION(2,14,0) |
743ff8e14b17
Fix warnings and add a call to g_timeout_add_seconds() just because.
Richard Laager <rlaager@wiktel.com>
parents:
16526
diff
changeset
|
29 g_timeout_add_seconds, |
743ff8e14b17
Fix warnings and add a call to g_timeout_add_seconds() just because.
Richard Laager <rlaager@wiktel.com>
parents:
16526
diff
changeset
|
30 #else |
743ff8e14b17
Fix warnings and add a call to g_timeout_add_seconds() just because.
Richard Laager <rlaager@wiktel.com>
parents:
16526
diff
changeset
|
31 NULL, |
743ff8e14b17
Fix warnings and add a call to g_timeout_add_seconds() just because.
Richard Laager <rlaager@wiktel.com>
parents:
16526
diff
changeset
|
32 #endif |
743ff8e14b17
Fix warnings and add a call to g_timeout_add_seconds() just because.
Richard Laager <rlaager@wiktel.com>
parents:
16526
diff
changeset
|
33 NULL, |
743ff8e14b17
Fix warnings and add a call to g_timeout_add_seconds() just because.
Richard Laager <rlaager@wiktel.com>
parents:
16526
diff
changeset
|
34 NULL, |
15888
6577b292e7b4
Fix compiler warnings and errors in tests resulting from using DEBUG_CFLAGS
Stu Tomlinson <stu@nosnilmot.com>
parents:
15822
diff
changeset
|
35 NULL |
15805
a0a5e323a6ac
libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
36 }; |
a0a5e323a6ac
libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
37 |
a0a5e323a6ac
libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
38 static void |
15822 | 39 purple_check_init(void) { |
22972
6c015d2764d3
Initialize the type system in purple_check_init to prevent 'make check'
Stu Tomlinson <stu@nosnilmot.com>
parents:
21804
diff
changeset
|
40 g_type_init(); |
6c015d2764d3
Initialize the type system in purple_check_init to prevent 'make check'
Stu Tomlinson <stu@nosnilmot.com>
parents:
21804
diff
changeset
|
41 |
15822 | 42 purple_eventloop_set_ui_ops(&eventloop_ui_ops); |
15805
a0a5e323a6ac
libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
43 |
29914
a40c55113f7d
Use /dev/null for the purple directory for the tests.
Paul Aurich <paul@darkrain42.org>
parents:
28790
diff
changeset
|
44 #if 0 |
15805
a0a5e323a6ac
libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
45 /* build our fake home directory */ |
29914
a40c55113f7d
Use /dev/null for the purple directory for the tests.
Paul Aurich <paul@darkrain42.org>
parents:
28790
diff
changeset
|
46 { |
a40c55113f7d
Use /dev/null for the purple directory for the tests.
Paul Aurich <paul@darkrain42.org>
parents:
28790
diff
changeset
|
47 gchar *home_dir; |
a40c55113f7d
Use /dev/null for the purple directory for the tests.
Paul Aurich <paul@darkrain42.org>
parents:
28790
diff
changeset
|
48 |
a40c55113f7d
Use /dev/null for the purple directory for the tests.
Paul Aurich <paul@darkrain42.org>
parents:
28790
diff
changeset
|
49 home_dir = g_build_path(G_DIR_SEPARATOR_S, BUILDDIR, "libpurple", "tests", "home", NULL); |
a40c55113f7d
Use /dev/null for the purple directory for the tests.
Paul Aurich <paul@darkrain42.org>
parents:
28790
diff
changeset
|
50 purple_util_set_user_dir(home_dir); |
a40c55113f7d
Use /dev/null for the purple directory for the tests.
Paul Aurich <paul@darkrain42.org>
parents:
28790
diff
changeset
|
51 g_free(home_dir); |
a40c55113f7d
Use /dev/null for the purple directory for the tests.
Paul Aurich <paul@darkrain42.org>
parents:
28790
diff
changeset
|
52 } |
a40c55113f7d
Use /dev/null for the purple directory for the tests.
Paul Aurich <paul@darkrain42.org>
parents:
28790
diff
changeset
|
53 #else |
a40c55113f7d
Use /dev/null for the purple directory for the tests.
Paul Aurich <paul@darkrain42.org>
parents:
28790
diff
changeset
|
54 purple_util_set_user_dir("/dev/null"); |
a40c55113f7d
Use /dev/null for the purple directory for the tests.
Paul Aurich <paul@darkrain42.org>
parents:
28790
diff
changeset
|
55 #endif |
15805
a0a5e323a6ac
libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
56 |
15822 | 57 purple_core_init("check"); |
15805
a0a5e323a6ac
libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
58 } |
a0a5e323a6ac
libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
59 |
a0a5e323a6ac
libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
60 /****************************************************************************** |
a0a5e323a6ac
libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
61 * Check meat and potatoes |
a0a5e323a6ac
libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
62 *****************************************************************************/ |
a0a5e323a6ac
libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
63 Suite* |
a0a5e323a6ac
libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
64 master_suite(void) |
a0a5e323a6ac
libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
65 { |
a0a5e323a6ac
libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
66 Suite *s = suite_create("Master Suite"); |
a0a5e323a6ac
libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
67 |
a0a5e323a6ac
libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
68 return s; |
a0a5e323a6ac
libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
69 } |
a0a5e323a6ac
libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
70 |
a0a5e323a6ac
libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
71 int main(void) |
a0a5e323a6ac
libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
72 { |
a0a5e323a6ac
libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
73 int number_failed; |
16526
32188b6d2db8
Use fatal asserts unconditionally in the test code. Perhaps this could be better integrated in some way, but this works.
Richard Laager <rlaager@wiktel.com>
parents:
15888
diff
changeset
|
74 SRunner *sr; |
32188b6d2db8
Use fatal asserts unconditionally in the test code. Perhaps this could be better integrated in some way, but this works.
Richard Laager <rlaager@wiktel.com>
parents:
15888
diff
changeset
|
75 |
28790
c0c24f947211
Allow toggling debugging in the test suite with the environment variable
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28787
diff
changeset
|
76 if (g_getenv("PURPLE_CHECK_DEBUG")) |
c0c24f947211
Allow toggling debugging in the test suite with the environment variable
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28787
diff
changeset
|
77 purple_debug_set_enabled(TRUE); |
c0c24f947211
Allow toggling debugging in the test suite with the environment variable
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28787
diff
changeset
|
78 |
16526
32188b6d2db8
Use fatal asserts unconditionally in the test code. Perhaps this could be better integrated in some way, but this works.
Richard Laager <rlaager@wiktel.com>
parents:
15888
diff
changeset
|
79 /* Make g_return_... functions fatal, ALWAYS. |
32188b6d2db8
Use fatal asserts unconditionally in the test code. Perhaps this could be better integrated in some way, but this works.
Richard Laager <rlaager@wiktel.com>
parents:
15888
diff
changeset
|
80 * As this is the test code, this is NOT controlled |
32188b6d2db8
Use fatal asserts unconditionally in the test code. Perhaps this could be better integrated in some way, but this works.
Richard Laager <rlaager@wiktel.com>
parents:
15888
diff
changeset
|
81 * by PURPLE_FATAL_ASSERTS. */ |
32188b6d2db8
Use fatal asserts unconditionally in the test code. Perhaps this could be better integrated in some way, but this works.
Richard Laager <rlaager@wiktel.com>
parents:
15888
diff
changeset
|
82 g_log_set_always_fatal(G_LOG_LEVEL_CRITICAL); |
32188b6d2db8
Use fatal asserts unconditionally in the test code. Perhaps this could be better integrated in some way, but this works.
Richard Laager <rlaager@wiktel.com>
parents:
15888
diff
changeset
|
83 |
32188b6d2db8
Use fatal asserts unconditionally in the test code. Perhaps this could be better integrated in some way, but this works.
Richard Laager <rlaager@wiktel.com>
parents:
15888
diff
changeset
|
84 sr = srunner_create (master_suite()); |
15805
a0a5e323a6ac
libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
85 |
a0a5e323a6ac
libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
86 srunner_add_suite(sr, cipher_suite()); |
30254
6362579b3d2e
jabber: Start adding some caps tests
Paul Aurich <paul@darkrain42.org>
parents:
29914
diff
changeset
|
87 srunner_add_suite(sr, jabber_caps_suite()); |
15805
a0a5e323a6ac
libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
88 srunner_add_suite(sr, jabber_jutil_suite()); |
28703
338eeaf371e2
jabber: Add the Hi() function (PBKDF2).
Paul Aurich <paul@darkrain42.org>
parents:
28201
diff
changeset
|
89 srunner_add_suite(sr, jabber_scram_suite()); |
28201
2da9e4266742
Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents:
27747
diff
changeset
|
90 srunner_add_suite(sr, qq_suite()); |
27747
42359a734696
Add a super simple test for yahoo_codes_to_html(). I'm planning on
Mark Doliner <mark@kingant.net>
parents:
22972
diff
changeset
|
91 srunner_add_suite(sr, yahoo_util_suite()); |
15805
a0a5e323a6ac
libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
92 srunner_add_suite(sr, util_suite()); |
a0a5e323a6ac
libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
93 |
a0a5e323a6ac
libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
94 /* make this a libpurple "ui" */ |
15822 | 95 purple_check_init(); |
15805
a0a5e323a6ac
libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
96 |
a0a5e323a6ac
libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
97 srunner_run_all (sr, CK_NORMAL); |
a0a5e323a6ac
libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
98 number_failed = srunner_ntests_failed (sr); |
a0a5e323a6ac
libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
99 srunner_free (sr); |
a0a5e323a6ac
libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
100 |
15822 | 101 purple_core_quit(); |
15805
a0a5e323a6ac
libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
102 |
a0a5e323a6ac
libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
103 return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; |
a0a5e323a6ac
libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
104 } |