Fri, 11 Mar 2022 03:29:48 -0600
Add an echo user to the demo protocol
Testing Done:
Opened a conversation and typed a few message.
Reviewed at https://reviews.imfreedom.org/r/1328/
|
35771
d9f3612faf8d
Fix style warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35756
diff
changeset
|
1 | /* |
|
d9f3612faf8d
Fix style warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35756
diff
changeset
|
2 | * Purple |
|
d9f3612faf8d
Fix style warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35756
diff
changeset
|
3 | * |
|
d9f3612faf8d
Fix style warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35756
diff
changeset
|
4 | * Purple is the legal property of its developers, whose names are too |
|
d9f3612faf8d
Fix style warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35756
diff
changeset
|
5 | * numerous to list here. Please refer to the COPYRIGHT file distributed |
|
d9f3612faf8d
Fix style warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35756
diff
changeset
|
6 | * with this source distribution |
|
d9f3612faf8d
Fix style warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35756
diff
changeset
|
7 | * |
|
d9f3612faf8d
Fix style warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35756
diff
changeset
|
8 | * This program is free software; you can redistribute it and/or modify |
|
d9f3612faf8d
Fix style warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35756
diff
changeset
|
9 | * it under the terms of the GNU General Public License as published by |
|
d9f3612faf8d
Fix style warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35756
diff
changeset
|
10 | * the Free Software Foundation; either version 2 of the License, or (at |
|
d9f3612faf8d
Fix style warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35756
diff
changeset
|
11 | * your option) any later version. |
|
d9f3612faf8d
Fix style warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35756
diff
changeset
|
12 | * |
|
d9f3612faf8d
Fix style warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35756
diff
changeset
|
13 | * This program is distributed in the hope that it will be useful, but |
|
d9f3612faf8d
Fix style warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35756
diff
changeset
|
14 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
|
d9f3612faf8d
Fix style warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35756
diff
changeset
|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
d9f3612faf8d
Fix style warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35756
diff
changeset
|
16 | * General Public License for more details. |
|
d9f3612faf8d
Fix style warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35756
diff
changeset
|
17 | * |
|
d9f3612faf8d
Fix style warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35756
diff
changeset
|
18 | * You should have received a copy of the GNU General Public License |
|
d9f3612faf8d
Fix style warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35756
diff
changeset
|
19 | * along with this program; if not, write to the Free Software |
|
d9f3612faf8d
Fix style warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35756
diff
changeset
|
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
|
d9f3612faf8d
Fix style warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35756
diff
changeset
|
21 | */ |
|
d9f3612faf8d
Fix style warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35756
diff
changeset
|
22 | |
|
37606
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
23 | #include <glib.h> |
|
35663
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
24 | |
|
40358
e6fe6fc1f516
move all protocols, purple plugins, and purple tests to use purple.h instead of including files individually
Gary Kramlich <grim@reaperworld.com>
parents:
37606
diff
changeset
|
25 | #include <purple.h> |
|
35663
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
26 | |
|
35756
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
27 | static gint find_sum; |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
28 | |
|
35663
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
29 | static gboolean |
|
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
30 | test_trie_replace_cb(GString *out, const gchar *word, gpointer word_data, |
|
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
31 | gpointer user_data) |
|
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
32 | { |
|
35665
f1310093e434
Implement and test multi-trie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35664
diff
changeset
|
33 | /* the "test" word for the test_trie_replace test */ |
|
35697
4ac2ddeee1ca
Fix two more warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35665
diff
changeset
|
34 | if ((gintptr)word_data == 0x1001) |
|
35663
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
35 | return FALSE; |
|
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
36 | |
|
35697
4ac2ddeee1ca
Fix two more warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35665
diff
changeset
|
37 | g_string_append_printf(out, "[%d:%x]", |
|
4ac2ddeee1ca
Fix two more warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35665
diff
changeset
|
38 | (int)(gintptr)user_data, (int)(gintptr)word_data); |
|
35663
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
39 | |
|
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
40 | return TRUE; |
|
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
41 | } |
|
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
42 | |
|
35756
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
43 | static gboolean |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
44 | test_trie_find_cb(const gchar *word, gpointer word_data, |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
45 | gpointer user_data) |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
46 | { |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
47 | if ((gintptr)word_data == 0x7004) |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
48 | return FALSE; |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
49 | |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
50 | find_sum += (gintptr)word_data; |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
51 | find_sum -= (gintptr)user_data * 0x1000; |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
52 | |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
53 | return TRUE; |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
54 | } |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
55 | |
|
37606
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
56 | static void |
|
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
57 | test_trie_replace_normal(void) { |
|
35663
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
58 | PurpleTrie *trie; |
|
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
59 | const gchar *in; |
|
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
60 | gchar *out; |
|
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
61 | |
|
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
62 | trie = purple_trie_new(); |
|
35729
27c5683767c8
MemoryPool: fix invalid read, Trie: test tweaks
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35665
diff
changeset
|
63 | purple_trie_set_reset_on_match(trie, FALSE); |
|
35663
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
64 | |
|
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
65 | purple_trie_add(trie, "test", (gpointer)0x1001); |
|
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
66 | purple_trie_add(trie, "testing", (gpointer)0x1002); |
|
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
67 | purple_trie_add(trie, "overtested", (gpointer)0x1003); |
|
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
68 | purple_trie_add(trie, "trie", (gpointer)0x1004); |
|
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
69 | purple_trie_add(trie, "tree", (gpointer)0x1005); |
|
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
70 | purple_trie_add(trie, "implement", (gpointer)0x1006); |
|
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
71 | purple_trie_add(trie, "implementation", (gpointer)0x1007); |
|
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
72 | |
|
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
73 | in = "Alice is testing her trie implementation, " |
|
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
74 | "but she's far away from making test tree overtested"; |
|
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
75 | |
|
35665
f1310093e434
Implement and test multi-trie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35664
diff
changeset
|
76 | out = purple_trie_replace(trie, in, test_trie_replace_cb, (gpointer)1); |
|
35663
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
77 | |
|
37606
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
78 | g_assert_cmpstr( |
|
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
79 | "Alice is [1:1002] her [1:1004] [1:1006]ation," |
|
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
80 | " but she's far away from making test [1:1005] [1:1003]", |
|
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
81 | ==, |
|
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
82 | out |
|
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
83 | ); |
|
35663
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
84 | |
|
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
85 | g_object_unref(trie); |
|
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
86 | g_free(out); |
|
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
87 | } |
|
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
88 | |
|
37606
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
89 | static void |
|
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
90 | test_trie_replace_whole(void) { |
|
35663
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
91 | PurpleTrie *trie; |
|
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
92 | const gchar *in; |
|
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
93 | gchar *out; |
|
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
94 | |
|
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
95 | trie = purple_trie_new(); |
|
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
96 | |
|
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
97 | purple_trie_add(trie, "test", (gpointer)0x2002); |
|
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
98 | |
|
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
99 | in = "test"; |
|
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
100 | |
|
35665
f1310093e434
Implement and test multi-trie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35664
diff
changeset
|
101 | out = purple_trie_replace(trie, in, test_trie_replace_cb, (gpointer)2); |
|
35663
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
102 | |
|
37606
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
103 | g_assert_cmpstr("[2:2002]", ==, out); |
|
35663
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
104 | |
|
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
105 | g_object_unref(trie); |
|
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
106 | g_free(out); |
|
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
107 | } |
|
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
108 | |
|
37606
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
109 | static void |
|
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
110 | test_trie_replace_inner(void) { |
|
35663
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
111 | PurpleTrie *trie; |
|
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
112 | const gchar *in; |
|
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
113 | gchar *out; |
|
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
114 | |
|
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
115 | trie = purple_trie_new(); |
|
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
116 | |
|
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
117 | purple_trie_add(trie, "est", (gpointer)0x3001); |
|
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
118 | purple_trie_add(trie, "tester", (gpointer)0x3002); |
|
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
119 | |
|
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
120 | in = "the test!"; |
|
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
121 | |
|
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
122 | out = purple_trie_replace(trie, in, test_trie_replace_cb, (gpointer)3); |
|
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
123 | |
|
37606
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
124 | g_assert_cmpstr("the t[3:3001]!", ==, out); |
|
35663
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
125 | |
|
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
126 | g_object_unref(trie); |
|
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
127 | g_free(out); |
|
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
128 | } |
|
37606
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
129 | |
|
35663
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
130 | |
|
37606
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
131 | static void |
|
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
132 | test_trie_replace_empty(void) { |
|
35663
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
133 | PurpleTrie *trie; |
|
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
134 | const gchar *in; |
|
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
135 | gchar *out; |
|
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
136 | |
|
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
137 | trie = purple_trie_new(); |
|
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
138 | |
|
35664
4a2cf3314f4b
The empty word case was a bad idea
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35663
diff
changeset
|
139 | purple_trie_add(trie, "test", (gpointer)0x4001); |
|
35663
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
140 | |
|
35664
4a2cf3314f4b
The empty word case was a bad idea
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35663
diff
changeset
|
141 | in = ""; |
|
35663
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
142 | |
|
35665
f1310093e434
Implement and test multi-trie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35664
diff
changeset
|
143 | out = purple_trie_replace(trie, in, test_trie_replace_cb, (gpointer)4); |
|
35663
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
144 | |
|
37606
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
145 | g_assert_cmpstr("", ==, out); |
|
35663
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
146 | |
|
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
147 | g_object_unref(trie); |
|
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
148 | g_free(out); |
|
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
149 | } |
|
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
150 | |
|
37606
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
151 | static void |
|
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
152 | test_trie_multi_replace(void) { |
|
35665
f1310093e434
Implement and test multi-trie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35664
diff
changeset
|
153 | PurpleTrie *trie1, *trie2, *trie3; |
|
f1310093e434
Implement and test multi-trie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35664
diff
changeset
|
154 | GSList *tries = NULL; |
|
f1310093e434
Implement and test multi-trie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35664
diff
changeset
|
155 | const gchar *in; |
|
f1310093e434
Implement and test multi-trie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35664
diff
changeset
|
156 | gchar *out; |
|
f1310093e434
Implement and test multi-trie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35664
diff
changeset
|
157 | |
|
f1310093e434
Implement and test multi-trie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35664
diff
changeset
|
158 | trie1 = purple_trie_new(); |
|
f1310093e434
Implement and test multi-trie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35664
diff
changeset
|
159 | trie2 = purple_trie_new(); |
|
f1310093e434
Implement and test multi-trie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35664
diff
changeset
|
160 | trie3 = purple_trie_new(); |
|
f1310093e434
Implement and test multi-trie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35664
diff
changeset
|
161 | |
|
f1310093e434
Implement and test multi-trie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35664
diff
changeset
|
162 | /* appending is not efficient, but we have only 3 elements */ |
|
f1310093e434
Implement and test multi-trie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35664
diff
changeset
|
163 | tries = g_slist_append(tries, trie1); |
|
f1310093e434
Implement and test multi-trie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35664
diff
changeset
|
164 | tries = g_slist_append(tries, trie2); |
|
f1310093e434
Implement and test multi-trie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35664
diff
changeset
|
165 | tries = g_slist_append(tries, trie3); |
|
f1310093e434
Implement and test multi-trie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35664
diff
changeset
|
166 | |
|
f1310093e434
Implement and test multi-trie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35664
diff
changeset
|
167 | purple_trie_add(trie1, "test", (gpointer)0x5011); |
|
f1310093e434
Implement and test multi-trie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35664
diff
changeset
|
168 | purple_trie_add(trie1, "trie1", (gpointer)0x5012); |
|
f1310093e434
Implement and test multi-trie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35664
diff
changeset
|
169 | purple_trie_add(trie1, "Alice", (gpointer)0x5013); |
|
f1310093e434
Implement and test multi-trie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35664
diff
changeset
|
170 | |
|
f1310093e434
Implement and test multi-trie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35664
diff
changeset
|
171 | purple_trie_add(trie2, "test", (gpointer)0x5021); |
|
f1310093e434
Implement and test multi-trie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35664
diff
changeset
|
172 | purple_trie_add(trie2, "trie2", (gpointer)0x5022); |
|
f1310093e434
Implement and test multi-trie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35664
diff
changeset
|
173 | purple_trie_add(trie2, "example", (gpointer)0x5023); |
|
f1310093e434
Implement and test multi-trie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35664
diff
changeset
|
174 | purple_trie_add(trie2, "Ali", (gpointer)0x5024); |
|
f1310093e434
Implement and test multi-trie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35664
diff
changeset
|
175 | |
|
f1310093e434
Implement and test multi-trie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35664
diff
changeset
|
176 | /* "tester" without last (accepting) letter of "test" */ |
|
f1310093e434
Implement and test multi-trie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35664
diff
changeset
|
177 | purple_trie_add(trie3, "teser", (gpointer)0x5031); |
|
f1310093e434
Implement and test multi-trie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35664
diff
changeset
|
178 | purple_trie_add(trie3, "trie3", (gpointer)0x5032); |
|
f1310093e434
Implement and test multi-trie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35664
diff
changeset
|
179 | purple_trie_add(trie3, "tester", (gpointer)0x5033); |
|
f1310093e434
Implement and test multi-trie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35664
diff
changeset
|
180 | purple_trie_add(trie3, "example", (gpointer)0x5034); |
|
f1310093e434
Implement and test multi-trie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35664
diff
changeset
|
181 | purple_trie_add(trie3, "Al", (gpointer)0x5035); |
|
f1310093e434
Implement and test multi-trie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35664
diff
changeset
|
182 | |
|
f1310093e434
Implement and test multi-trie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35664
diff
changeset
|
183 | in = "test tester trie trie1 trie2 trie3 example Alice"; |
|
f1310093e434
Implement and test multi-trie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35664
diff
changeset
|
184 | |
|
f1310093e434
Implement and test multi-trie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35664
diff
changeset
|
185 | out = purple_trie_multi_replace(tries, in, |
|
f1310093e434
Implement and test multi-trie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35664
diff
changeset
|
186 | test_trie_replace_cb, (gpointer)5); |
|
f1310093e434
Implement and test multi-trie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35664
diff
changeset
|
187 | |
|
37606
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
188 | g_assert_cmpstr( |
|
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
189 | "[5:5011] [5:5011]er trie [5:5012] [5:5022] " |
|
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
190 | "[5:5032] [5:5023] [5:5035]ice", |
|
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
191 | ==, |
|
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
192 | out |
|
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
193 | ); |
|
35665
f1310093e434
Implement and test multi-trie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35664
diff
changeset
|
194 | |
|
f1310093e434
Implement and test multi-trie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35664
diff
changeset
|
195 | g_slist_free_full(tries, g_object_unref); |
|
f1310093e434
Implement and test multi-trie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35664
diff
changeset
|
196 | g_free(out); |
|
f1310093e434
Implement and test multi-trie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35664
diff
changeset
|
197 | } |
|
f1310093e434
Implement and test multi-trie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35664
diff
changeset
|
198 | |
|
37606
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
199 | static void |
|
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
200 | test_trie_remove(void) { |
|
35729
27c5683767c8
MemoryPool: fix invalid read, Trie: test tweaks
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35665
diff
changeset
|
201 | PurpleTrie *trie; |
|
27c5683767c8
MemoryPool: fix invalid read, Trie: test tweaks
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35665
diff
changeset
|
202 | const gchar *in; |
|
27c5683767c8
MemoryPool: fix invalid read, Trie: test tweaks
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35665
diff
changeset
|
203 | gchar *out; |
|
27c5683767c8
MemoryPool: fix invalid read, Trie: test tweaks
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35665
diff
changeset
|
204 | |
|
27c5683767c8
MemoryPool: fix invalid read, Trie: test tweaks
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35665
diff
changeset
|
205 | trie = purple_trie_new(); |
|
27c5683767c8
MemoryPool: fix invalid read, Trie: test tweaks
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35665
diff
changeset
|
206 | |
|
27c5683767c8
MemoryPool: fix invalid read, Trie: test tweaks
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35665
diff
changeset
|
207 | purple_trie_add(trie, "alice", (gpointer)0x6001); |
|
27c5683767c8
MemoryPool: fix invalid read, Trie: test tweaks
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35665
diff
changeset
|
208 | purple_trie_add(trie, "bob", (gpointer)0x6002); |
|
27c5683767c8
MemoryPool: fix invalid read, Trie: test tweaks
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35665
diff
changeset
|
209 | purple_trie_add(trie, "cherry", (gpointer)0x6003); |
|
27c5683767c8
MemoryPool: fix invalid read, Trie: test tweaks
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35665
diff
changeset
|
210 | |
|
27c5683767c8
MemoryPool: fix invalid read, Trie: test tweaks
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35665
diff
changeset
|
211 | purple_trie_remove(trie, "bob"); |
|
27c5683767c8
MemoryPool: fix invalid read, Trie: test tweaks
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35665
diff
changeset
|
212 | |
|
27c5683767c8
MemoryPool: fix invalid read, Trie: test tweaks
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35665
diff
changeset
|
213 | in = "alice bob cherry"; |
|
27c5683767c8
MemoryPool: fix invalid read, Trie: test tweaks
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35665
diff
changeset
|
214 | |
|
27c5683767c8
MemoryPool: fix invalid read, Trie: test tweaks
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35665
diff
changeset
|
215 | out = purple_trie_replace(trie, in, test_trie_replace_cb, (gpointer)6); |
|
27c5683767c8
MemoryPool: fix invalid read, Trie: test tweaks
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35665
diff
changeset
|
216 | |
|
37606
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
217 | g_assert_cmpstr("[6:6001] bob [6:6003]", ==, out); |
|
35729
27c5683767c8
MemoryPool: fix invalid read, Trie: test tweaks
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35665
diff
changeset
|
218 | |
|
27c5683767c8
MemoryPool: fix invalid read, Trie: test tweaks
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35665
diff
changeset
|
219 | g_object_unref(trie); |
|
27c5683767c8
MemoryPool: fix invalid read, Trie: test tweaks
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35665
diff
changeset
|
220 | g_free(out); |
|
27c5683767c8
MemoryPool: fix invalid read, Trie: test tweaks
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35665
diff
changeset
|
221 | } |
|
27c5683767c8
MemoryPool: fix invalid read, Trie: test tweaks
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35665
diff
changeset
|
222 | |
|
37606
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
223 | static void |
|
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
224 | test_trie_find_normal(void) { |
|
35756
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
225 | PurpleTrie *trie; |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
226 | const gchar *in; |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
227 | gint out; |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
228 | |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
229 | trie = purple_trie_new(); |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
230 | |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
231 | purple_trie_add(trie, "alice", (gpointer)0x7001); |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
232 | purple_trie_add(trie, "bob", (gpointer)0x7002); |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
233 | purple_trie_add(trie, "cherry", (gpointer)0x7003); |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
234 | purple_trie_add(trie, "al", (gpointer)0x7004); /* not accepted */ |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
235 | |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
236 | in = "test alice bob test cherry alice"; |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
237 | |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
238 | find_sum = 0; |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
239 | out = purple_trie_find(trie, in, test_trie_find_cb, (gpointer)7); |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
240 | |
|
37606
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
241 | g_assert_cmpint(4, ==, out); |
|
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
242 | g_assert_cmpint(2 * 1 + 2 + 3, ==, find_sum); |
|
35756
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
243 | |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
244 | g_object_unref(trie); |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
245 | } |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
246 | |
|
37606
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
247 | static void |
|
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
248 | test_trie_find_reset(void) { |
|
35756
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
249 | PurpleTrie *trie; |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
250 | const gchar *in; |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
251 | gint out; |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
252 | |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
253 | trie = purple_trie_new(); |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
254 | purple_trie_set_reset_on_match(trie, TRUE); |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
255 | |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
256 | purple_trie_add(trie, "alice", (gpointer)0x8001); |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
257 | purple_trie_add(trie, "ali", (gpointer)0x8002); |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
258 | purple_trie_add(trie, "al", (gpointer)0x8003); |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
259 | |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
260 | in = "al ali alice"; |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
261 | |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
262 | find_sum = 0; |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
263 | out = purple_trie_find(trie, in, test_trie_find_cb, (gpointer)8); |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
264 | |
|
37606
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
265 | g_assert_cmpint(3, ==, out); |
|
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
266 | g_assert_cmpint(3 * 3, ==, find_sum); |
|
35756
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
267 | |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
268 | g_object_unref(trie); |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
269 | } |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
270 | |
|
37606
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
271 | static void |
|
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
272 | test_trie_find_noreset(void) { |
|
35756
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
273 | PurpleTrie *trie; |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
274 | const gchar *in; |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
275 | gint out; |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
276 | |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
277 | trie = purple_trie_new(); |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
278 | purple_trie_set_reset_on_match(trie, FALSE); |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
279 | |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
280 | purple_trie_add(trie, "alice", (gpointer)0x9001); |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
281 | purple_trie_add(trie, "ali", (gpointer)0x9002); |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
282 | purple_trie_add(trie, "al", (gpointer)0x9003); |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
283 | |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
284 | in = "al ali alice"; |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
285 | |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
286 | find_sum = 0; |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
287 | out = purple_trie_find(trie, in, test_trie_find_cb, (gpointer)9); |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
288 | |
|
37606
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
289 | g_assert_cmpint(6, ==, out); |
|
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
290 | g_assert_cmpint(3 * 3 + 2 * 2 + 1, ==, find_sum); |
|
35756
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
291 | |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
292 | g_object_unref(trie); |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
293 | } |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35733
diff
changeset
|
294 | |
|
37606
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
295 | static void |
|
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
296 | test_trie_multi_find(void) { |
|
35790
3118fb87573e
Trie: implement purple_trie_multi_find
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
297 | PurpleTrie *trie1, *trie2, *trie3; |
|
3118fb87573e
Trie: implement purple_trie_multi_find
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
298 | GSList *tries = NULL; |
|
3118fb87573e
Trie: implement purple_trie_multi_find
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
299 | const gchar *in; |
|
3118fb87573e
Trie: implement purple_trie_multi_find
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
300 | int out; |
|
3118fb87573e
Trie: implement purple_trie_multi_find
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
301 | |
|
3118fb87573e
Trie: implement purple_trie_multi_find
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
302 | trie1 = purple_trie_new(); |
|
3118fb87573e
Trie: implement purple_trie_multi_find
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
303 | trie2 = purple_trie_new(); |
|
3118fb87573e
Trie: implement purple_trie_multi_find
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
304 | trie3 = purple_trie_new(); |
|
3118fb87573e
Trie: implement purple_trie_multi_find
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
305 | purple_trie_set_reset_on_match(trie1, FALSE); |
|
3118fb87573e
Trie: implement purple_trie_multi_find
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
306 | purple_trie_set_reset_on_match(trie2, TRUE); |
|
3118fb87573e
Trie: implement purple_trie_multi_find
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
307 | purple_trie_set_reset_on_match(trie3, FALSE); |
|
3118fb87573e
Trie: implement purple_trie_multi_find
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
308 | |
|
3118fb87573e
Trie: implement purple_trie_multi_find
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
309 | /* appending is not efficient, but we have only 3 elements */ |
|
3118fb87573e
Trie: implement purple_trie_multi_find
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
310 | tries = g_slist_append(tries, trie1); |
|
3118fb87573e
Trie: implement purple_trie_multi_find
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
311 | tries = g_slist_append(tries, trie2); |
|
3118fb87573e
Trie: implement purple_trie_multi_find
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
312 | tries = g_slist_append(tries, trie3); |
|
3118fb87573e
Trie: implement purple_trie_multi_find
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
313 | |
|
3118fb87573e
Trie: implement purple_trie_multi_find
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
314 | purple_trie_add(trie1, "test", (gpointer)0x10011); |
|
3118fb87573e
Trie: implement purple_trie_multi_find
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
315 | purple_trie_add(trie1, "trie1", (gpointer)0x10012); |
|
3118fb87573e
Trie: implement purple_trie_multi_find
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
316 | purple_trie_add(trie1, "Alice", (gpointer)0x10013); |
|
3118fb87573e
Trie: implement purple_trie_multi_find
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
317 | |
|
3118fb87573e
Trie: implement purple_trie_multi_find
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
318 | purple_trie_add(trie2, "test", (gpointer)0x10021); |
|
3118fb87573e
Trie: implement purple_trie_multi_find
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
319 | purple_trie_add(trie2, "trie2", (gpointer)0x10022); |
|
3118fb87573e
Trie: implement purple_trie_multi_find
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
320 | purple_trie_add(trie2, "example", (gpointer)0x10023); |
|
3118fb87573e
Trie: implement purple_trie_multi_find
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
321 | purple_trie_add(trie2, "Ali", (gpointer)0x10024); |
|
3118fb87573e
Trie: implement purple_trie_multi_find
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
322 | |
|
3118fb87573e
Trie: implement purple_trie_multi_find
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
323 | /* "tester" without last (accepting) letter of "test" */ |
|
3118fb87573e
Trie: implement purple_trie_multi_find
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
324 | purple_trie_add(trie3, "teser", (gpointer)0x10031); |
|
3118fb87573e
Trie: implement purple_trie_multi_find
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
325 | purple_trie_add(trie3, "trie3", (gpointer)0x10032); |
|
3118fb87573e
Trie: implement purple_trie_multi_find
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
326 | purple_trie_add(trie3, "tester", (gpointer)0x10033); |
|
3118fb87573e
Trie: implement purple_trie_multi_find
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
327 | purple_trie_add(trie3, "example", (gpointer)0x10034); |
|
3118fb87573e
Trie: implement purple_trie_multi_find
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
328 | purple_trie_add(trie3, "Al", (gpointer)0x10035); |
|
3118fb87573e
Trie: implement purple_trie_multi_find
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
329 | |
|
3118fb87573e
Trie: implement purple_trie_multi_find
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
330 | in = "test tester trie trie1 trie2 trie3 example Alice"; |
|
3118fb87573e
Trie: implement purple_trie_multi_find
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
331 | |
|
3118fb87573e
Trie: implement purple_trie_multi_find
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
332 | out = purple_trie_multi_find(tries, in, |
|
3118fb87573e
Trie: implement purple_trie_multi_find
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
333 | test_trie_find_cb, (gpointer)0x10); |
|
3118fb87573e
Trie: implement purple_trie_multi_find
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
334 | |
|
37606
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
335 | g_assert_cmpint(9, ==, out); |
|
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
336 | g_assert_cmpint(2 * 0x11 + 0x33 + 0x12 + 0x22 + |
|
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
337 | 0x32 + 0x23 + 0x35 + 0x13, ==, find_sum); |
|
35790
3118fb87573e
Trie: implement purple_trie_multi_find
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
338 | |
|
3118fb87573e
Trie: implement purple_trie_multi_find
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
339 | g_slist_free_full(tries, g_object_unref); |
|
3118fb87573e
Trie: implement purple_trie_multi_find
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
340 | } |
|
37606
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
341 | |
|
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
342 | gint |
|
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
343 | main(gint argc, gchar **argv) { |
|
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
344 | g_test_init(&argc, &argv, NULL); |
|
35790
3118fb87573e
Trie: implement purple_trie_multi_find
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
345 | |
|
37606
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
346 | g_test_add_func("/trie/replace/normal", |
|
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
347 | test_trie_replace_normal); |
|
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
348 | g_test_add_func("/trie/replace/whole", |
|
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
349 | test_trie_replace_whole); |
|
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
350 | g_test_add_func("/trie/replace/inner", |
|
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
351 | test_trie_replace_inner); |
|
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
352 | g_test_add_func("/trie/replace/empty", |
|
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
353 | test_trie_replace_empty); |
|
35663
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
354 | |
|
37606
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
355 | g_test_add_func("/trie/multi_replace", |
|
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
356 | test_trie_multi_replace); |
|
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
357 | |
|
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
358 | g_test_add_func("/trie/remove", |
|
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
359 | test_trie_remove); |
|
35663
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
360 | |
|
37606
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
361 | g_test_add_func("/trie/find/normal", |
|
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
362 | test_trie_find_normal); |
|
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
363 | g_test_add_func("/trie/find/reset", |
|
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
364 | test_trie_find_reset); |
|
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
365 | g_test_add_func("/trie/find/noreset", |
|
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
366 | test_trie_find_noreset); |
|
35663
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
367 | |
|
37606
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
368 | g_test_add_func("/trie/multi_find", |
|
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
369 | test_trie_multi_find); |
|
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
370 | |
|
c0eca5d1b8fa
Port the trie tests to gtester
Gary Kramlich <grim@reaperworld.com>
parents:
35790
diff
changeset
|
371 | return g_test_run(); |
|
35663
6527214c491e
Add testsuite for PurpleTrie and fix found bugs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
372 | } |