about summary refs log tree commit diff stats
path: root/tests/unittests
diff options
context:
space:
mode:
authorWilliam Wennerström <william@wstrm.dev>2020-07-20 13:01:05 +0200
committerWilliam Wennerström <william@wstrm.dev>2020-11-16 21:58:09 +0100
commit4711fc62a3d691d35400bc7316f9026c64227d51 (patch)
treec448799a2b86e184d5060cf4915376ce82fdfdb3 /tests/unittests
parenta0cf0844abeeffe83a13e438eff3c309bc9887e9 (diff)
downloadprofani-tty-4711fc62a3d691d35400bc7316f9026c64227d51.tar.gz
Run make format on rebase
Diffstat (limited to 'tests/unittests')
-rw-r--r--tests/unittests/omemo/stub_omemo.c41
-rw-r--r--tests/unittests/test_http_download.c103
-rw-r--r--tests/unittests/test_http_download.h2
-rw-r--r--tests/unittests/tools/stub_http_download.c22
-rw-r--r--tests/unittests/ui/stub_ui.c105
5 files changed, 111 insertions, 162 deletions
diff --git a/tests/unittests/omemo/stub_omemo.c b/tests/unittests/omemo/stub_omemo.c
index 7cca34d5..f6cc4491 100644
--- a/tests/unittests/omemo/stub_omemo.c
+++ b/tests/unittests/omemo/stub_omemo.c
@@ -79,15 +79,38 @@ omemo_own_fingerprint(gboolean formatted)
     return NULL;
 }
 
-void omemo_start_muc_sessions(const char *const roomjid) {}
-void omemo_start_session(const char *const barejid) {}
-void omemo_trust(const char *const jid, const char *const fingerprint_formatted) {}
-void omemo_untrust(const char *const jid, const char *const fingerprint_formatted) {}
-void omemo_devicelist_publish(GList *device_list) {}
-void omemo_publish_crypto_materials(void) {}
-void omemo_start_sessions(void) {}
+void
+omemo_start_muc_sessions(const char* const roomjid)
+{
+}
+void
+omemo_start_session(const char* const barejid)
+{
+}
+void
+omemo_trust(const char* const jid, const char* const fingerprint_formatted)
+{
+}
+void
+omemo_untrust(const char* const jid, const char* const fingerprint_formatted)
+{
+}
+void
+omemo_devicelist_publish(GList* device_list)
+{
+}
+void
+omemo_publish_crypto_materials(void)
+{
+}
+void
+omemo_start_sessions(void)
+{
+}
 
-char *omemo_encrypt_file(FILE *in, FILE *out, off_t file_size, int *gcry_res) {
+char*
+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){};
diff --git a/tests/unittests/test_http_download.c b/tests/unittests/test_http_download.c
index c0516a66..96d45d03 100644
--- a/tests/unittests/test_http_download.c
+++ b/tests/unittests/test_http_download.c
@@ -10,62 +10,65 @@
 
 #include "tools/http_download.h"
 
