annotate libpurple/tests/check_libpurple.c @ 16038:a1e7341d5ee6

Updated translation from Martin Srebotnjak <miles@filmsi.net>
author Richard Laager <rlaager@wiktel.com>
date Tue, 10 Apr 2007 16:48:20 +0000
parents 6577b292e7b4
children 32188b6d2db8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15806
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
a0a5e323a6ac libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
4 #include "../core.h"
a0a5e323a6ac libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
5 #include "../eventloop.h"
15889
6577b292e7b4 Fix compiler warnings and errors in tests resulting from using DEBUG_CFLAGS
Stu Tomlinson <stu@nosnilmot.com>
parents: 15823
diff changeset
6 #include "../util.h"
15806
a0a5e323a6ac libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
7
a0a5e323a6ac libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
8 #include "tests.h"
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 * libpurple goodies
a0a5e323a6ac libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
12 *****************************************************************************/
a0a5e323a6ac libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
13 static guint
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15806
diff changeset
14 purple_check_input_add(gint fd, PurpleInputCondition condition,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15806
diff changeset
15 PurpleInputFunction function, gpointer data)
15806
a0a5e323a6ac libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
16 {
a0a5e323a6ac libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
17 /* 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
18 return 0;
a0a5e323a6ac libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
19 }
a0a5e323a6ac libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
20
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15806
diff changeset
21 static PurpleEventLoopUiOps eventloop_ui_ops = {
15806
a0a5e323a6ac libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
22 g_timeout_add,
a0a5e323a6ac libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
23 (guint (*)(guint))g_source_remove,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15806
diff changeset
24 purple_check_input_add,
15806
a0a5e323a6ac libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
25 (guint (*)(guint))g_source_remove,
15889
6577b292e7b4 Fix compiler warnings and errors in tests resulting from using DEBUG_CFLAGS
Stu Tomlinson <stu@nosnilmot.com>
parents: 15823
diff changeset
26 NULL
15806
a0a5e323a6ac libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
27 };
a0a5e323a6ac libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
28
a0a5e323a6ac libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
29 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15806
diff changeset
30 purple_check_init(void) {
15806
a0a5e323a6ac libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
31 gchar *home_dir;
a0a5e323a6ac libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
32
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15806
diff changeset
33 purple_eventloop_set_ui_ops(&eventloop_ui_ops);
15806
a0a5e323a6ac libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
34
a0a5e323a6ac libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
35 /* build our fake home directory */
a0a5e323a6ac libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
36 home_dir = g_build_path(BUILDDIR, "libpurple", "tests", "home", NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15806
diff changeset
37 purple_util_set_user_dir(home_dir);
15806
a0a5e323a6ac libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
38 g_free(home_dir);
a0a5e323a6ac libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
39
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15806
diff changeset
40 purple_core_init("check");
15806
a0a5e323a6ac libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
41 }
a0a5e323a6ac libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
42
a0a5e323a6ac libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
43 /******************************************************************************
a0a5e323a6ac libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
44 * Check meat and potatoes
a0a5e323a6ac libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
45 *****************************************************************************/
a0a5e323a6ac libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
46 Suite*
a0a5e323a6ac libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
47 master_suite(void)
a0a5e323a6ac libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
48 {
a0a5e323a6ac libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
49 Suite *s = suite_create("Master Suite");
a0a5e323a6ac libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
50
a0a5e323a6ac libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
51 return s;
a0a5e323a6ac libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
52 }
a0a5e323a6ac libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
53
a0a5e323a6ac libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
54 int main(void)
a0a5e323a6ac libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
55 {
a0a5e323a6ac libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
56 int number_failed;
a0a5e323a6ac libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
57 SRunner *sr = srunner_create (master_suite());
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 srunner_add_suite(sr, cipher_suite());
a0a5e323a6ac libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
60 srunner_add_suite(sr, jabber_jutil_suite());
a0a5e323a6ac libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
61 srunner_add_suite(sr, util_suite());
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 /* make this a libpurple "ui" */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15806
diff changeset
64 purple_check_init();
15806
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 srunner_run_all (sr, CK_NORMAL);
a0a5e323a6ac libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
67 number_failed = srunner_ntests_failed (sr);
a0a5e323a6ac libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
68 srunner_free (sr);
a0a5e323a6ac libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
69
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15806
diff changeset
70 purple_core_quit();
15806
a0a5e323a6ac libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
71
a0a5e323a6ac libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
72 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
73 }