diff --git a/tests/functionaltests/functionaltests.c b/tests/functionaltests/functionaltests.c
index ea957e49..10e89521 100644
--- a/tests/functionaltests/functionaltests.c
+++ b/tests/functionaltests/functionaltests.c
@@ -22,7 +22,9 @@
#define PROF_FUNC_TEST(test) cmocka_unit_test_setup_teardown(test, init_prof_test, close_prof_test)
-int main(int argc, char* argv[]) {
+int
+main(int argc, char* argv[])
+{
const struct CMUnitTest all_tests[] = {
diff --git a/tests/functionaltests/proftest.c b/tests/functionaltests/proftest.c
index 29c1d4f4..40d99d81 100644
--- a/tests/functionaltests/proftest.c
+++ b/tests/functionaltests/proftest.c
@@ -14,13 +14,13 @@
#include "proftest.h"
-char *config_orig;
-char *data_orig;
+char* config_orig;
+char* data_orig;
int fd = 0;
gboolean
-_create_dir(const char *name)
+_create_dir(const char* name)
{
struct stat sb;
@@ -38,14 +38,14 @@ _create_dir(const char *name)
}
gboolean
-_mkdir_recursive(const char *dir)
+_mkdir_recursive(const char* dir)
{
int i;
gboolean result = TRUE;
for (i = 1; i <= strlen(dir); i++) {
if (dir[i] == '/' || dir[i] == '\0') {
- gchar *next_dir = g_strndup(dir, i);
+ gchar* next_dir = g_strndup(dir, i);
result = _create_dir(next_dir);
g_free(next_dir);
if (!result) {
@@ -60,7 +60,7 @@ _mkdir_recursive(const char *dir)
void
_create_config_dir(void)
{
- GString *profanity_dir = g_string_new(XDG_CONFIG_HOME);
+ GString* profanity_dir = g_string_new(XDG_CONFIG_HOME);
g_string_append(profanity_dir, "/profanity");
if (!_mkdir_recursive(profanity_dir->str)) {
@@ -73,7 +73,7 @@ _create_config_dir(void)
void
_create_data_dir(void)
{
- GString *profanity_dir = g_string_new(XDG_DATA_HOME);
+ GString* profanity_dir = g_string_new(XDG_DATA_HOME);
g_string_append(profanity_dir, "/profanity");
if (!_mkdir_recursive(profanity_dir->str)) {
@@ -86,7 +86,7 @@ _create_data_dir(void)
void
_create_chatlogs_dir(void)
{
- GString *chatlogs_dir = g_string_new(XDG_DATA_HOME);
+ GString* chatlogs_dir = g_string_new(XDG_DATA_HOME);
g_string_append(chatlogs_dir, "/profanity/chatlogs");
if (!_mkdir_recursive(chatlogs_dir->str)) {
@@ -99,7 +99,7 @@ _create_chatlogs_dir(void)
void
_create_logs_dir(void)
{
- GString *logs_dir = g_string_new(XDG_DATA_HOME);
+ GString* logs_dir = g_string_new(XDG_DATA_HOME);
g_string_append(logs_dir, "/profanity/logs");
if (!_mkdir_recursive(logs_dir->str)) {
@@ -124,21 +124,21 @@ prof_start(void)
// helper script sets terminal columns, avoids assertions failing
// based on the test runner terminal size
fd = exp_spawnl("sh",
- "sh",
- "-c",
- "./tests/functionaltests/start_profanity.sh",
- NULL);
- FILE *fp = fdopen(fd, "r+");
+ "sh",
+ "-c",
+ "./tests/functionaltests/start_profanity.sh",
+ NULL);
+ FILE* fp = fdopen(fd, "r+");
assert_true(fp != NULL);
- setbuf(fp, (char *)0);
+ setbuf(fp, (char*)0);
}
int
-init_prof_test(void **state)
+init_prof_test(void** state)
{
- if (stbbr_start(STBBR_LOGDEBUG ,5230, 0) != 0) {
+ if (stbbr_start(STBBR_LOGDEBUG, 5230, 0) != 0) {
assert_true(FALSE);
return -1;
}
@@ -191,7 +191,7 @@ init_prof_test(void **state)
}
int
-close_prof_test(void **state)
+close_prof_test(void** state)
{
prof_input("/quit");
waitpid(exp_pid, NULL, 0);
@@ -205,48 +205,45 @@ close_prof_test(void **state)
}
void
-prof_input(const char *input)
+prof_input(const char* input)
{
- GString *inp_str = g_string_new(input);
+ GString* inp_str = g_string_new(input);
g_string_append(inp_str, "\r");
write(fd, inp_str->str, inp_str->len);
g_string_free(inp_str, TRUE);
}
int
-prof_output_exact(const char *text)
+prof_output_exact(const char* text)
{
return (1 == exp_expectl(fd, exp_exact, text, 1, exp_end));
}
int
-prof_output_regex(const char *text)
+prof_output_regex(const char* text)
{
return (1 == exp_expectl(fd, exp_regexp, text, 1, exp_end));
}
void
-prof_connect_with_roster(const char *roster)
+prof_connect_with_roster(const char* roster)
{
- GString *roster_str = g_string_new(
+ GString* roster_str = g_string_new(
""
- ""
- );
+ "");
g_string_append(roster_str, roster);
g_string_append(roster_str,
- ""
- ""
- );
+ ""
+ "");
stbbr_for_query("jabber:iq:roster", roster_str->str);
g_string_free(roster_str, TRUE);
stbbr_for_id("prof_presence_1",
- ""
- "0"
- ""
- ""
- );
+ ""
+ "0"
+ ""
+ "");
prof_input("/connect stabber@localhost server 127.0.0.1 port 5230 tls allow");
prof_input("password");
@@ -275,6 +272,5 @@ prof_connect(void)
{
prof_connect_with_roster(
" "
- " "
- );
+ " ");
}
diff --git a/tests/functionaltests/proftest.h b/tests/functionaltests/proftest.h
index a3ff07e9..ef1968b1 100644
--- a/tests/functionaltests/proftest.h
+++ b/tests/functionaltests/proftest.h
@@ -4,16 +4,16 @@
#define XDG_CONFIG_HOME "./tests/functionaltests/files/xdg_config_home"
#define XDG_DATA_HOME "./tests/functionaltests/files/xdg_data_home"
-int init_prof_test(void **state);
-int close_prof_test(void **state);
+int init_prof_test(void** state);
+int close_prof_test(void** state);
void prof_start(void);
void prof_connect(void);
-void prof_connect_with_roster(const char *roster);
-void prof_input(const char *input);
+void prof_connect_with_roster(const char* roster);
+void prof_input(const char* input);
-int prof_output_exact(const char *text);
-int prof_output_regex(const char *text);
+int prof_output_exact(const char* text);
+int prof_output_regex(const char* text);
void prof_timeout(int timeout);
void prof_timeout_reset(void);
diff --git a/tests/functionaltests/test_carbons.c b/tests/functionaltests/test_carbons.c
index ddf6194d..41e9a9f5 100644
--- a/tests/functionaltests/test_carbons.c
+++ b/tests/functionaltests/test_carbons.c
@@ -9,31 +9,29 @@
#include "proftest.h"
void
-send_enable_carbons(void **state)
+send_enable_carbons(void** state)
{
prof_connect();
prof_input("/carbons on");
assert_true(stbbr_received(
- ""
- ));
+ ""));
}
void
-connect_with_carbons_enabled(void **state)
+connect_with_carbons_enabled(void** state)
{
prof_input("/carbons on");
prof_connect();
assert_true(stbbr_received(
- ""
- ));
+ ""));
}
void
-send_disable_carbons(void **state)
+send_disable_carbons(void** state)
{
prof_input("/carbons on");
@@ -42,106 +40,96 @@ send_disable_carbons(void **state)
prof_input("/carbons off");
assert_true(stbbr_received(
- ""
- ));
+ ""));
}
void
-receive_carbon(void **state)
+receive_carbon(void** state)
{
prof_input("/carbons on");
prof_connect();
assert_true(stbbr_received(
- ""
- ));
+ ""));
stbbr_send(
""
- "10"
- "On my mobile"
- ""
- );
+ "10"
+ "On my mobile"
+ "");
assert_true(prof_output_exact("Buddy1 (mobile) is online, \"On my mobile\""));
prof_input("/msg Buddy1");
assert_true(prof_output_exact("unencrypted"));
stbbr_send(
""
- ""
- ""
- ""
- "test carbon from recipient"
- ""
- ""
- ""
+ ""
+ ""
+ ""
+ "test carbon from recipient"
""
- );
+ ""
+ ""
+ "");
assert_true(prof_output_regex("Buddy1/mobile: .+test carbon from recipient"));
}
void
-receive_self_carbon(void **state)
+receive_self_carbon(void** state)
{
prof_input("/carbons on");
prof_connect();
assert_true(stbbr_received(
- ""
- ));
+ ""));
stbbr_send(
""
- "10"
- "On my mobile"
- ""
- );
+ "10"
+ "On my mobile"
+ "");
assert_true(prof_output_exact("Buddy1 (mobile) is online, \"On my mobile\""));
prof_input("/msg Buddy1");
assert_true(prof_output_exact("unencrypted"));
stbbr_send(
""
- ""
- ""
- ""
- "self sent carbon"
- ""
- ""
- ""
+ ""
+ ""
+ ""
+ "self sent carbon"
""
- );
+ ""
+ ""
+ "");
assert_true(prof_output_regex("me: .+self sent carbon"));
}
void
-receive_private_carbon(void **state)
+receive_private_carbon(void** state)
{
prof_input("/carbons on");
prof_connect();
assert_true(stbbr_received(
- ""
- ));
+ ""));
stbbr_send(
""
- "10"
- "On my mobile"
- ""
- );
+ "10"
+ "On my mobile"
+ "");
assert_true(prof_output_exact("Buddy1 (mobile) is online, \"On my mobile\""));
prof_input("/msg Buddy1");
assert_true(prof_output_exact("unencrypted"));
stbbr_send(
""
- "Private carbon"
- ""
- ""
- );
+ "
Private carbon"
+ ""
+ "");
assert_true(prof_output_regex("Buddy1/mobile: .+Private carbon"));
}
diff --git a/tests/functionaltests/test_carbons.h b/tests/functionaltests/test_carbons.h
index c724e38c..1096bb84 100644
--- a/tests/functionaltests/test_carbons.h
+++ b/tests/functionaltests/test_carbons.h
@@ -1,6 +1,6 @@
-void send_enable_carbons(void **state);
-void connect_with_carbons_enabled(void **state);
-void send_disable_carbons(void **state);
-void receive_carbon(void **state);
-void receive_self_carbon(void **state);
-void receive_private_carbon(void **state);
+void send_enable_carbons(void** state);
+void connect_with_carbons_enabled(void** state);
+void send_disable_carbons(void** state);
+void receive_carbon(void** state);
+void receive_self_carbon(void** state);
+void receive_private_carbon(void** state);
diff --git a/tests/functionaltests/test_chat_session.c b/tests/functionaltests/test_chat_session.c
index 355b977f..b26a224a 100644
--- a/tests/functionaltests/test_chat_session.c
+++ b/tests/functionaltests/test_chat_session.c
@@ -9,7 +9,7 @@
#include "proftest.h"
void
-sends_message_to_barejid_when_contact_offline(void **state)
+sends_message_to_barejid_when_contact_offline(void** state)
{
prof_connect();
@@ -17,188 +17,166 @@ sends_message_to_barejid_when_contact_offline(void **state)
assert_true(stbbr_received(
""
- "Hi there"
- ""
- ));
+ "Hi there"
+ ""));
}
void
-sends_message_to_barejid_when_contact_online(void **state)
+sends_message_to_barejid_when_contact_online(void** state)
{
prof_connect();
stbbr_send(
""
- "10"
- ""
- );
+ "10"
+ "");
assert_true(prof_output_exact("Buddy1 (mobile) is online"));
prof_input("/msg buddy1@localhost Hi there");
assert_true(stbbr_received(
""
- "Hi there"
- ""
- ));
+ "Hi there"
+ ""));
}
void
-sends_message_to_fulljid_when_received_from_fulljid(void **state)
+sends_message_to_fulljid_when_received_from_fulljid(void** state)
{
prof_connect();
stbbr_send(
""
- "10"
- ""
- );
+ "10"
+ "");
assert_true(prof_output_exact("Buddy1 (mobile) is online"));
stbbr_send(
""
- "First message"
- ""
- );
+ "First message"
+ "");
assert_true(prof_output_exact("<< chat message: Buddy1/mobile (win 2)"));
prof_input("/msg buddy1@localhost Hi there");
assert_true(stbbr_received(
""
- "Hi there"
- ""
- ));
+ "Hi there"
+ ""));
}
void
-sends_subsequent_messages_to_fulljid(void **state)
+sends_subsequent_messages_to_fulljid(void** state)
{
prof_connect();
stbbr_send(
""
- "10"
- ""
- );
+ "10"
+ "");
assert_true(prof_output_exact("Buddy1 (mobile) is online"));
stbbr_send(
""
- "First message"
- ""
- );
+ "First message"
+ "");
assert_true(prof_output_exact("<< chat message: Buddy1/mobile (win 2)"));
prof_input("/msg buddy1@localhost Outgoing 1");
assert_true(stbbr_received(
""
- "Outgoing 1"
- ""
- ));
+ "Outgoing 1"
+ ""));
prof_input("/msg buddy1@localhost Outgoing 2");
assert_true(stbbr_received(
""
- "Outgoing 2"
- ""
- ));
+ "Outgoing 2"
+ ""));
prof_input("/msg buddy1@localhost Outgoing 3");
assert_true(stbbr_received(
""
- "Outgoing 3"
- ""
- ));
+ "Outgoing 3"
+ ""));
}
void
-resets_to_barejid_after_presence_received(void **state)
+resets_to_barejid_after_presence_received(void** state)
{
prof_connect();
stbbr_send(
""
- "10"
- ""
- );
+ "10"
+ "");
assert_true(prof_output_exact("Buddy1 (mobile) is online"));
stbbr_send(
""
- "First message"
- ""
- );
+ "First message"
+ "");
assert_true(prof_output_exact("<< chat message: Buddy1/mobile (win 2)"));
prof_input("/msg buddy1@localhost Outgoing 1");
assert_true(stbbr_received(
""
- "Outgoing 1"
- ""
- ));
+ "Outgoing 1"
+ ""));
stbbr_send(
""
- "5"
- "dnd"
- ""
- );
+ "5"
+ "dnd"
+ "");
assert_true(prof_output_exact("Buddy1 (laptop) is dnd"));
prof_input("/msg buddy1@localhost Outgoing 2");
assert_true(stbbr_received(
""
- "Outgoing 2"
- ""
- ));
+ "Outgoing 2"
+ ""));
}
void
-new_session_when_message_received_from_different_fulljid(void **state)
+new_session_when_message_received_from_different_fulljid(void** state)
{
prof_connect();
stbbr_send(
""
- "10"
- ""
- );
+ "10"
+ "");
assert_true(prof_output_exact("Buddy1 (mobile) is online"));
stbbr_send(
""
- "8"
- "away"
- ""
- );
+ "8"
+ "away"
+ "");
assert_true(prof_output_exact("Buddy1 (laptop) is away"));
stbbr_send(
""
- "From first resource"
- ""
- );
+ "From first resource"
+ "");
assert_true(prof_output_exact("<< chat message: Buddy1/mobile (win 2)"));
prof_input("/msg buddy1@localhost Outgoing 1");
assert_true(stbbr_received(
""
- "Outgoing 1"
- ""
- ));
+ "Outgoing 1"
+ ""));
stbbr_send(
""
- "From second resource"
- ""
- );
+ "From second resource"
+ "");
assert_true(prof_output_regex("Buddy1/laptop:.+From second resource"));
prof_input("/msg buddy1@localhost Outgoing 2");
assert_true(stbbr_received(
""
- "Outgoing 2"
- ""
- ));
+ "Outgoing 2"
+ ""));
}
diff --git a/tests/functionaltests/test_chat_session.h b/tests/functionaltests/test_chat_session.h
index 245bbb11..3bd62fbc 100644
--- a/tests/functionaltests/test_chat_session.h
+++ b/tests/functionaltests/test_chat_session.h
@@ -1,6 +1,6 @@
-void sends_message_to_barejid_when_contact_offline(void **state);
-void sends_message_to_barejid_when_contact_online(void **state);
-void sends_message_to_fulljid_when_received_from_fulljid(void **state);
-void sends_subsequent_messages_to_fulljid(void **state);
-void resets_to_barejid_after_presence_received(void **state);
-void new_session_when_message_received_from_different_fulljid(void **state);
+void sends_message_to_barejid_when_contact_offline(void** state);
+void sends_message_to_barejid_when_contact_online(void** state);
+void sends_message_to_fulljid_when_received_from_fulljid(void** state);
+void sends_subsequent_messages_to_fulljid(void** state);
+void resets_to_barejid_after_presence_received(void** state);
+void new_session_when_message_received_from_different_fulljid(void** state);
diff --git a/tests/functionaltests/test_connect.c b/tests/functionaltests/test_connect.c
index 571293dc..43f6e98c 100644
--- a/tests/functionaltests/test_connect.c
+++ b/tests/functionaltests/test_connect.c
@@ -9,43 +9,40 @@
#include "proftest.h"
void
-connect_jid_requests_roster(void **state)
+connect_jid_requests_roster(void** state)
{
prof_connect();
assert_true(stbbr_received(
- ""
- ));
+ ""));
}
void
-connect_jid_sends_presence_after_receiving_roster(void **state)
+connect_jid_sends_presence_after_receiving_roster(void** state)
{
prof_connect();
assert_true(stbbr_received(
""
- ""
- ""
- ));
+ ""
+ ""));
}
void
-connect_jid_requests_bookmarks(void **state)
+connect_jid_requests_bookmarks(void** state)
{
prof_connect();
assert_true(stbbr_received(
""
- ""
- ""
- ""
- ""
- ));
+ ""
+ ""
+ ""
+ ""));
}
void
-connect_bad_password(void **state)
+connect_bad_password(void** state)
{
prof_input("/connect stabber@localhost server 127.0.0.1 port 5230 tls allow");
prof_input("badpassword");
@@ -54,39 +51,35 @@ connect_bad_password(void **state)
}
void
-connect_shows_presence_updates(void **state)
+connect_shows_presence_updates(void** state)
{
prof_connect();
stbbr_send(
""
- "dnd"
- "busy!"
- ""
- );
+ "dnd"
+ "busy!"
+ "");
assert_true(prof_output_exact("Buddy1 (mobile) is dnd, \"busy!\""));
stbbr_send(
""
- "chat"
- "Talk to me!"
- ""
- );
+ "chat"
+ "Talk to me!"
+ "");
assert_true(prof_output_exact("Buddy1 (laptop) is chat, \"Talk to me!\""));
stbbr_send(
""
- "away"
- "Out of office"
- ""
- );
+ "away"
+ "Out of office"
+ "");
assert_true(prof_output_exact("Buddy2 (work) is away, \"Out of office\""));
stbbr_send(
""
- "xa"
- "Gone :("
- ""
- );
+ "xa"
+ "Gone :("
+ "");
assert_true(prof_output_exact("Buddy1 (mobile) is xa, \"Gone :(\""));
}
diff --git a/tests/functionaltests/test_connect.h b/tests/functionaltests/test_connect.h
index d82d9364..889ea7c0 100644
--- a/tests/functionaltests/test_connect.h
+++ b/tests/functionaltests/test_connect.h
@@ -1,5 +1,5 @@
-void connect_jid_requests_roster(void **state);
-void connect_jid_sends_presence_after_receiving_roster(void **state);
-void connect_jid_requests_bookmarks(void **state);
-void connect_bad_password(void **state);
-void connect_shows_presence_updates(void **state);
+void connect_jid_requests_roster(void** state);
+void connect_jid_sends_presence_after_receiving_roster(void** state);
+void connect_jid_requests_bookmarks(void** state);
+void connect_bad_password(void** state);
+void connect_shows_presence_updates(void** state);
diff --git a/tests/functionaltests/test_disconnect.c b/tests/functionaltests/test_disconnect.c
index 2827805f..b90af3cd 100644
--- a/tests/functionaltests/test_disconnect.c
+++ b/tests/functionaltests/test_disconnect.c
@@ -9,7 +9,7 @@
#include "proftest.h"
void
-disconnect_ends_session(void **state)
+disconnect_ends_session(void** state)
{
prof_connect();
diff --git a/tests/functionaltests/test_disconnect.h b/tests/functionaltests/test_disconnect.h
index 2024269a..b65f5766 100644
--- a/tests/functionaltests/test_disconnect.h
+++ b/tests/functionaltests/test_disconnect.h
@@ -1 +1 @@
-void disconnect_ends_session(void **state);
+void disconnect_ends_session(void** state);
diff --git a/tests/functionaltests/test_message.c b/tests/functionaltests/test_message.c
index 9260813e..84fb22cb 100644
--- a/tests/functionaltests/test_message.c
+++ b/tests/functionaltests/test_message.c
@@ -9,7 +9,7 @@
#include "proftest.h"
void
-message_send(void **state)
+message_send(void** state)
{
prof_connect();
@@ -17,29 +17,27 @@ message_send(void **state)
assert_true(stbbr_received(
""
- "Hi there"
- ""
- ));
+ "Hi there"
+ ""));
assert_true(prof_output_regex("me: .+Hi there"));
}
void
-message_receive_console(void **state)
+message_receive_console(void** state)
{
prof_connect();
stbbr_send(
""
- "How are you?"
- ""
- );
+ "How are you?"
+ "");
assert_true(prof_output_exact("<< chat message: someuser@chatserv.org/laptop (win 2)"));
}
void
-message_receive_chatwin(void **state)
+message_receive_chatwin(void** state)
{
prof_connect();
@@ -48,9 +46,8 @@ message_receive_chatwin(void **state)
stbbr_send(
""
- "How are you?"
- ""
- );
+ "How are you?"
+ "");
assert_true(prof_output_regex("someuser@chatserv.org/laptop: .+How are you?"));
}
diff --git a/tests/functionaltests/test_message.h b/tests/functionaltests/test_message.h
index d3a1987c..c0b4c559 100644
--- a/tests/functionaltests/test_message.h
+++ b/tests/functionaltests/test_message.h
@@ -1,3 +1,3 @@
-void message_send(void **state);
-void message_receive_console(void **state);
-void message_receive_chatwin(void **state);
+void message_send(void** state);
+void message_receive_console(void** state);
+void message_receive_chatwin(void** state);
diff --git a/tests/functionaltests/test_muc.c b/tests/functionaltests/test_muc.c
index 43910936..0d1d1e7b 100644
--- a/tests/functionaltests/test_muc.c
+++ b/tests/functionaltests/test_muc.c
@@ -9,7 +9,7 @@
#include "proftest.h"
void
-sends_room_join(void **state)
+sends_room_join(void** state)
{
prof_connect();
@@ -17,14 +17,13 @@ sends_room_join(void **state)
assert_true(stbbr_last_received(
""
- ""
- ""
- ""
- ));
+ ""
+ ""
+ ""));
}
void
-sends_room_join_with_nick(void **state)
+sends_room_join_with_nick(void** state)
{
prof_connect();
@@ -32,14 +31,13 @@ sends_room_join_with_nick(void **state)
assert_true(stbbr_last_received(
""
- ""
- ""
- ""
- ));
+ ""
+ ""
+ ""));
}
void
-sends_room_join_with_password(void **state)
+sends_room_join_with_password(void** state)
{
prof_connect();
@@ -47,16 +45,15 @@ sends_room_join_with_password(void **state)
assert_true(stbbr_last_received(
""
- ""
- "testpassword"
- ""
- ""
- ""
- ));
+ ""
+ "testpassword"
+ ""
+ ""
+ ""));
}
void
-sends_room_join_with_nick_and_password(void **state)
+sends_room_join_with_nick_and_password(void** state)
{
prof_connect();
@@ -64,28 +61,26 @@ sends_room_join_with_nick_and_password(void **state)
assert_true(stbbr_last_received(
""
- ""
- "testpassword"
- ""
- ""
- ""
- ));
+ ""
+ "testpassword"
+ ""
+ ""
+ ""));
}
void
-shows_role_and_affiliation_on_join(void **state)
+shows_role_and_affiliation_on_join(void** state)
{
prof_connect();
stbbr_for_id("prof_join_4",
- ""
- ""
- ""
- " "
- ""
- ""
- ""
- );
+ ""
+ ""
+ ""
+ " "
+ ""
+ ""
+ "");
prof_input("/join testroom@conference.localhost");
@@ -93,186 +88,173 @@ shows_role_and_affiliation_on_join(void **state)
}
void
-shows_subject_on_join(void **state)
+shows_subject_on_join(void** state)
{
prof_connect();
stbbr_for_id("prof_join_4",
- ""
- ""
- ""
- " "
- ""
- ""
- ""
- );
+ ""
+ ""
+ ""
+ " "
+ ""
+ ""
+ "");
prof_input("/join testroom@conference.localhost");
assert_true(prof_output_exact("-> You have joined the room as stabber, role: participant, affiliation: none"));
stbbr_send(
""
- "Test room subject"
- "anothernick has set the subject to: Test room subject"
- ""
- );
+ "Test room subject"
+ "anothernick has set the subject to: Test room subject"
+ "");
assert_true(prof_output_regex("Room subject: .+Test room subject"));
}
void
-shows_history_message(void **state)
+shows_history_message(void** state)
{
prof_connect();
stbbr_for_id("prof_join_4",
- ""
- ""
- ""
- " "
- ""
- ""
- ""
- );
+ ""
+ ""
+ ""
+ " "
+ ""
+ ""
+ "");
prof_input("/join testroom@conference.localhost");
assert_true(prof_output_exact("-> You have joined the room as stabber, role: participant, affiliation: none"));
stbbr_send(
""
- "an old message"
- ""
- ""
- ""
- );
+ "an old message"
+ ""
+ ""
+ "");
assert_true(prof_output_regex("testoccupant: an old message"));
}
void
-shows_occupant_join(void **state)
+shows_occupant_join(void** state)
{
prof_connect();
stbbr_for_id("prof_join_4",
- ""
- ""
- ""
- " "
- ""
- ""
- ""
- );
+ ""
+ ""
+ ""
+ " "
+ ""
+ ""
+ "");
prof_input("/join testroom@conference.localhost");
assert_true(prof_output_exact("-> You have joined the room as stabber, role: participant, affiliation: none"));
stbbr_send(
""
- ""
- " "
- ""
- ""
- );
+ ""
+ " "
+ ""
+ "");
assert_true(prof_output_exact("-> testoccupant has joined the room, role: participant, affiliation: none"));
}
void
-shows_message(void **state)
+shows_message(void** state)
{
prof_connect();
stbbr_for_id("prof_join_4",
- ""
- ""
- ""
- " "
- ""
- ""
- ""
- );
+ ""
+ ""
+ ""
+ " "
+ ""
+ ""
+ "");
prof_input("/join testroom@conference.localhost");
assert_true(prof_output_exact("-> You have joined the room as stabber, role: participant, affiliation: none"));
stbbr_send(
""
- "a new message"
- ""
- );
+ "a new message"
+ "");
assert_true(prof_output_regex("testoccupant: .+a new message"));
}
void
-shows_me_message_from_occupant(void **state)
+shows_me_message_from_occupant(void** state)
{
prof_connect();
stbbr_for_id("prof_join_4",
- ""
- ""
- ""
- " "
- ""
- ""
- ""
- );
+ ""
+ ""
+ ""
+ " "
+ ""
+ ""
+ "");
prof_input("/join testroom@conference.localhost");
assert_true(prof_output_exact("-> You have joined the room as stabber, role: participant, affiliation: none"));
stbbr_send(
""
- "/me did something"
- ""
- );
+ "/me did something"
+ "");
assert_true(prof_output_exact("*testoccupant did something"));
}
void
-shows_me_message_from_self(void **state)
+shows_me_message_from_self(void** state)
{
prof_connect();
stbbr_for_id("prof_join_4",
- ""
- ""
- ""
- " "
- ""
- ""
- ""
- );
+ ""
+ ""
+ ""
+ " "
+ ""
+ ""
+ "");
prof_input("/join testroom@conference.localhost");
assert_true(prof_output_exact("-> You have joined the room as stabber, role: participant, affiliation: none"));
stbbr_send(
""
- "/me did something"
- ""
- );
+ "/me did something"
+ "");
assert_true(prof_output_exact("*stabber did something"));
}
void
-shows_all_messages_in_console_when_window_not_focussed(void **state)
+shows_all_messages_in_console_when_window_not_focussed(void** state)
{
prof_connect();
stbbr_for_id("prof_join_4",
- ""
- ""
- ""
- " "
- ""
- ""
- ""
- );
+ ""
+ ""
+ ""
+ " "
+ ""
+ ""
+ "");
prof_input("/join testroom@conference.localhost");
assert_true(prof_output_exact("-> You have joined the room as stabber, role: participant, affiliation: none"));
@@ -282,23 +264,21 @@ shows_all_messages_in_console_when_window_not_focussed(void **state)
stbbr_send(
""
- "a new message"
- ""
- );
+ "a new message"
+ "");
assert_true(prof_output_exact("<< room message: testoccupant in testroom@conference.localhost (win 2)"));
stbbr_send(
""
- "some other message"
- ""
- );
+ "some other message"
+ "");
assert_true(prof_output_exact("<< room message: anotheroccupant in testroom@conference.localhost (win 2)"));
}
void
-shows_first_message_in_console_when_window_not_focussed(void **state)
+shows_first_message_in_console_when_window_not_focussed(void** state)
{
prof_connect();
@@ -306,14 +286,13 @@ shows_first_message_in_console_when_window_not_focussed(void **state)
assert_true(prof_output_exact("Console MUC messages set: first"));
stbbr_for_id("prof_join_4",
- ""
- ""
- ""
- " "
- ""
- ""
- ""
- );
+ ""
+ ""
+ ""
+ " "
+ ""
+ ""
+ "");
prof_input("/join testroom@conference.localhost");
assert_true(prof_output_exact("-> You have joined the room as stabber, role: participant, affiliation: none"));
@@ -323,9 +302,8 @@ shows_first_message_in_console_when_window_not_focussed(void **state)
stbbr_send(
""
- "a new message"
- ""
- );
+ "a new message"
+ "");
assert_true(prof_output_exact("<< room message: testroom@conference.localhost (win 2)"));
prof_input("/clear");
@@ -334,9 +312,8 @@ shows_first_message_in_console_when_window_not_focussed(void **state)
stbbr_send(
""
- "some other message"
- ""
- );
+ "some other message"
+ "");
prof_timeout(2);
assert_false(prof_output_exact("<< room message: testroom@conference.localhost (win 2)"));
@@ -344,7 +321,7 @@ shows_first_message_in_console_when_window_not_focussed(void **state)
}
void
-shows_no_message_in_console_when_window_not_focussed(void **state)
+shows_no_message_in_console_when_window_not_focussed(void** state)
{
prof_connect();
@@ -352,14 +329,13 @@ shows_no_message_in_console_when_window_not_focussed(void **state)
assert_true(prof_output_exact("Console MUC messages set: none"));
stbbr_for_id("prof_join_4",
- ""
- ""
- ""
- " "
- ""
- ""
- ""
- );
+ ""
+ ""
+ ""
+ " "
+ ""
+ ""
+ "");
prof_input("/join testroom@conference.localhost");
assert_true(prof_output_exact("-> You have joined the room as stabber, role: participant, affiliation: none"));
@@ -369,9 +345,8 @@ shows_no_message_in_console_when_window_not_focussed(void **state)
stbbr_send(
""
- "a new message"
- ""
- );
+ "a new message"
+ "");
prof_timeout(2);
assert_false(prof_output_exact("testroom@conference.localhost (win 2)"));
diff --git a/tests/functionaltests/test_muc.h b/tests/functionaltests/test_muc.h
index 1636bd05..31df8944 100644
--- a/tests/functionaltests/test_muc.h
+++ b/tests/functionaltests/test_muc.h
@@ -1,14 +1,14 @@
-void sends_room_join(void **state);
-void sends_room_join_with_nick(void **state);
-void sends_room_join_with_password(void **state);
-void sends_room_join_with_nick_and_password(void **state);
-void shows_role_and_affiliation_on_join(void **state);
-void shows_subject_on_join(void **state);
-void shows_history_message(void **state);
-void shows_occupant_join(void **state);
-void shows_message(void **state);
-void shows_me_message_from_occupant(void **state);
-void shows_me_message_from_self(void **state);
-void shows_all_messages_in_console_when_window_not_focussed(void **state);
-void shows_first_message_in_console_when_window_not_focussed(void **state);
-void shows_no_message_in_console_when_window_not_focussed(void **state);
+void sends_room_join(void** state);
+void sends_room_join_with_nick(void** state);
+void sends_room_join_with_password(void** state);
+void sends_room_join_with_nick_and_password(void** state);
+void shows_role_and_affiliation_on_join(void** state);
+void shows_subject_on_join(void** state);
+void shows_history_message(void** state);
+void shows_occupant_join(void** state);
+void shows_message(void** state);
+void shows_me_message_from_occupant(void** state);
+void shows_me_message_from_self(void** state);
+void shows_all_messages_in_console_when_window_not_focussed(void** state);
+void shows_first_message_in_console_when_window_not_focussed(void** state);
+void shows_no_message_in_console_when_window_not_focussed(void** state);
diff --git a/tests/functionaltests/test_ping.c b/tests/functionaltests/test_ping.c
index a5aeba3b..03c14b2b 100644
--- a/tests/functionaltests/test_ping.c
+++ b/tests/functionaltests/test_ping.c
@@ -9,53 +9,47 @@
#include "proftest.h"
void
-ping_server(void **state)
+ping_server(void** state)
{
stbbr_for_id("prof_disco_info_onconnect_2",
- ""
- ""
- ""
- ""
- ""
- ""
- );
+ ""
+ ""
+ ""
+ ""
+ ""
+ "");
stbbr_for_id("prof_ping_4",
- ""
- );
+ "");
stbbr_for_id("prof_ping_5",
- ""
- );
+ "");
prof_connect();
prof_input("/ping");
assert_true(stbbr_received(
""
- ""
- ""
- ));
+ ""
+ ""));
assert_true(prof_output_exact("Ping response from server"));
prof_input("/ping");
assert_true(stbbr_received(
""
- ""
- ""
- ));
+ ""
+ ""));
assert_true(prof_output_exact("Ping response from server"));
}
void
-ping_server_not_supported(void **state)
+ping_server_not_supported(void** state)
{
stbbr_for_id("prof_disco_info_onconnect_2",
- ""
- ""
- ""
- ""
- ""
- );
+ ""
+ ""
+ ""
+ ""
+ "");
prof_connect();
@@ -64,103 +58,95 @@ ping_server_not_supported(void **state)
}
void
-ping_responds_to_server_request(void **state)
+ping_responds_to_server_request(void** state)
{
prof_connect();
stbbr_send(
""
- ""
- ""
- );
+ ""
+ "");
assert_true(stbbr_received(
- ""
- ));
+ ""));
}
-void ping_jid(void **state)
+void
+ping_jid(void** state)
{
stbbr_for_id("prof_caps_4",
- ""
- ""
- ""
- ""
- ""
- ""
- ""
- ""
- );
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ "");
prof_connect();
stbbr_send(
""
- "10"
- "I'm here"
- ""
- ""
- );
+ "10"
+ "I'm here"
+ ""
+ "");
assert_true(prof_output_exact("Buddy1 (mobile) is online, \"I'm here\""));
assert_true(stbbr_received(
""
- ""
- ""
- ));
+ ""
+ ""));
stbbr_for_id("prof_ping_5",
- ""
- );
+ "");
prof_input("/ping buddy1@localhost/mobile");
assert_true(stbbr_received(
""
- ""
- ""
- ));
+ ""
+ ""));
assert_true(prof_output_exact("Ping response from buddy1@localhost/mobile"));
}
-void ping_jid_not_supported(void **state)
+void
+ping_jid_not_supported(void** state)
{
stbbr_for_id("prof_caps_4",
- ""
- ""
- ""
- ""
- ""
- ""
- ""
- );
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ "");
prof_connect();
stbbr_send(
""
- "10"
- "I'm here"
- ""
- ""
- );
+ "10"
+ "I'm here"
+ ""
+ "");
assert_true(prof_output_exact("Buddy1 (mobile) is online, \"I'm here\""));
assert_true(stbbr_received(
""
- ""
- ""
- ));
+ ""
+ ""));
prof_input("/ping buddy1@localhost/mobile");
assert_true(prof_output_exact("buddy1@localhost/mobile does not support ping requests."));
diff --git a/tests/functionaltests/test_ping.h b/tests/functionaltests/test_ping.h
index 1f2eeb91..90598598 100644
--- a/tests/functionaltests/test_ping.h
+++ b/tests/functionaltests/test_ping.h
@@ -1,5 +1,5 @@
-void ping_server(void **state);
-void ping_server_not_supported(void **state);
-void ping_responds_to_server_request(void **state);
-void ping_jid(void **state);
-void ping_jid_not_supported(void **state);
+void ping_server(void** state);
+void ping_server_not_supported(void** state);
+void ping_responds_to_server_request(void** state);
+void ping_jid(void** state);
+void ping_jid_not_supported(void** state);
diff --git a/tests/functionaltests/test_presence.c b/tests/functionaltests/test_presence.c
index 0bd1915d..884e4db6 100644
--- a/tests/functionaltests/test_presence.c
+++ b/tests/functionaltests/test_presence.c
@@ -9,7 +9,7 @@
#include "proftest.h"
void
-presence_online(void **state)
+presence_online(void** state)
{
prof_connect();
@@ -17,15 +17,14 @@ presence_online(void **state)
assert_true(stbbr_received(
""
- ""
- ""
- ));
+ ""
+ ""));
assert_true(prof_output_exact("Status set to online (priority 0)"));
}
void
-presence_online_with_message(void **state)
+presence_online_with_message(void** state)
{
prof_connect();
@@ -33,16 +32,15 @@ presence_online_with_message(void **state)
assert_true(stbbr_received(
""
- "Hi there"
- ""
- ""
- ));
+ "Hi there"
+ ""
+ ""));
assert_true(prof_output_exact("Status set to online (priority 0), \"Hi there\"."));
}
void
-presence_away(void **state)
+presence_away(void** state)
{
prof_connect();
@@ -50,16 +48,15 @@ presence_away(void **state)
assert_true(stbbr_received(
""
- "away"
- ""
- ""
- ));
+ "away"
+ ""
+ ""));
assert_true(prof_output_exact("Status set to away (priority 0)"));
}
void
-presence_away_with_message(void **state)
+presence_away_with_message(void** state)
{
prof_connect();
@@ -67,17 +64,16 @@ presence_away_with_message(void **state)
assert_true(stbbr_received(
""
- "away"
- "I'm not here for a bit"
- ""
- ""
- ));
+ "away"
+ "I'm not here for a bit"
+ ""
+ ""));
assert_true(prof_output_exact("Status set to away (priority 0), \"I'm not here for a bit\"."));
}
void
-presence_xa(void **state)
+presence_xa(void** state)
{
prof_connect();
@@ -85,16 +81,15 @@ presence_xa(void **state)
assert_true(stbbr_received(
""
- "xa"
- ""
- ""
- ));
+ "xa"
+ ""
+ ""));
assert_true(prof_output_exact("Status set to xa (priority 0)"));
}
void
-presence_xa_with_message(void **state)
+presence_xa_with_message(void** state)
{
prof_connect();
@@ -102,17 +97,16 @@ presence_xa_with_message(void **state)
assert_true(stbbr_received(
""
- "xa"
- "Gone to the shops"
- ""
- ""
- ));
+ "xa"
+ "Gone to the shops"
+ ""
+ ""));
assert_true(prof_output_exact("Status set to xa (priority 0), \"Gone to the shops\"."));
}
void
-presence_dnd(void **state)
+presence_dnd(void** state)
{
prof_connect();
@@ -120,16 +114,15 @@ presence_dnd(void **state)
assert_true(stbbr_received(
""
- "dnd"
- ""
- ""
- ));
+ "dnd"
+ ""
+ ""));
assert_true(prof_output_exact("Status set to dnd (priority 0)"));
}
void
-presence_dnd_with_message(void **state)
+presence_dnd_with_message(void** state)
{
prof_connect();
@@ -137,17 +130,16 @@ presence_dnd_with_message(void **state)
assert_true(stbbr_received(
""
- "dnd"
- "Working"
- ""
- ""
- ));
+ "dnd"
+ "Working"
+ ""
+ ""));
assert_true(prof_output_exact("Status set to dnd (priority 0), \"Working\"."));
}
void
-presence_chat(void **state)
+presence_chat(void** state)
{
prof_connect();
@@ -155,16 +147,15 @@ presence_chat(void **state)
assert_true(stbbr_received(
""
- "chat"
- ""
- ""
- ));
+ "chat"
+ ""
+ ""));
assert_true(prof_output_exact("Status set to chat (priority 0)"));
}
void
-presence_chat_with_message(void **state)
+presence_chat_with_message(void** state)
{
prof_connect();
@@ -172,17 +163,16 @@ presence_chat_with_message(void **state)
assert_true(stbbr_received(
""
- "chat"
- "Free to talk"
- ""
- ""
- ));
+ "chat"
+ "Free to talk"
+ ""
+ ""));
assert_true(prof_output_exact("Status set to chat (priority 0), \"Free to talk\"."));
}
void
-presence_set_priority(void **state)
+presence_set_priority(void** state)
{
prof_connect();
@@ -190,94 +180,87 @@ presence_set_priority(void **state)
assert_true(stbbr_received(
""
- "25"
- ""
- ""
- ));
+ "25"
+ ""
+ ""));
assert_true(prof_output_exact("Priority set to 25."));
}
void
-presence_includes_priority(void **state)
+presence_includes_priority(void** state)
{
prof_connect();
prof_input("/priority 25");
assert_true(stbbr_received(
""
- "25"
- ""
- ""
- ));
+ "25"
+ ""
+ ""));
assert_true(prof_output_exact("Priority set to 25."));
prof_input("/chat \"Free to talk\"");
assert_true(stbbr_received(
""
- "25"
- "chat"
- "Free to talk"
- ""
- ""
- ));
+ "25"
+ "chat"
+ "Free to talk"
+ ""
+ ""));
assert_true(prof_output_exact("Status set to chat (priority 25), \"Free to talk\"."));
}
void
-presence_keeps_status(void **state)
+presence_keeps_status(void** state)
{
prof_connect();
prof_input("/chat \"Free to talk\"");
assert_true(stbbr_received(
""
- "chat"
- "Free to talk"
- ""
- ""
- ));
+ "chat"
+ "Free to talk"
+ ""
+ ""));
assert_true(prof_output_exact("Status set to chat (priority 0), \"Free to talk\"."));
prof_input("/priority 25");
assert_true(stbbr_received(
""
- "chat"
- "Free to talk"
- "25"
- ""
- ""
- ));
+ "chat"
+ "Free to talk"
+ "25"
+ ""
+ ""));
assert_true(prof_output_exact("Priority set to 25."));
}
void
-presence_received(void **state)
+presence_received(void** state)
{
prof_connect();
stbbr_send(
""
- "10"
- "I'm here"
- ""
- );
+ "10"
+ "I'm here"
+ "");
assert_true(prof_output_exact("Buddy1 (mobile) is online, \"I'm here\""));
}
// Typical use case for gateways that don't support resources
void
-presence_missing_resource_defaults(void **state)
+presence_missing_resource_defaults(void** state)
{
prof_connect();
stbbr_send(
""
- "15"
- "My status"
- ""
- );
+ "15"
+ "My status"
+ "");
assert_true(prof_output_exact("Buddy1 is online, \"My status\""));
diff --git a/tests/functionaltests/test_presence.h b/tests/functionaltests/test_presence.h
index 107fa794..0efd9ead 100644
--- a/tests/functionaltests/test_presence.h
+++ b/tests/functionaltests/test_presence.h
@@ -1,15 +1,15 @@
-void presence_away(void **state);
-void presence_away_with_message(void **state);
-void presence_online(void **state);
-void presence_online_with_message(void **state);
-void presence_xa(void **state);
-void presence_xa_with_message(void **state);
-void presence_dnd(void **state);
-void presence_dnd_with_message(void **state);
-void presence_chat(void **state);
-void presence_chat_with_message(void **state);
-void presence_set_priority(void **state);
-void presence_includes_priority(void **state);
-void presence_keeps_status(void **state);
-void presence_received(void **state);
-void presence_missing_resource_defaults(void **state);
+void presence_away(void** state);
+void presence_away_with_message(void** state);
+void presence_online(void** state);
+void presence_online_with_message(void** state);
+void presence_xa(void** state);
+void presence_xa_with_message(void** state);
+void presence_dnd(void** state);
+void presence_dnd_with_message(void** state);
+void presence_chat(void** state);
+void presence_chat_with_message(void** state);
+void presence_set_priority(void** state);
+void presence_includes_priority(void** state);
+void presence_keeps_status(void** state);
+void presence_received(void** state);
+void presence_missing_resource_defaults(void** state);
diff --git a/tests/functionaltests/test_receipts.c b/tests/functionaltests/test_receipts.c
index 3debd977..cb8485e8 100644
--- a/tests/functionaltests/test_receipts.c
+++ b/tests/functionaltests/test_receipts.c
@@ -9,7 +9,7 @@
#include "proftest.h"
void
-does_not_send_receipt_request_to_barejid(void **state)
+does_not_send_receipt_request_to_barejid(void** state)
{
prof_input("/receipts request on");
@@ -19,34 +19,31 @@ does_not_send_receipt_request_to_barejid(void **state)
assert_true(stbbr_received(
""
- "Hi there"
- ""
- ));
+ "Hi there"
+ ""));
}
void
-send_receipt_request(void **state)
+send_receipt_request(void** state)
{
prof_input("/receipts request on");
prof_connect();
stbbr_for_id("prof_caps_4",
- ""
- ""
- ""
- ""
- ""
- ""
- );
+ ""
+ ""
+ ""
+ ""
+ ""
+ "");
stbbr_send(
""
- "15"
- "My status"
- ""
- ""
- );
+ "15"
+ "My status"
+ ""
+ "");
prof_output_exact("Buddy1 is online, \"My status\"");
@@ -56,14 +53,13 @@ send_receipt_request(void **state)
assert_true(stbbr_received(
""
- "Hi there, where is my receipt?"
- ""
- ""
- ));
+ "Hi there, where is my receipt?"
+ ""
+ ""));
}
void
-send_receipt_on_request(void **state)
+send_receipt_on_request(void** state)
{
prof_input("/receipts send on");
@@ -71,14 +67,12 @@ send_receipt_on_request(void **state)
stbbr_send(
""
- "Wants a receipt"
- ""
- ""
- );
+ "Wants a receipt"
+ ""
+ "");
assert_true(stbbr_received(
""
- ""
- ""
- ));
+ ""
+ ""));
}
diff --git a/tests/functionaltests/test_receipts.h b/tests/functionaltests/test_receipts.h
index bead28a9..a62cfc63 100644
--- a/tests/functionaltests/test_receipts.h
+++ b/tests/functionaltests/test_receipts.h
@@ -1,3 +1,3 @@
-void does_not_send_receipt_request_to_barejid(void **state);
-void send_receipt_request(void **state);
-void send_receipt_on_request(void **state);
+void does_not_send_receipt_request_to_barejid(void** state);
+void send_receipt_request(void** state);
+void send_receipt_on_request(void** state);
diff --git a/tests/functionaltests/test_rooms.c b/tests/functionaltests/test_rooms.c
index dbe861e1..37348e10 100644
--- a/tests/functionaltests/test_rooms.c
+++ b/tests/functionaltests/test_rooms.c
@@ -9,16 +9,15 @@
#include "proftest.h"
void
-rooms_query(void **state)
+rooms_query(void** state)
{
stbbr_for_id("prof_confreq_4",
- ""
- ""
- " "
- " "
- ""
- ""
- );
+ ""
+ ""
+ " "
+ " "
+ ""
+ "");
prof_connect();
@@ -29,7 +28,6 @@ rooms_query(void **state)
assert_true(stbbr_last_received(
""
- ""
- ""
- ));
+ ""
+ ""));
}
diff --git a/tests/functionaltests/test_rooms.h b/tests/functionaltests/test_rooms.h
index e2dcac5d..eec4cb5f 100644
--- a/tests/functionaltests/test_rooms.h
+++ b/tests/functionaltests/test_rooms.h
@@ -1 +1 @@
-void rooms_query(void **state);
+void rooms_query(void** state);
diff --git a/tests/functionaltests/test_roster.c b/tests/functionaltests/test_roster.c
index e6453fe1..46875b2a 100644
--- a/tests/functionaltests/test_roster.c
+++ b/tests/functionaltests/test_roster.c
@@ -9,121 +9,110 @@
#include "proftest.h"
void
-sends_new_item(void **state)
+sends_new_item(void** state)
{
prof_connect();
stbbr_for_query("jabber:iq:roster",
- ""
- ""
- " "
- ""
- ""
- );
+ ""
+ ""
+ " "
+ ""
+ "");
prof_input("/roster add bob@localhost");
assert_true(stbbr_received(
""
- ""
- " "
- ""
- ""
- ));
+ ""
+ " "
+ ""
+ ""));
assert_true(prof_output_exact("Roster item added: bob@localhost"));
}
void
-sends_new_item_nick(void **state)
+sends_new_item_nick(void** state)
{
prof_connect();
stbbr_for_query("jabber:iq:roster",
- ""
- ""
- " "
- ""
- ""
- );
+ ""
+ ""
+ " "
+ ""
+ "");
prof_input("/roster add bob@localhost Bobby");
assert_true(stbbr_received(
""
- ""
- " "
- ""
- ""
- ));
+ ""
+ " "
+ ""
+ ""));
assert_true(prof_output_exact("Roster item added: bob@localhost (Bobby)"));
}
void
-sends_remove_item(void **state)
+sends_remove_item(void** state)
{
prof_connect_with_roster(
" "
- " "
- );
+ " ");
stbbr_for_query("jabber:iq:roster",
- ""
- ""
- " "
- ""
- ""
- );
+ ""
+ ""
+ " "
+ ""
+ "");
prof_input("/roster remove buddy1@localhost");
assert_true(stbbr_received(
""
- ""
- " "
- ""
- ""
- ));
+ ""
+ " "
+ ""
+ ""));
assert_true(prof_output_exact("Roster item removed: buddy1@localhost"));
}
void
-sends_remove_item_nick(void **state)
+sends_remove_item_nick(void** state)
{
prof_connect_with_roster(
" "
- " "
- );
+ " ");
stbbr_for_query("jabber:iq:roster",
- ""
- ""
- " "
- ""
- ""
- );
+ ""
+ ""
+ " "
+ ""
+ "");
prof_input("/roster remove Bobby");
assert_true(stbbr_received(
""
- ""
- " "
- ""
- ""
- ));
+ ""
+ " "
+ ""
+ ""));
assert_true(prof_output_exact("Roster item removed: buddy1@localhost"));
}
void
-sends_nick_change(void **state)
+sends_nick_change(void** state)
{
prof_connect_with_roster(
- " "
- );
+ " ");
prof_input("/roster nick buddy1@localhost Buddy1");
@@ -131,9 +120,8 @@ sends_nick_change(void **state)
assert_true(stbbr_received(
""
- ""
- " "
- ""
- ""
- ));
+ ""
+ " "
+ ""
+ ""));
}
diff --git a/tests/functionaltests/test_roster.h b/tests/functionaltests/test_roster.h
index 885dfc55..51daea81 100644
--- a/tests/functionaltests/test_roster.h
+++ b/tests/functionaltests/test_roster.h
@@ -1,5 +1,5 @@
-void sends_new_item(void **state);
-void sends_new_item_nick(void **state);
-void sends_remove_item(void **state);
-void sends_remove_item_nick(void **state);
-void sends_nick_change(void **state);
+void sends_new_item(void** state);
+void sends_new_item_nick(void** state);
+void sends_remove_item(void** state);
+void sends_remove_item_nick(void** state);
+void sends_nick_change(void** state);
diff --git a/tests/functionaltests/test_software.c b/tests/functionaltests/test_software.c
index c382d290..be8f3ebd 100644
--- a/tests/functionaltests/test_software.c
+++ b/tests/functionaltests/test_software.c
@@ -9,72 +9,66 @@
#include "proftest.h"
void
-send_software_version_request(void **state)
+send_software_version_request(void** state)
{
prof_connect();
stbbr_send(
""
- "10"
- "I'm here"
- ""
- );
+ "10"
+ "I'm here"
+ "");
assert_true(prof_output_exact("Buddy1 (mobile) is online, \"I'm here\""));
prof_input("/software buddy1@localhost/mobile");
assert_true(stbbr_received(
""
- ""
- ""
- ));
+ ""
+ ""));
}
void
-display_software_version_result(void **state)
+display_software_version_result(void** state)
{
prof_connect();
stbbr_send(
""
- "10"
- "I'm here"
- ""
- );
+ "10"
+ "I'm here"
+ "");
assert_true(prof_output_exact("Buddy1 (mobile) is online, \"I'm here\""));
stbbr_for_query("jabber:iq:version",
- ""
- ""
- "Profanity"
- "0.4.7dev.master.2cb2f83"
- ""
- ""
- );
+ ""
+ ""
+ "Profanity"
+ "0.4.7dev.master.2cb2f83"
+ ""
+ "");
prof_input("/software buddy1@localhost/mobile");
-// assert_true(prof_output_exact("buddy1@localhost/mobile:"));
-// assert_true(prof_output_exact("Name : Profanity"));
+ // assert_true(prof_output_exact("buddy1@localhost/mobile:"));
+ // assert_true(prof_output_exact("Name : Profanity"));
assert_true(prof_output_exact("Version : 0.4.7dev.master.2cb2f83"));
}
void
-shows_message_when_software_version_error(void **state)
+shows_message_when_software_version_error(void** state)
{
prof_connect();
stbbr_send(
""
- "10"
- "I'm here"
- ""
- );
+ "10"
+ "I'm here"
+ "");
assert_true(prof_output_exact("Buddy1 (mobile) is online, \"I'm here\""));
stbbr_for_query("jabber:iq:version",
- ""
- ""
- ""
- ""
- ""
- ""
- );
+ ""
+ ""
+ ""
+ ""
+ ""
+ "");
prof_input("/software buddy1@localhost/laptop");
assert_true(prof_output_exact("Could not get software version: service-unavailable"));
@@ -82,42 +76,39 @@ shows_message_when_software_version_error(void **state)
// Typical use case for gateways that don't support resources
void
-display_software_version_result_when_from_domainpart(void **state)
+display_software_version_result_when_from_domainpart(void** state)
{
prof_connect();
stbbr_send(
""
- "10"
- "I'm here"
- ""
- );
+ "10"
+ "I'm here"
+ "");
assert_true(prof_output_exact("Buddy1 is online, \"I'm here\""));
stbbr_for_query("jabber:iq:version",
- ""
- ""
- "Some Gateway"
- "1.0"
- ""
- ""
- );
+ ""
+ ""
+ "Some Gateway"
+ "1.0"
+ ""
+ "");
prof_input("/software buddy1@localhost/__prof_default");
-// assert_true(prof_output_exact("buddy1@localhost/__prof_default:"));
-// assert_true(prof_output_exact("Name : Some Gateway"));
+ // assert_true(prof_output_exact("buddy1@localhost/__prof_default:"));
+ // assert_true(prof_output_exact("Name : Some Gateway"));
assert_true(prof_output_exact("Version : 1.0"));
}
void
-show_message_in_chat_window_when_no_resource(void **state)
+show_message_in_chat_window_when_no_resource(void** state)
{
prof_connect();
stbbr_send(
""
- "10"
- "I'm here"
- ""
- );
+ "10"
+ "I'm here"
+ "");
assert_true(prof_output_exact("Buddy1 (mobile) is online, \"I'm here\""));
prof_input("/msg Buddy1");
@@ -127,37 +118,34 @@ show_message_in_chat_window_when_no_resource(void **state)
}
void
-display_software_version_result_in_chat(void **state)
+display_software_version_result_in_chat(void** state)
{
prof_connect();
stbbr_send(
""
- "10"
- "I'm here"
- ""
- );
+ "10"
+ "I'm here"
+ "");
assert_true(prof_output_exact("Buddy1 (mobile) is online, \"I'm here\""));
prof_input("/msg Buddy1");
stbbr_send(
""
- "Here's a message"
- ""
- );
+ "Here's a message"
+ "");
assert_true(prof_output_exact("Here's a message"));
stbbr_for_query("jabber:iq:version",
- ""
- ""
- "Profanity"
- "0.4.7dev.master.2cb2f83"
- ""
- ""
- );
+ ""
+ ""
+ "Profanity"
+ "0.4.7dev.master.2cb2f83"
+ ""
+ "");
prof_input("/software");
-// assert_true(prof_output_exact("buddy1@localhost/mobile:"));
-// assert_true(prof_output_exact("Name : Profanity"));
+ // assert_true(prof_output_exact("buddy1@localhost/mobile:"));
+ // assert_true(prof_output_exact("Name : Profanity"));
assert_true(prof_output_exact("Version : 0.4.7dev.master.2cb2f83"));
}
diff --git a/tests/functionaltests/test_software.h b/tests/functionaltests/test_software.h
index 60a644fd..bae351e7 100644
--- a/tests/functionaltests/test_software.h
+++ b/tests/functionaltests/test_software.h
@@ -1,6 +1,6 @@
-void send_software_version_request(void **state);
-void display_software_version_result(void **state);
-void shows_message_when_software_version_error(void **state);
-void display_software_version_result_when_from_domainpart(void **state);
-void show_message_in_chat_window_when_no_resource(void **state);
-void display_software_version_result_in_chat(void **state);
+void send_software_version_request(void** state);
+void display_software_version_result(void** state);
+void shows_message_when_software_version_error(void** state);
+void display_software_version_result_when_from_domainpart(void** state);
+void show_message_in_chat_window_when_no_resource(void** state);
+void display_software_version_result_in_chat(void** state);
diff --git a/tests/unittests/omemo/stub_omemo.c b/tests/unittests/omemo/stub_omemo.c
index a0d6da2f..a19c6b71 100644
--- a/tests/unittests/omemo/stub_omemo.c
+++ b/tests/unittests/omemo/stub_omemo.c
@@ -109,7 +109,7 @@ omemo_encrypt_file(FILE* in, FILE* out, off_t file_size, int* gcry_res)
{
return NULL;
};
-void omemo_free(void* a){};
+void omemo_free(void* a) {};
uint32_t
omemo_device_id()
diff --git a/tests/unittests/test_common.c b/tests/unittests/test_common.c
index 7fa4813a..822ea7e5 100644
--- a/tests/unittests/test_common.c
+++ b/tests/unittests/test_common.c
@@ -328,7 +328,9 @@ strip_arg_quotes__returns__stripped_both(void** state)
free(result);
}
-void valid_tls_policy_option__is__correct_for_various_inputs(void** state) {
+void
+valid_tls_policy_option__is__correct_for_various_inputs(void** state)
+{
// Valid inputs
assert_true(valid_tls_policy_option("force"));
assert_true(valid_tls_policy_option("allow"));
@@ -348,11 +350,13 @@ void valid_tls_policy_option__is__correct_for_various_inputs(void** state) {
expect_any_cons_show(); // For "TLS policy must be one of: 'force', 'allow', 'trust', 'disable', 'legacy', or 'direct'."
assert_false(valid_tls_policy_option(""));
- // NULL
+ // NULL
assert_true(valid_tls_policy_option(NULL));
}
-void get_expanded_path__returns__expanded(void** state) {
+void
+get_expanded_path__returns__expanded(void** state)
+{
gchar* expanded_path;
// `file://` prefix
@@ -378,7 +382,9 @@ void get_expanded_path__returns__expanded(void** state) {
g_free(expanded_path);
}
-void strtoi_range__returns__true_for_valid_input(void** state) {
+void
+strtoi_range__returns__true_for_valid_input(void** state)
+{
int value;
gchar* err_msg = NULL;
gboolean result;
@@ -404,7 +410,9 @@ void strtoi_range__returns__true_for_valid_input(void** state) {
assert_null(err_msg);
}
-void strtoi_range__returns__false_for_out_of_range(void** state) {
+void
+strtoi_range__returns__false_for_out_of_range(void** state)
+{
int value;
gchar* err_msg = NULL;
gboolean result;
@@ -431,7 +439,9 @@ void strtoi_range__returns__false_for_out_of_range(void** state) {
err_msg = NULL;
}
-void strtoi_range__returns__false_for_invalid_input(void** state) {
+void
+strtoi_range__returns__false_for_invalid_input(void** state)
+{
int value;
gchar* err_msg = NULL;
gboolean result;
@@ -451,7 +461,9 @@ void strtoi_range__returns__false_for_invalid_input(void** state) {
err_msg = NULL;
}
-void strtoi_range__returns__false_for_null_empty_input(void** state) {
+void
+strtoi_range__returns__false_for_null_empty_input(void** state)
+{
int value;
gchar* err_msg = NULL;
gboolean result;
@@ -471,7 +483,9 @@ void strtoi_range__returns__false_for_null_empty_input(void** state) {
err_msg = NULL;
}
-void strtoi_range__returns__correct_values_when_err_msg_null(void** state) {
+void
+strtoi_range__returns__correct_values_when_err_msg_null(void** state)
+{
int value;
gboolean result;
@@ -485,7 +499,9 @@ void strtoi_range__returns__correct_values_when_err_msg_null(void** state) {
assert_false(result);
}
-void string_to_verbosity__returns__correct_values(void** state) {
+void
+string_to_verbosity__returns__correct_values(void** state)
+{
int verbosity;
gchar* err_msg = NULL;
gboolean result;
@@ -495,52 +511,59 @@ void string_to_verbosity__returns__correct_values(void** state) {
assert_true(result);
assert_int_equal(0, verbosity);
assert_null(err_msg);
- g_free(err_msg); err_msg = NULL; // Clear for next test
+ g_free(err_msg);
+ err_msg = NULL; // Clear for next test
// Valid input string (1)
result = string_to_verbosity("1", &verbosity, &err_msg);
assert_true(result);
assert_int_equal(1, verbosity);
assert_null(err_msg);
- g_free(err_msg); err_msg = NULL;
+ g_free(err_msg);
+ err_msg = NULL;
// Valid input string (3)
result = string_to_verbosity("3", &verbosity, &err_msg);
assert_true(result);
assert_int_equal(3, verbosity);
assert_null(err_msg);
- g_free(err_msg); err_msg = NULL;
+ g_free(err_msg);
+ err_msg = NULL;
// Invalid input string (not a number)
result = string_to_verbosity("profanity", &verbosity, &err_msg);
assert_false(result);
assert_string_equal("Could not convert \"profanity\" to a number.", err_msg);
g_free(err_msg);
- err_msg = NULL;
+ err_msg = NULL;
// Valid input string, out of range (too low)
result = string_to_verbosity("-1", &verbosity, &err_msg);
assert_false(result);
assert_string_equal("Value -1 out of range. Must be in 0..3.", err_msg);
- g_free(err_msg); err_msg = NULL;
+ g_free(err_msg);
+ err_msg = NULL;
// Valid input string, out of range (too high)
result = string_to_verbosity("4", &verbosity, &err_msg);
assert_false(result);
assert_string_equal("Value 4 out of range. Must be in 0..3.", err_msg);
- g_free(err_msg); err_msg = NULL;
+ g_free(err_msg);
+ err_msg = NULL;
// NULL input string
result = string_to_verbosity(NULL, &verbosity, &err_msg);
assert_false(result);
assert_string_equal("'str' input pointer can not be NULL", err_msg);
- g_free(err_msg); err_msg = NULL;
+ g_free(err_msg);
+ err_msg = NULL;
// Empty input string
result = string_to_verbosity("", &verbosity, &err_msg);
assert_false(result);
assert_string_equal("Could not convert \"\" to a number.", err_msg);
- g_free(err_msg); err_msg = NULL;
+ g_free(err_msg);
+ err_msg = NULL;
// err_msg is NULL
result = string_to_verbosity("abc", &verbosity, NULL);
@@ -874,66 +897,83 @@ get_mentions__tests__various(void** state)
expected = g_slist_append(expected, GINT_TO_POINTER(6));
actual = get_mentions(FALSE, TRUE, "hello boothj5", "boothj5");
assert_true(_lists_equal(actual, expected));
- g_slist_free(actual); actual = NULL;
- g_slist_free(expected); expected = NULL;
+ g_slist_free(actual);
+ actual = NULL;
+ g_slist_free(expected);
+ expected = NULL;
// Case insensitive match
expected = g_slist_append(expected, GINT_TO_POINTER(6));
actual = get_mentions(FALSE, FALSE, "hello BOOTHJ5", "boothj5");
assert_true(_lists_equal(actual, expected));
- g_slist_free(actual); actual = NULL;
- g_slist_free(expected); expected = NULL;
+ g_slist_free(actual);
+ actual = NULL;
+ g_slist_free(expected);
+ expected = NULL;
// Whole word match
expected = g_slist_append(expected, GINT_TO_POINTER(0));
actual = get_mentions(TRUE, TRUE, "boothj5 hello", "boothj5");
assert_true(_lists_equal(actual, expected));
- g_slist_free(actual); actual = NULL;
- g_slist_free(expected); expected = NULL;
+ g_slist_free(actual);
+ actual = NULL;
+ g_slist_free(expected);
+ expected = NULL;
// Whole word no match (partial)
actual = get_mentions(TRUE, TRUE, "boothj5hello", "boothj5");
assert_true(_lists_equal(actual, expected)); // expected is NULL
- g_slist_free(actual); actual = NULL;
+ g_slist_free(actual);
+ actual = NULL;
// Multiple matches
expected = g_slist_append(expected, GINT_TO_POINTER(0));
expected = g_slist_append(expected, GINT_TO_POINTER(14));
actual = get_mentions(FALSE, TRUE, "boothj5 hello boothj5", "boothj5");
assert_true(_lists_equal(actual, expected));
- g_slist_free(actual); actual = NULL;
- g_slist_free(expected); expected = NULL;
+ g_slist_free(actual);
+ actual = NULL;
+ g_slist_free(expected);
+ expected = NULL;
// Nick with punctuation (whole word)
expected = g_slist_append(expected, GINT_TO_POINTER(0));
actual = get_mentions(TRUE, TRUE, "boothj5: hi", "boothj5");
assert_true(_lists_equal(actual, expected));
- g_slist_free(actual); actual = NULL;
- g_slist_free(expected); expected = NULL;
+ g_slist_free(actual);
+ actual = NULL;
+ g_slist_free(expected);
+ expected = NULL;
// Nick surrounded by punctuation
expected = g_slist_append(expected, GINT_TO_POINTER(1));
actual = get_mentions(TRUE, TRUE, "(boothj5)", "boothj5");
assert_true(_lists_equal(actual, expected));
- g_slist_free(actual); actual = NULL;
- g_slist_free(expected); expected = NULL;
+ g_slist_free(actual);
+ actual = NULL;
+ g_slist_free(expected);
+ expected = NULL;
// Empty message
actual = get_mentions(FALSE, TRUE, "", "boothj5");
assert_true(_lists_equal(actual, expected)); // expected is NULL
- g_slist_free(actual); actual = NULL;
+ g_slist_free(actual);
+ actual = NULL;
// Empty nick
actual = get_mentions(FALSE, TRUE, "hello", "");
assert_true(_lists_equal(actual, expected)); // expected is NULL
- g_slist_free(actual); actual = NULL;
+ g_slist_free(actual);
+ actual = NULL;
// UTF-8 characters
expected = g_slist_append(expected, GINT_TO_POINTER(0));
actual = get_mentions(TRUE, TRUE, "我能 hello", "我能");
assert_true(_lists_equal(actual, expected));
- g_slist_free(actual); actual = NULL;
- g_slist_free(expected); expected = NULL;
+ g_slist_free(actual);
+ actual = NULL;
+ g_slist_free(expected);
+ expected = NULL;
}
void
@@ -962,9 +1002,9 @@ release_is_new__tests__various(void** state)
assert_true(release_is_new("1.2.3", "2.0.0"));
// Malformed version strings
- assert_false(release_is_new("0.16.0", "0.16")); // Missing patch in found
- assert_false(release_is_new("0.16", "0.16.0")); // Missing patch in curr
- assert_false(release_is_new("0.16.0", "0.16.0.1")); // Extra part
+ assert_false(release_is_new("0.16.0", "0.16")); // Missing patch in found
+ assert_false(release_is_new("0.16", "0.16.0")); // Missing patch in curr
+ assert_false(release_is_new("0.16.0", "0.16.0.1")); // Extra part
assert_false(release_is_new("0.16.0", "abc.def.ghi"));
assert_false(release_is_new("0.16.0", ""));
@@ -1175,7 +1215,9 @@ prof_occurrences__tests__whole(void** state)
expected = NULL;
}
-void string_matches_one_of__tests__edge_cases(void** state) {
+void
+string_matches_one_of__tests__edge_cases(void** state)
+{
// is is NULL, is_can_be_null is TRUE -> should return TRUE
assert_true(string_matches_one_of(NULL, NULL, TRUE, "option1", "option2", NULL));
diff --git a/tests/unittests/tools/stub_aesgcm_download.c b/tests/unittests/tools/stub_aesgcm_download.c
index 07f411ca..62c41de8 100644
--- a/tests/unittests/tools/stub_aesgcm_download.c
+++ b/tests/unittests/tools/stub_aesgcm_download.c
@@ -22,7 +22,7 @@ aesgcm_file_get(void* userdata)
return NULL;
};
-void aesgcm_download_cancel_processes(ProfWin* window){};
-void aesgcm_download_add_download(AESGCMDownload* download){};
+void aesgcm_download_cancel_processes(ProfWin* window) {};
+void aesgcm_download_add_download(AESGCMDownload* download) {};
#endif
diff --git a/tests/unittests/tools/stub_http_download.c b/tests/unittests/tools/stub_http_download.c
index aff47200..8acecdff 100644
--- a/tests/unittests/tools/stub_http_download.c
+++ b/tests/unittests/tools/stub_http_download.c
@@ -27,7 +27,7 @@ http_file_get(void* userdata)
return NULL;
}
-void http_download_cancel_processes(){};
-void http_download_add_download(){};
+void http_download_cancel_processes() {};
+void http_download_add_download() {};
#endif
diff --git a/tests/unittests/tools/stub_http_upload.c b/tests/unittests/tools/stub_http_upload.c
index 49320f85..d1d0e59c 100644
--- a/tests/unittests/tools/stub_http_upload.c
+++ b/tests/unittests/tools/stub_http_upload.c
@@ -38,7 +38,7 @@ file_size(int filedes)
return 0;
}
-void http_upload_cancel_processes(){};
-void http_upload_add_upload(){};
+void http_upload_cancel_processes() {};
+void http_upload_add_upload() {};
#endif
diff --git a/tests/unittests/ui/stub_ui.c b/tests/unittests/ui/stub_ui.c
index aed9830c..178ed9d8 100644
--- a/tests/unittests/ui/stub_ui.c
+++ b/tests/unittests/ui/stub_ui.c
@@ -483,10 +483,10 @@ mucwin_unset_message_char(ProfMucWin* mucwin)
{
}
-void win_update_entry_message(ProfWin* window, const char* const id, const char* const message){};
-void win_mark_received(ProfWin* window, const char* const id){};
-void win_print_http_transfer(ProfWin* window, const char* const message, char* id){};
-void win_print_loading_history(ProfWin* window){};
+void win_update_entry_message(ProfWin* window, const char* const id, const char* const message) {};
+void win_mark_received(ProfWin* window, const char* const id) {};
+void win_print_http_transfer(ProfWin* window, const char* const message, char* id) {};
+void win_print_loading_history(ProfWin* window) {};
void
ui_show_roster(void)
diff --git a/tests/unittests/xmpp/stub_avatar.c b/tests/unittests/xmpp/stub_avatar.c
index 8390077e..022664ac 100644
--- a/tests/unittests/xmpp/stub_avatar.c
+++ b/tests/unittests/xmpp/stub_avatar.c
@@ -2,7 +2,7 @@
#include
#include
-void avatar_pep_subscribe(void){};
+void avatar_pep_subscribe(void) {};
gboolean
avatar_get_by_nick(const char* nick, gboolean open)
diff --git a/tests/unittests/xmpp/stub_xmpp.c b/tests/unittests/xmpp/stub_xmpp.c
index fd47bce2..76a072e9 100644
--- a/tests/unittests/xmpp/stub_xmpp.c
+++ b/tests/unittests/xmpp/stub_xmpp.c
@@ -309,8 +309,8 @@ presence_sub_request_exists(const char* const bare_jid)
}
// iq functions
-void iq_disable_carbons(){};
-void iq_enable_carbons(){};
+void iq_disable_carbons() {};
+void iq_enable_carbons() {};
void
iq_send_software_version(const char* const fulljid)
{