-typedef struct {
-    char *url;
-    char *basename;
+typedef struct
+{
+    char* url;
+    char* basename;
 } url_test_t;
 
-void http_basename_from_url_td(void **state) {
+void
+http_basename_from_url_td(void** state)
+{
     int num_tests = 11;
     url_test_t tests[] = {
-      (url_test_t){
-        .url = "https://host.test/image.jpeg",
-        .basename = "image.jpeg",
-      },
-      (url_test_t){
-        .url = "https://host.test/image.jpeg#somefragment",
-        .basename = "image.jpeg",
-      },
-      (url_test_t){
-        .url = "https://host.test/image.jpeg?query=param",
-        .basename = "image.jpeg",
-      },
-      (url_test_t){
-        .url = "https://host.test/image.jpeg?query=param&another=one",
-        .basename = "image.jpeg",
-      },
-      (url_test_t){
-        .url = "https://host.test/images/",
-        .basename = "images",
-      },
-      (url_test_t){
-        .url = "https://host.test/images/../../file",
-        .basename = "file",
-      },
-      (url_test_t){
-        .url = "https://host.test/images/../../file/..",
-        .basename = "index.html",
-      },
-      (url_test_t){
-        .url = "https://host.test/images/..//",
-        .basename = "index.html",
-      },
-      (url_test_t){
-        .url = "https://host.test/",
-        .basename = "index.html",
-      },
-      (url_test_t){
-        .url = "https://host.test",
-        .basename = "index.html",
-      },
-      (url_test_t){
-        .url = "aesgcm://host.test",
-        .basename = "index.html",
-      },
+        (url_test_t){
+            .url = "https://host.test/image.jpeg",
+            .basename = "image.jpeg",
+        },
+        (url_test_t){
+            .url = "https://host.test/image.jpeg#somefragment",
+            .basename = "image.jpeg",
+        },
+        (url_test_t){
+            .url = "https://host.test/image.jpeg?query=param",
+            .basename = "image.jpeg",
+        },
+        (url_test_t){
+            .url = "https://host.test/image.jpeg?query=param&another=one",
+            .basename = "image.jpeg",
+        },
+        (url_test_t){
+            .url = "https://host.test/images/",
+            .basename = "images",
+        },
+        (url_test_t){
+            .url = "https://host.test/images/../../file",
+            .basename = "file",
+        },
+        (url_test_t){
+            .url = "https://host.test/images/../../file/..",
+            .basename = "index.html",
+        },
+        (url_test_t){
+            .url = "https://host.test/images/..//",
+            .basename = "index.html",
+        },
+        (url_test_t){
+            .url = "https://host.test/",
+            .basename = "index.html",
+        },
+        (url_test_t){
+            .url = "https://host.test",
+            .basename = "index.html",
+        },
+        (url_test_t){
+            .url = "aesgcm://host.test",
+            .basename = "index.html",
+        },
     };
 
-    char *basename;
-    for(int i = 0; i < num_tests; i++) {
+    char* basename;
+    for (int i = 0; i < num_tests; i++) {
         basename = http_basename_from_url(tests[i].url);
         assert_string_equal(basename, tests[i].basename);
     }
diff --git a/tests/unittests/test_http_download.h b/tests/unittests/test_http_download.h
index ce8913eb..a1c62a7f 100644
--- a/tests/unittests/test_http_download.h
+++ b/tests/unittests/test_http_download.h
@@ -1 +1 @@
-void http_basename_from_url_td(void **state);
+void http_basename_from_url_td(void** state);
diff --git a/tests/unittests/tools/stub_http_download.c b/tests/unittests/tools/stub_http_download.c
index a07146b4..202c9cbf 100644
--- a/tests/unittests/tools/stub_http_download.c
+++ b/tests/unittests/tools/stub_http_download.c
@@ -6,23 +6,23 @@
 
 typedef struct prof_win_t ProfWin;
 
-typedef struct http_download_t {
-    char *url;
-    char *filename;
-    char *directory;
-    FILE *filehandle;
+typedef struct http_download_t
+{
+    char* url;
+    char* filename;
+    char* directory;
+    FILE* filehandle;
     curl_off_t bytes_received;
-    ProfWin *window;
+    ProfWin* window;
     pthread_t worker;
     int cancel;
 } HTTPDownload;
 
+void* http_file_get(void* userdata);
 
-void* http_file_get(void *userdata);
+void http_download_cancel_processes(ProfWin* window);
+void http_download_add_download(HTTPDownload* download);
 
-void http_download_cancel_processes(ProfWin *window);
-void http_download_add_download(HTTPDownload *download);
-
-char *http_filename_from_url(const char *url);
+char* http_filename_from_url(const char* url);
 
 #endif
diff --git a/tests/unittests/ui/stub_ui.c b/tests/unittests/ui/stub_ui.c
index f284d04b..06f0d988 100644
--- a/tests/unittests/ui/stub_ui.c
+++ b/tests/unittests/ui/stub_ui.c
@@ -236,97 +236,16 @@ ui_contact_online(char* barejid, Resource* resource, GDateTime* last_activity)
     check_expected(last_activity);
 }
 
-void ui_contact_typing(const char * const barejid, const char * const resource) {}
-void chatwin_incoming_msg(ProfChatWin *chatwin, ProfMessage *message, gboolean win_created) {}
-void chatwin_receipt_received(ProfChatWin *chatwin, const char * const id) {}
-
-void privwin_incoming_msg(ProfPrivateWin *privatewin, ProfMessage *message) {}
-
-void ui_disconnected(void) {}
-void chatwin_recipient_gone(ProfChatWin *chatwin) {}
-
-void chatwin_outgoing_msg(ProfChatWin *chatwin, const char *const message, char *id, prof_enc_t enc_mode, gboolean request_receipt, const char *const replace_id) {}
-void chatwin_outgoing_carbon(ProfChatWin *chatwin, ProfMessage *message) {}
-void privwin_outgoing_msg(ProfPrivateWin *privwin, const char * const message) {}
-
-void privwin_occupant_offline(ProfPrivateWin *privwin) {}
-void privwin_occupant_kicked(ProfPrivateWin *privwin, const char *const actor, const char *const reason) {}
-void privwin_occupant_banned(ProfPrivateWin *privwin, const char *const actor, const char *const reason) {}
-void privwin_occupant_online(ProfPrivateWin *privwin) {}
-void privwin_message_occupant_offline(ProfPrivateWin *privwin) {}
-
-void privwin_message_left_room(ProfPrivateWin *privwin) {}
-
-void ui_room_join(const char * const roomjid, gboolean focus) {}
-void ui_switch_to_room(const char * const roomjid) {}
-
-void mucwin_role_change(ProfMucWin *mucwin, const char * const role, const char * const actor,
-    const char * const reason) {}
-void mucwin_affiliation_change(ProfMucWin *mucwin, const char * const affiliation, const char * const actor,
-    const char * const reason) {}
-void mucwin_role_and_affiliation_change(ProfMucWin *mucwin, const char * const role,
-    const char * const affiliation, const char * const actor, const char * const reason) {}
-void mucwin_occupant_role_change(ProfMucWin *mucwin, const char * const nick, const char * const role,
-    const char * const actor, const char * const reason) {}
-void mucwin_occupant_affiliation_change(ProfMucWin *mucwin, const char * const nick, const char * const affiliation,
-    const char * const actor, const char * const reason) {}
-void mucwin_occupant_role_and_affiliation_change(ProfMucWin *mucwin, const char * const nick, const char * const role,
-    const char * const affiliation, const char * const actor, const char * const reason) {}
-void mucwin_roster(ProfMucWin *mucwin, GList *occupants, const char * const presence) {}
-void mucwin_history(ProfMucWin *mucwin, const ProfMessage *const message) {}
-void mucwin_incoming_msg(ProfMucWin *mucwin, const ProfMessage *const message, GSList *mentions, GList *triggers, gboolean filter_reflection) {}
-void mucwin_outgoing_msg(ProfMucWin *mucwin, const char *const message, const char *const id, prof_enc_t enc_mode, const char *const replace_id) {}
-void mucwin_subject(ProfMucWin *mucwin, const char * const nick, const char * const subject) {}
-void mucwin_requires_config(ProfMucWin *mucwin) {}
-void ui_room_destroy(const char * const roomjid) {}
-void mucwin_info(ProfMucWin *mucwin) {}
-void mucwin_show_role_list(ProfMucWin *mucwin, muc_role_t role) {}
-void mucwin_show_affiliation_list(ProfMucWin *mucwin, muc_affiliation_t affiliation) {}
-void mucwin_room_info_error(ProfMucWin *mucwin, const char * const error) {}
-void mucwin_room_disco_info(ProfMucWin *mucwin, GSList *identities, GSList *features) {}
-void ui_room_destroyed(const char * const roomjid, const char * const reason, const char * const new_jid,
-    const char * const password) {}
-void ui_room_kicked(const char * const roomjid, const char * const actor, const char * const reason) {}
-void mucwin_occupant_kicked(ProfMucWin *mucwin, const char * const nick, const char * const actor,
-    const char * const reason) {}
-void ui_room_banned(const char * const roomjid, const char * const actor, const char * const reason) {}
-void mucwin_occupant_banned(ProfMucWin *mucwin, const char * const nick, const char * const actor,
-    const char * const reason) {}
-void ui_leave_room(const char * const roomjid) {}
-void mucwin_broadcast(ProfMucWin *mucwin, const char * const message) {}
-void mucwin_occupant_offline(ProfMucWin *mucwin, const char * const nick) {}
-void mucwin_occupant_online(ProfMucWin *mucwin, const char * const nick, const char * const roles,
-    const char * const affiliation, const char * const show, const char * const status) {}
-void mucwin_occupant_nick_change(ProfMucWin *mucwin, const char * const old_nick, const char * const nick) {}
-void mucwin_nick_change(ProfMucWin *mucwin, const char * const nick) {}
-void mucwin_occupant_presence(ProfMucWin *mucwin, const char * const nick, const char * const show,
-    const char * const status) {}
-void mucwin_update_occupants(ProfMucWin *mucwin) {}
-void mucwin_show_occupants(ProfMucWin *mucwin) {}
-void mucwin_hide_occupants(ProfMucWin *mucwin) {}
-void mucwin_set_enctext(ProfMucWin *mucwin, const char *const enctext) {}
-void mucwin_unset_enctext(ProfMucWin *mucwin) {}
-void mucwin_set_message_char(ProfMucWin *mucwin, const char *const ch) {}
-void 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 *url) {};
-
-void ui_show_roster(void) {}
-void ui_hide_roster(void) {}
-void ui_roster_add(const char * const barejid, const char * const name) {}
-void ui_roster_remove(const char * const barejid) {}
-void ui_contact_already_in_group(const char * const contact, const char * const group) {}
-void ui_contact_not_in_group(const char * const contact, const char * const group) {}
-void ui_group_added(const char * const contact, const char * const group) {}
-void ui_group_removed(const char * const contact, const char * const group) {}
-void chatwin_contact_online(ProfChatWin *chatwin, Resource *resource, GDateTime *last_activity) {}
-void chatwin_contact_offline(ProfChatWin *chatwin, char *resource, char *status) {}
-
-void ui_contact_offline(char *barejid, char *resource, char *status) {}
-
-void ui_handle_recipient_error(const char * const recipient, const char * const err_msg)
+void
+ui_contact_typing(const char* const barejid, const char* const resource)
+{
+}
+void
+chatwin_incoming_msg(ProfChatWin* chatwin, ProfMessage* message, gboolean win_created)
+{
+}
+void
+chatwin_receipt_received(ProfChatWin* chatwin, const char* const id)
 {
 }
 
@@ -552,6 +471,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* url){};
+
 void
 ui_show_roster(void)
 {