about summary refs log tree commit diff stats
path: root/tests/unittests/helpers.c
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2020-07-07 13:53:30 +0200
committerMichael Vetter <jubalh@iodoru.org>2020-07-07 13:53:30 +0200
commita4cadf78faabc157e5db00e42302d495bba432c0 (patch)
tree6ff212e24fe750b04b37ca66c418fe366c5e5fd4 /tests/unittests/helpers.c
parent28fde3cd0129202d586cb4c24877a3e3f55ca582 (diff)
downloadprofani-tty-a4cadf78faabc157e5db00e42302d495bba432c0.tar.gz
Revert "Apply coding style"
This reverts commit 9b55f2dec0ea27a9ce4856e303425e12f866cea2.

Sorting the includes creates some problems.
Diffstat (limited to 'tests/unittests/helpers.c')
-rw-r--r--tests/unittests/helpers.c56
1 files changed, 24 insertions, 32 deletions
diff --git a/tests/unittests/helpers.c b/tests/unittests/helpers.c
index 1f0ce171..e85045e6 100644
--- a/tests/unittests/helpers.c
+++ b/tests/unittests/helpers.c
@@ -1,19 +1,18 @@
-#include <cmocka.h>
-#include <glib.h>
 #include <setjmp.h>
 #include <stdarg.h>
 #include <stddef.h>
-#include <stdio.h>
 #include <stdlib.h>
+#include <cmocka.h>
+#include <glib.h>
+#include <stdio.h>
 #include <unistd.h>
 
 #include "common.h"
-#include "config/preferences.h"
 #include "helpers.h"
+#include "config/preferences.h"
 #include "xmpp/chat_session.h"
 
-void
-create_config_dir(void** state)
+void create_config_dir(void **state)
 {
     setenv("XDG_CONFIG_HOME", "./tests/files/xdg_config_home", 1);
     if (!mkdir_recursive("./tests/files/xdg_config_home/profanity")) {
@@ -21,15 +20,13 @@ create_config_dir(void** state)
     }
 }
 
-void
-remove_config_dir(void** state)
+void remove_config_dir(void **state)
 {
     rmdir("./tests/files/xdg_config_home/profanity");
     rmdir("./tests/files/xdg_config_home");
 }
 
-void
-create_data_dir(void** state)
+void create_data_dir(void **state)
 {
     setenv("XDG_DATA_HOME", "./tests/files/xdg_data_home", 1);
     if (!mkdir_recursive("./tests/files/xdg_data_home/profanity")) {
@@ -37,26 +34,23 @@ create_data_dir(void** state)
     }
 }
 
-void
-remove_data_dir(void** state)
+void remove_data_dir(void **state)
 {
     rmdir("./tests/files/xdg_data_home/profanity");
     rmdir("./tests/files/xdg_data_home");
 }
 
-void
-load_preferences(void** state)
+void load_preferences(void **state)
 {
     create_config_dir(state);
-    FILE* f = fopen("./tests/files/xdg_config_home/profanity/profrc", "ab+");
+    FILE *f = fopen("./tests/files/xdg_config_home/profanity/profrc", "ab+");
     if (f) {
         prefs_load(NULL);
     }
     fclose(f);
 }
 
-void
-close_preferences(void** state)
+void close_preferences(void **state)
 {
     prefs_close();
     remove("./tests/files/xdg_config_home/profanity/profrc");
@@ -64,29 +58,27 @@ close_preferences(void** state)
     rmdir("./tests/files");
 }
 
-void
-init_chat_sessions(void** state)
+void init_chat_sessions(void **state)
 {
     load_preferences(NULL);
     chat_sessions_init();
 }
 
-void
-close_chat_sessions(void** state)
+void close_chat_sessions(void **state)
 {
     chat_sessions_clear();
     close_preferences(NULL);
 }
 
 int
-utf8_pos_to_col(char* str, int utf8_pos)
+utf8_pos_to_col(char *str, int utf8_pos)
 {
     int col = 0;
 
     int i = 0;
-    for (i = 0; i < utf8_pos; i++) {
+    for (i = 0; i<utf8_pos; i++) {
         col++;
-        gchar* ch = g_utf8_offset_to_pointer(str, i);
+        gchar *ch = g_utf8_offset_to_pointer(str, i);
         gunichar uni = g_utf8_get_char(ch);
         if (g_unichar_iswide(uni)) {
             col++;
@@ -105,22 +97,22 @@ glist_set_cmp(GCompareFunc func)
 }
 
 int
-glist_contents_equal(const void* actual, const void* expected)
+glist_contents_equal(const void *actual, const void *expected)
 {
-    GList* ac = (GList*)actual;
-    GList* ex = (GList*)expected;
+    GList *ac = (GList *)actual;
+    GList *ex = (GList *)expected;
 
-    GList* p = ex;
+    GList *p = ex;
     printf("\nExpected\n");
-    while (ex) {
+    while(ex) {
         printf("\n\n%s\n", (char*)p->data);
         ex = g_list_next(ex);
     }
     printf("\n\n");
     p = ac;
     printf("\nActual\n");
-    while (ac) {
-        printf("\n\n%s\n", (char*)p->data);
+    while(ac) {
+        printf("\n\n%s\n", (char *)p->data);
         ac = g_list_next(ac);
     }
     printf("\n\n");
@@ -129,7 +121,7 @@ glist_contents_equal(const void* actual, const void* expected)
         return 0;
     }
 
-    GList* ex_curr = ex;
+    GList *ex_curr = ex;
     while (ex_curr != NULL) {
         if (g_list_find_custom(ac, ex_curr->data, cmp_func) == NULL) {
             return 0;