mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Moved common tests to cmocka
This commit is contained in:
parent
107fdd355e
commit
7f7973f9a7
@ -80,7 +80,9 @@ test_sources = \
|
|||||||
src/config/accounts.c src/config/accounts.h \
|
src/config/accounts.c src/config/accounts.h \
|
||||||
src/config/preferences.c src/config/preferences.h \
|
src/config/preferences.c src/config/preferences.h \
|
||||||
src/config/theme.c src/config/theme.h \
|
src/config/theme.c src/config/theme.h \
|
||||||
tests/test_command.c
|
tests/test_common.c \
|
||||||
|
tests/test_command.c \
|
||||||
|
tests/testsuite.c
|
||||||
|
|
||||||
main_source = src/main.c
|
main_source = src/main.c
|
||||||
|
|
||||||
@ -101,6 +103,6 @@ profanity_SOURCES = $(with_git_sources) $(main_source)
|
|||||||
TESTS = tests/testsuite
|
TESTS = tests/testsuite
|
||||||
check_PROGRAMS = tests/testsuite
|
check_PROGRAMS = tests/testsuite
|
||||||
tests_testsuite_SOURCES = $(tests_with_git_sources)
|
tests_testsuite_SOURCES = $(tests_with_git_sources)
|
||||||
tests_testsuite_LDADD = -lheadunit -lstdc++ -lcmocka
|
tests_testsuite_LDADD = -lcmocka
|
||||||
|
|
||||||
man_MANS = docs/profanity.1
|
man_MANS = docs/profanity.1
|
||||||
|
@ -78,8 +78,8 @@ AC_CHECK_LIB([glib-2.0], [main], [],
|
|||||||
[AC_MSG_ERROR([glib-2.0 is required for profanity])])
|
[AC_MSG_ERROR([glib-2.0 is required for profanity])])
|
||||||
AC_CHECK_LIB([curl], [main], [],
|
AC_CHECK_LIB([curl], [main], [],
|
||||||
[AC_MSG_ERROR([libcurl is required for profanity])])
|
[AC_MSG_ERROR([libcurl is required for profanity])])
|
||||||
AC_CHECK_LIB([headunit], [main], [],
|
AC_CHECK_LIB([cmocka], [main], [],
|
||||||
[AC_MSG_NOTICE([headunit not found, will not be able to run tests])])
|
[AC_MSG_NOTICE([cmocka not found, will not be able to run tests])])
|
||||||
|
|
||||||
# Checks for header files.
|
# Checks for header files.
|
||||||
AC_CHECK_HEADERS([stdlib.h string.h])
|
AC_CHECK_HEADERS([stdlib.h string.h])
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <head-unit.h>
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <setjmp.h>
|
||||||
|
#include <cmocka.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
void replace_one_substr(void)
|
void replace_one_substr(void **state)
|
||||||
{
|
{
|
||||||
char *string = "it is a string";
|
char *string = "it is a string";
|
||||||
char *sub = "is";
|
char *sub = "is";
|
||||||
@ -11,10 +13,10 @@ void replace_one_substr(void)
|
|||||||
|
|
||||||
char *result = str_replace(string, sub, new);
|
char *result = str_replace(string, sub, new);
|
||||||
|
|
||||||
assert_string_equals("it was a string", result);
|
assert_string_equal("it was a string", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void replace_one_substr_beginning(void)
|
void replace_one_substr_beginning(void **state)
|
||||||
{
|
{
|
||||||
char *string = "it is a string";
|
char *string = "it is a string";
|
||||||
char *sub = "it";
|
char *sub = "it";
|
||||||
@ -22,10 +24,10 @@ void replace_one_substr_beginning(void)
|
|||||||
|
|
||||||
char *result = str_replace(string, sub, new);
|
char *result = str_replace(string, sub, new);
|
||||||
|
|
||||||
assert_string_equals("that is a string", result);
|
assert_string_equal("that is a string", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void replace_one_substr_end(void)
|
void replace_one_substr_end(void **state)
|
||||||
{
|
{
|
||||||
char *string = "it is a string";
|
char *string = "it is a string";
|
||||||
char *sub = "string";
|
char *sub = "string";
|
||||||
@ -33,10 +35,10 @@ void replace_one_substr_end(void)
|
|||||||
|
|
||||||
char *result = str_replace(string, sub, new);
|
char *result = str_replace(string, sub, new);
|
||||||
|
|
||||||
assert_string_equals("it is a thing", result);
|
assert_string_equal("it is a thing", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void replace_two_substr(void)
|
void replace_two_substr(void **state)
|
||||||
{
|
{
|
||||||
char *string = "it is a is string";
|
char *string = "it is a is string";
|
||||||
char *sub = "is";
|
char *sub = "is";
|
||||||
@ -44,10 +46,10 @@ void replace_two_substr(void)
|
|||||||
|
|
||||||
char *result = str_replace(string, sub, new);
|
char *result = str_replace(string, sub, new);
|
||||||
|
|
||||||
assert_string_equals("it was a was string", result);
|
assert_string_equal("it was a was string", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void replace_char(void)
|
void replace_char(void **state)
|
||||||
{
|
{
|
||||||
char *string = "some & a thing & something else";
|
char *string = "some & a thing & something else";
|
||||||
char *sub = "&";
|
char *sub = "&";
|
||||||
@ -55,10 +57,10 @@ void replace_char(void)
|
|||||||
|
|
||||||
char *result = str_replace(string, sub, new);
|
char *result = str_replace(string, sub, new);
|
||||||
|
|
||||||
assert_string_equals("some & a thing & something else", result);
|
assert_string_equal("some & a thing & something else", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void replace_when_none(void)
|
void replace_when_none(void **state)
|
||||||
{
|
{
|
||||||
char *string = "its another string";
|
char *string = "its another string";
|
||||||
char *sub = "haha";
|
char *sub = "haha";
|
||||||
@ -66,10 +68,10 @@ void replace_when_none(void)
|
|||||||
|
|
||||||
char *result = str_replace(string, sub, new);
|
char *result = str_replace(string, sub, new);
|
||||||
|
|
||||||
assert_string_equals("its another string", result);
|
assert_string_equal("its another string", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void replace_when_match(void)
|
void replace_when_match(void **state)
|
||||||
{
|
{
|
||||||
char *string = "hello";
|
char *string = "hello";
|
||||||
char *sub = "hello";
|
char *sub = "hello";
|
||||||
@ -77,10 +79,10 @@ void replace_when_match(void)
|
|||||||
|
|
||||||
char *result = str_replace(string, sub, new);
|
char *result = str_replace(string, sub, new);
|
||||||
|
|
||||||
assert_string_equals("goodbye", result);
|
assert_string_equal("goodbye", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void replace_when_string_empty(void)
|
void replace_when_string_empty(void **state)
|
||||||
{
|
{
|
||||||
char *string = "";
|
char *string = "";
|
||||||
char *sub = "hello";
|
char *sub = "hello";
|
||||||
@ -88,10 +90,10 @@ void replace_when_string_empty(void)
|
|||||||
|
|
||||||
char *result = str_replace(string, sub, new);
|
char *result = str_replace(string, sub, new);
|
||||||
|
|
||||||
assert_string_equals("", result);
|
assert_string_equal("", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void replace_when_string_null(void)
|
void replace_when_string_null(void **state)
|
||||||
{
|
{
|
||||||
char *string = NULL;
|
char *string = NULL;
|
||||||
char *sub = "hello";
|
char *sub = "hello";
|
||||||
@ -99,10 +101,10 @@ void replace_when_string_null(void)
|
|||||||
|
|
||||||
char *result = str_replace(string, sub, new);
|
char *result = str_replace(string, sub, new);
|
||||||
|
|
||||||
assert_is_null(result);
|
assert_null(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void replace_when_sub_empty(void)
|
void replace_when_sub_empty(void **state)
|
||||||
{
|
{
|
||||||
char *string = "hello";
|
char *string = "hello";
|
||||||
char *sub = "";
|
char *sub = "";
|
||||||
@ -110,10 +112,10 @@ void replace_when_sub_empty(void)
|
|||||||
|
|
||||||
char *result = str_replace(string, sub, new);
|
char *result = str_replace(string, sub, new);
|
||||||
|
|
||||||
assert_string_equals("hello", result);
|
assert_string_equal("hello", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void replace_when_sub_null(void)
|
void replace_when_sub_null(void **state)
|
||||||
{
|
{
|
||||||
char *string = "hello";
|
char *string = "hello";
|
||||||
char *sub = NULL;
|
char *sub = NULL;
|
||||||
@ -121,10 +123,10 @@ void replace_when_sub_null(void)
|
|||||||
|
|
||||||
char *result = str_replace(string, sub, new);
|
char *result = str_replace(string, sub, new);
|
||||||
|
|
||||||
assert_string_equals("hello", result);
|
assert_string_equal("hello", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void replace_when_new_empty(void)
|
void replace_when_new_empty(void **state)
|
||||||
{
|
{
|
||||||
char *string = "hello";
|
char *string = "hello";
|
||||||
char *sub = "hello";
|
char *sub = "hello";
|
||||||
@ -132,10 +134,10 @@ void replace_when_new_empty(void)
|
|||||||
|
|
||||||
char *result = str_replace(string, sub, new);
|
char *result = str_replace(string, sub, new);
|
||||||
|
|
||||||
assert_string_equals("", result);
|
assert_string_equal("", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void replace_when_new_null(void)
|
void replace_when_new_null(void **state)
|
||||||
{
|
{
|
||||||
char *string = "hello";
|
char *string = "hello";
|
||||||
char *sub = "hello";
|
char *sub = "hello";
|
||||||
@ -143,10 +145,10 @@ void replace_when_new_null(void)
|
|||||||
|
|
||||||
char *result = str_replace(string, sub, new);
|
char *result = str_replace(string, sub, new);
|
||||||
|
|
||||||
assert_string_equals("hello", result);
|
assert_string_equal("hello", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void compare_win_nums_less(void)
|
void compare_win_nums_less(void **state)
|
||||||
{
|
{
|
||||||
gconstpointer a = GINT_TO_POINTER(2);
|
gconstpointer a = GINT_TO_POINTER(2);
|
||||||
gconstpointer b = GINT_TO_POINTER(3);
|
gconstpointer b = GINT_TO_POINTER(3);
|
||||||
@ -156,7 +158,7 @@ void compare_win_nums_less(void)
|
|||||||
assert_true(result < 0);
|
assert_true(result < 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void compare_win_nums_equal(void)
|
void compare_win_nums_equal(void **state)
|
||||||
{
|
{
|
||||||
gconstpointer a = GINT_TO_POINTER(5);
|
gconstpointer a = GINT_TO_POINTER(5);
|
||||||
gconstpointer b = GINT_TO_POINTER(5);
|
gconstpointer b = GINT_TO_POINTER(5);
|
||||||
@ -166,7 +168,7 @@ void compare_win_nums_equal(void)
|
|||||||
assert_true(result == 0);
|
assert_true(result == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void compare_win_nums_greater(void)
|
void compare_win_nums_greater(void **state)
|
||||||
{
|
{
|
||||||
gconstpointer a = GINT_TO_POINTER(7);
|
gconstpointer a = GINT_TO_POINTER(7);
|
||||||
gconstpointer b = GINT_TO_POINTER(6);
|
gconstpointer b = GINT_TO_POINTER(6);
|
||||||
@ -176,7 +178,7 @@ void compare_win_nums_greater(void)
|
|||||||
assert_true(result > 0);
|
assert_true(result > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void compare_0s_equal(void)
|
void compare_0s_equal(void **state)
|
||||||
{
|
{
|
||||||
gconstpointer a = GINT_TO_POINTER(0);
|
gconstpointer a = GINT_TO_POINTER(0);
|
||||||
gconstpointer b = GINT_TO_POINTER(0);
|
gconstpointer b = GINT_TO_POINTER(0);
|
||||||
@ -186,7 +188,7 @@ void compare_0s_equal(void)
|
|||||||
assert_true(result == 0);
|
assert_true(result == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void compare_0_greater_than_1(void)
|
void compare_0_greater_than_1(void **state)
|
||||||
{
|
{
|
||||||
gconstpointer a = GINT_TO_POINTER(0);
|
gconstpointer a = GINT_TO_POINTER(0);
|
||||||
gconstpointer b = GINT_TO_POINTER(1);
|
gconstpointer b = GINT_TO_POINTER(1);
|
||||||
@ -196,7 +198,7 @@ void compare_0_greater_than_1(void)
|
|||||||
assert_true(result > 0);
|
assert_true(result > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void compare_1_less_than_0(void)
|
void compare_1_less_than_0(void **state)
|
||||||
{
|
{
|
||||||
gconstpointer a = GINT_TO_POINTER(1);
|
gconstpointer a = GINT_TO_POINTER(1);
|
||||||
gconstpointer b = GINT_TO_POINTER(0);
|
gconstpointer b = GINT_TO_POINTER(0);
|
||||||
@ -206,7 +208,7 @@ void compare_1_less_than_0(void)
|
|||||||
assert_true(result < 0);
|
assert_true(result < 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void compare_0_less_than_11(void)
|
void compare_0_less_than_11(void **state)
|
||||||
{
|
{
|
||||||
gconstpointer a = GINT_TO_POINTER(0);
|
gconstpointer a = GINT_TO_POINTER(0);
|
||||||
gconstpointer b = GINT_TO_POINTER(11);
|
gconstpointer b = GINT_TO_POINTER(11);
|
||||||
@ -216,7 +218,7 @@ void compare_0_less_than_11(void)
|
|||||||
assert_true(result < 0);
|
assert_true(result < 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void compare_11_greater_than_0(void)
|
void compare_11_greater_than_0(void **state)
|
||||||
{
|
{
|
||||||
gconstpointer a = GINT_TO_POINTER(11);
|
gconstpointer a = GINT_TO_POINTER(11);
|
||||||
gconstpointer b = GINT_TO_POINTER(0);
|
gconstpointer b = GINT_TO_POINTER(0);
|
||||||
@ -226,7 +228,7 @@ void compare_11_greater_than_0(void)
|
|||||||
assert_true(result > 0);
|
assert_true(result > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void compare_0_greater_than_9(void)
|
void compare_0_greater_than_9(void **state)
|
||||||
{
|
{
|
||||||
gconstpointer a = GINT_TO_POINTER(0);
|
gconstpointer a = GINT_TO_POINTER(0);
|
||||||
gconstpointer b = GINT_TO_POINTER(9);
|
gconstpointer b = GINT_TO_POINTER(9);
|
||||||
@ -236,7 +238,7 @@ void compare_0_greater_than_9(void)
|
|||||||
assert_true(result > 0);
|
assert_true(result > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void compare_9_less_than_0(void)
|
void compare_9_less_than_0(void **state)
|
||||||
{
|
{
|
||||||
gconstpointer a = GINT_TO_POINTER(9);
|
gconstpointer a = GINT_TO_POINTER(9);
|
||||||
gconstpointer b = GINT_TO_POINTER(0);
|
gconstpointer b = GINT_TO_POINTER(0);
|
||||||
@ -246,17 +248,17 @@ void compare_9_less_than_0(void)
|
|||||||
assert_true(result < 0);
|
assert_true(result < 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void next_available_when_only_console(void)
|
void next_available_when_only_console(void **state)
|
||||||
{
|
{
|
||||||
GList *used = NULL;
|
GList *used = NULL;
|
||||||
used = g_list_append(used, GINT_TO_POINTER(1));
|
used = g_list_append(used, GINT_TO_POINTER(1));
|
||||||
|
|
||||||
int result = get_next_available_win_num(used);
|
int result = get_next_available_win_num(used);
|
||||||
|
|
||||||
assert_int_equals(2, result);
|
assert_int_equal(2, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void next_available_3_at_end(void)
|
void next_available_3_at_end(void **state)
|
||||||
{
|
{
|
||||||
GList *used = NULL;
|
GList *used = NULL;
|
||||||
used = g_list_append(used, GINT_TO_POINTER(1));
|
used = g_list_append(used, GINT_TO_POINTER(1));
|
||||||
@ -264,10 +266,10 @@ void next_available_3_at_end(void)
|
|||||||
|
|
||||||
int result = get_next_available_win_num(used);
|
int result = get_next_available_win_num(used);
|
||||||
|
|
||||||
assert_int_equals(3, result);
|
assert_int_equal(3, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void next_available_9_at_end(void)
|
void next_available_9_at_end(void **state)
|
||||||
{
|
{
|
||||||
GList *used = NULL;
|
GList *used = NULL;
|
||||||
used = g_list_append(used, GINT_TO_POINTER(1));
|
used = g_list_append(used, GINT_TO_POINTER(1));
|
||||||
@ -281,10 +283,10 @@ void next_available_9_at_end(void)
|
|||||||
|
|
||||||
int result = get_next_available_win_num(used);
|
int result = get_next_available_win_num(used);
|
||||||
|
|
||||||
assert_int_equals(9, result);
|
assert_int_equal(9, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void next_available_0_at_end(void)
|
void next_available_0_at_end(void **state)
|
||||||
{
|
{
|
||||||
GList *used = NULL;
|
GList *used = NULL;
|
||||||
used = g_list_append(used, GINT_TO_POINTER(1));
|
used = g_list_append(used, GINT_TO_POINTER(1));
|
||||||
@ -299,10 +301,10 @@ void next_available_0_at_end(void)
|
|||||||
|
|
||||||
int result = get_next_available_win_num(used);
|
int result = get_next_available_win_num(used);
|
||||||
|
|
||||||
assert_int_equals(0, result);
|
assert_int_equal(0, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void next_available_2_in_first_gap(void)
|
void next_available_2_in_first_gap(void **state)
|
||||||
{
|
{
|
||||||
GList *used = NULL;
|
GList *used = NULL;
|
||||||
used = g_list_append(used, GINT_TO_POINTER(1));
|
used = g_list_append(used, GINT_TO_POINTER(1));
|
||||||
@ -314,10 +316,10 @@ void next_available_2_in_first_gap(void)
|
|||||||
|
|
||||||
int result = get_next_available_win_num(used);
|
int result = get_next_available_win_num(used);
|
||||||
|
|
||||||
assert_int_equals(2, result);
|
assert_int_equal(2, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void next_available_9_in_first_gap(void)
|
void next_available_9_in_first_gap(void **state)
|
||||||
{
|
{
|
||||||
GList *used = NULL;
|
GList *used = NULL;
|
||||||
used = g_list_append(used, GINT_TO_POINTER(1));
|
used = g_list_append(used, GINT_TO_POINTER(1));
|
||||||
@ -336,10 +338,10 @@ void next_available_9_in_first_gap(void)
|
|||||||
|
|
||||||
int result = get_next_available_win_num(used);
|
int result = get_next_available_win_num(used);
|
||||||
|
|
||||||
assert_int_equals(9, result);
|
assert_int_equal(9, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void next_available_0_in_first_gap(void)
|
void next_available_0_in_first_gap(void **state)
|
||||||
{
|
{
|
||||||
GList *used = NULL;
|
GList *used = NULL;
|
||||||
used = g_list_append(used, GINT_TO_POINTER(1));
|
used = g_list_append(used, GINT_TO_POINTER(1));
|
||||||
@ -358,10 +360,10 @@ void next_available_0_in_first_gap(void)
|
|||||||
|
|
||||||
int result = get_next_available_win_num(used);
|
int result = get_next_available_win_num(used);
|
||||||
|
|
||||||
assert_int_equals(0, result);
|
assert_int_equal(0, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void next_available_11_in_first_gap(void)
|
void next_available_11_in_first_gap(void **state)
|
||||||
{
|
{
|
||||||
GList *used = NULL;
|
GList *used = NULL;
|
||||||
used = g_list_append(used, GINT_TO_POINTER(1));
|
used = g_list_append(used, GINT_TO_POINTER(1));
|
||||||
@ -380,10 +382,10 @@ void next_available_11_in_first_gap(void)
|
|||||||
|
|
||||||
int result = get_next_available_win_num(used);
|
int result = get_next_available_win_num(used);
|
||||||
|
|
||||||
assert_int_equals(11, result);
|
assert_int_equal(11, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void next_available_24_first_big_gap(void)
|
void next_available_24_first_big_gap(void **state)
|
||||||
{
|
{
|
||||||
GList *used = NULL;
|
GList *used = NULL;
|
||||||
used = g_list_append(used, GINT_TO_POINTER(1));
|
used = g_list_append(used, GINT_TO_POINTER(1));
|
||||||
@ -420,42 +422,5 @@ void next_available_24_first_big_gap(void)
|
|||||||
|
|
||||||
int result = get_next_available_win_num(used);
|
int result = get_next_available_win_num(used);
|
||||||
|
|
||||||
assert_int_equals(24, result);
|
assert_int_equal(24, result);
|
||||||
}
|
|
||||||
|
|
||||||
void register_common_tests(void)
|
|
||||||
{
|
|
||||||
TEST_MODULE("common tests");
|
|
||||||
TEST(replace_one_substr);
|
|
||||||
TEST(replace_one_substr_beginning);
|
|
||||||
TEST(replace_one_substr_end);
|
|
||||||
TEST(replace_two_substr);
|
|
||||||
TEST(replace_char);
|
|
||||||
TEST(replace_when_none);
|
|
||||||
TEST(replace_when_match);
|
|
||||||
TEST(replace_when_string_empty);
|
|
||||||
TEST(replace_when_string_null);
|
|
||||||
TEST(replace_when_sub_empty);
|
|
||||||
TEST(replace_when_sub_null);
|
|
||||||
TEST(replace_when_new_empty);
|
|
||||||
TEST(replace_when_new_null);
|
|
||||||
TEST(compare_win_nums_less);
|
|
||||||
TEST(compare_win_nums_equal);
|
|
||||||
TEST(compare_win_nums_greater);
|
|
||||||
TEST(compare_0s_equal);
|
|
||||||
TEST(compare_0_greater_than_1);
|
|
||||||
TEST(compare_1_less_than_0);
|
|
||||||
TEST(compare_0_less_than_11);
|
|
||||||
TEST(compare_11_greater_than_0);
|
|
||||||
TEST(compare_0_greater_than_9);
|
|
||||||
TEST(compare_9_less_than_0);
|
|
||||||
TEST(next_available_when_only_console);
|
|
||||||
TEST(next_available_3_at_end);
|
|
||||||
TEST(next_available_9_at_end);
|
|
||||||
TEST(next_available_0_at_end);
|
|
||||||
TEST(next_available_2_in_first_gap);
|
|
||||||
TEST(next_available_9_in_first_gap);
|
|
||||||
TEST(next_available_0_in_first_gap);
|
|
||||||
TEST(next_available_11_in_first_gap);
|
|
||||||
TEST(next_available_24_first_big_gap);
|
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,47 @@
|
|||||||
#include <head-unit.h>
|
#include <stdarg.h>
|
||||||
#include "testsuite.h"
|
#include <stddef.h>
|
||||||
|
#include <setjmp.h>
|
||||||
|
#include <cmocka.h>
|
||||||
|
|
||||||
int main(void)
|
#include "test_common.h"
|
||||||
{
|
#include "test_command.h"
|
||||||
register_history_tests();
|
|
||||||
register_roster_list_tests();
|
int main(int argc, char* argv[]) {
|
||||||
register_common_tests();
|
const UnitTest tests[] = {
|
||||||
register_autocomplete_tests();
|
unit_test(cmd_rooms_shows_message_when_not_connected),
|
||||||
register_parser_tests();
|
|
||||||
register_jid_tests();
|
unit_test(replace_one_substr),
|
||||||
run_suite();
|
unit_test(replace_one_substr_beginning),
|
||||||
return 0;
|
unit_test(replace_one_substr_end),
|
||||||
|
unit_test(replace_two_substr),
|
||||||
|
unit_test(replace_char),
|
||||||
|
unit_test(replace_when_none),
|
||||||
|
unit_test(replace_when_match),
|
||||||
|
unit_test(replace_when_string_empty),
|
||||||
|
unit_test(replace_when_string_null),
|
||||||
|
unit_test(replace_when_sub_empty),
|
||||||
|
unit_test(replace_when_sub_null),
|
||||||
|
unit_test(replace_when_new_empty),
|
||||||
|
unit_test(replace_when_new_null),
|
||||||
|
unit_test(compare_win_nums_less),
|
||||||
|
unit_test(compare_win_nums_equal),
|
||||||
|
unit_test(compare_win_nums_greater),
|
||||||
|
unit_test(compare_0s_equal),
|
||||||
|
unit_test(compare_0_greater_than_1),
|
||||||
|
unit_test(compare_1_less_than_0),
|
||||||
|
unit_test(compare_0_less_than_11),
|
||||||
|
unit_test(compare_11_greater_than_0),
|
||||||
|
unit_test(compare_0_greater_than_9),
|
||||||
|
unit_test(compare_9_less_than_0),
|
||||||
|
unit_test(next_available_when_only_console),
|
||||||
|
unit_test(next_available_3_at_end),
|
||||||
|
unit_test(next_available_9_at_end),
|
||||||
|
unit_test(next_available_0_at_end),
|
||||||
|
unit_test(next_available_2_in_first_gap),
|
||||||
|
unit_test(next_available_9_in_first_gap),
|
||||||
|
unit_test(next_available_0_in_first_gap),
|
||||||
|
unit_test(next_available_11_in_first_gap),
|
||||||
|
unit_test(next_available_24_first_big_gap)
|
||||||
|
};
|
||||||
|
return run_tests(tests);
|
||||||
}
|
}
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
#ifndef TESTSUITE_H
|
|
||||||
#define TESTSUITE_H
|
|
||||||
|
|
||||||
void register_history_tests(void);
|
|
||||||
void register_roster_list_tests(void);
|
|
||||||
void register_common_tests(void);
|
|
||||||
void register_autocomplete_tests(void);
|
|
||||||
void register_parser_tests(void);
|
|
||||||
void register_jid_tests(void);
|
|
||||||
|
|
||||||
#endif
|
|
Loading…
Reference in New Issue
Block a user