mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
Fixed tests
This commit is contained in:
parent
a84e4adee7
commit
ab591b41b2
@ -31,14 +31,14 @@ static void empty_list_when_none_added(void)
|
||||
|
||||
static void contains_one_element(void)
|
||||
{
|
||||
contact_list_add("James", NULL, NULL, FALSE);
|
||||
contact_list_add("James", NULL, NULL, NULL, FALSE);
|
||||
GSList *list = get_contact_list();
|
||||
assert_int_equals(1, g_slist_length(list));
|
||||
}
|
||||
|
||||
static void first_element_correct(void)
|
||||
{
|
||||
contact_list_add("James", NULL, NULL, FALSE);
|
||||
contact_list_add("James", NULL, NULL, NULL, FALSE);
|
||||
GSList *list = get_contact_list();
|
||||
PContact james = list->data;
|
||||
|
||||
@ -47,8 +47,8 @@ static void first_element_correct(void)
|
||||
|
||||
static void contains_two_elements(void)
|
||||
{
|
||||
contact_list_add("James", NULL, NULL, FALSE);
|
||||
contact_list_add("Dave", NULL, NULL, FALSE);
|
||||
contact_list_add("James", NULL, NULL, NULL, FALSE);
|
||||
contact_list_add("Dave", NULL, NULL, NULL, FALSE);
|
||||
GSList *list = get_contact_list();
|
||||
|
||||
assert_int_equals(2, g_slist_length(list));
|
||||
@ -56,8 +56,8 @@ static void contains_two_elements(void)
|
||||
|
||||
static void first_and_second_elements_correct(void)
|
||||
{
|
||||
contact_list_add("James", NULL, NULL, FALSE);
|
||||
contact_list_add("Dave", NULL, NULL, FALSE);
|
||||
contact_list_add("James", NULL, NULL, NULL, FALSE);
|
||||
contact_list_add("Dave", NULL, NULL, NULL, FALSE);
|
||||
GSList *list = get_contact_list();
|
||||
|
||||
PContact first = list->data;
|
||||
@ -69,9 +69,9 @@ static void first_and_second_elements_correct(void)
|
||||
|
||||
static void contains_three_elements(void)
|
||||
{
|
||||
contact_list_add("James", NULL, NULL, FALSE);
|
||||
contact_list_add("Bob", NULL, NULL, FALSE);
|
||||
contact_list_add("Dave", NULL, NULL, FALSE);
|
||||
contact_list_add("James", NULL, NULL, NULL, FALSE);
|
||||
contact_list_add("Bob", NULL, NULL, NULL, FALSE);
|
||||
contact_list_add("Dave", NULL, NULL, NULL, FALSE);
|
||||
GSList *list = get_contact_list();
|
||||
|
||||
assert_int_equals(3, g_slist_length(list));
|
||||
@ -79,9 +79,9 @@ static void contains_three_elements(void)
|
||||
|
||||
static void first_three_elements_correct(void)
|
||||
{
|
||||
contact_list_add("Bob", NULL, NULL, FALSE);
|
||||
contact_list_add("Dave", NULL, NULL, FALSE);
|
||||
contact_list_add("James", NULL, NULL, FALSE);
|
||||
contact_list_add("Bob", NULL, NULL, NULL, FALSE);
|
||||
contact_list_add("Dave", NULL, NULL, NULL, FALSE);
|
||||
contact_list_add("James", NULL, NULL, NULL, FALSE);
|
||||
GSList *list = get_contact_list();
|
||||
PContact bob = list->data;
|
||||
PContact dave = (g_slist_next(list))->data;
|
||||
@ -94,10 +94,10 @@ static void first_three_elements_correct(void)
|
||||
|
||||
static void add_twice_at_beginning_adds_once(void)
|
||||
{
|
||||
contact_list_add("James", NULL, NULL, FALSE);
|
||||
contact_list_add("James", NULL, NULL, FALSE);
|
||||
contact_list_add("Dave", NULL, NULL, FALSE);
|
||||
contact_list_add("Bob", NULL, NULL, FALSE);
|
||||
contact_list_add("James", NULL, NULL, NULL, FALSE);
|
||||
contact_list_add("James", NULL, NULL, NULL, FALSE);
|
||||
contact_list_add("Dave", NULL, NULL, NULL, FALSE);
|
||||
contact_list_add("Bob", NULL, NULL, NULL, FALSE);
|
||||
GSList *list = get_contact_list();
|
||||
PContact first = list->data;
|
||||
PContact second = (g_slist_next(list))->data;
|
||||
@ -111,10 +111,10 @@ static void add_twice_at_beginning_adds_once(void)
|
||||
|
||||
static void add_twice_in_middle_adds_once(void)
|
||||
{
|
||||
contact_list_add("James", NULL, NULL, FALSE);
|
||||
contact_list_add("Dave", NULL, NULL, FALSE);
|
||||
contact_list_add("James", NULL, NULL, FALSE);
|
||||
contact_list_add("Bob", NULL, NULL, FALSE);
|
||||
contact_list_add("James", NULL, NULL, NULL, FALSE);
|
||||
contact_list_add("Dave", NULL, NULL, NULL, FALSE);
|
||||
contact_list_add("James", NULL, NULL, NULL, FALSE);
|
||||
contact_list_add("Bob", NULL, NULL, NULL, FALSE);
|
||||
GSList *list = get_contact_list();
|
||||
PContact first = list->data;
|
||||
PContact second = (g_slist_next(list))->data;
|
||||
@ -128,10 +128,10 @@ static void add_twice_in_middle_adds_once(void)
|
||||
|
||||
static void add_twice_at_end_adds_once(void)
|
||||
{
|
||||
contact_list_add("James", NULL, NULL, FALSE);
|
||||
contact_list_add("Dave", NULL, NULL, FALSE);
|
||||
contact_list_add("Bob", NULL, NULL, FALSE);
|
||||
contact_list_add("James", NULL, NULL, FALSE);
|
||||
contact_list_add("James", NULL, NULL, NULL, FALSE);
|
||||
contact_list_add("Dave", NULL, NULL, NULL, FALSE);
|
||||
contact_list_add("Bob", NULL, NULL, NULL, FALSE);
|
||||
contact_list_add("James", NULL, NULL, NULL, FALSE);
|
||||
GSList *list = get_contact_list();
|
||||
PContact first = list->data;
|
||||
PContact second = (g_slist_next(list))->data;
|
||||
@ -145,7 +145,7 @@ static void add_twice_at_end_adds_once(void)
|
||||
|
||||
static void test_show_online_when_no_value(void)
|
||||
{
|
||||
contact_list_add("James", NULL, NULL, FALSE);
|
||||
contact_list_add("James", NULL, NULL, NULL, FALSE);
|
||||
GSList *list = get_contact_list();
|
||||
PContact james = list->data;
|
||||
|
||||
@ -154,7 +154,7 @@ static void test_show_online_when_no_value(void)
|
||||
|
||||
static void test_status_when_no_value(void)
|
||||
{
|
||||
contact_list_add("James", NULL, NULL, FALSE);
|
||||
contact_list_add("James", NULL, NULL, NULL, FALSE);
|
||||
GSList *list = get_contact_list();
|
||||
PContact james = list->data;
|
||||
|
||||
@ -163,9 +163,9 @@ static void test_status_when_no_value(void)
|
||||
|
||||
static void find_first_exists(void)
|
||||
{
|
||||
contact_list_add("James", NULL, NULL, FALSE);
|
||||
contact_list_add("Dave", NULL, NULL, FALSE);
|
||||
contact_list_add("Bob", NULL, NULL, FALSE);
|
||||
contact_list_add("James", NULL, NULL, NULL, FALSE);
|
||||
contact_list_add("Dave", NULL, NULL, NULL, FALSE);
|
||||
contact_list_add("Bob", NULL, NULL, NULL, FALSE);
|
||||
|
||||
char *search = (char *) malloc(2 * sizeof(char));
|
||||
strcpy(search, "B");
|
||||
@ -178,9 +178,9 @@ static void find_first_exists(void)
|
||||
|
||||
static void find_second_exists(void)
|
||||
{
|
||||
contact_list_add("James", NULL, NULL, FALSE);
|
||||
contact_list_add("Dave", NULL, NULL, FALSE);
|
||||
contact_list_add("Bob", NULL, NULL, FALSE);
|
||||
contact_list_add("James", NULL, NULL, NULL, FALSE);
|
||||
contact_list_add("Dave", NULL, NULL, NULL, FALSE);
|
||||
contact_list_add("Bob", NULL, NULL, NULL, FALSE);
|
||||
|
||||
char *result = contact_list_find_contact("Dav");
|
||||
assert_string_equals("Dave", result);
|
||||
@ -189,9 +189,9 @@ static void find_second_exists(void)
|
||||
|
||||
static void find_third_exists(void)
|
||||
{
|
||||
contact_list_add("James", NULL, NULL, FALSE);
|
||||
contact_list_add("Dave", NULL, NULL, FALSE);
|
||||
contact_list_add("Bob", NULL, NULL, FALSE);
|
||||
contact_list_add("James", NULL, NULL, NULL, FALSE);
|
||||
contact_list_add("Dave", NULL, NULL, NULL, FALSE);
|
||||
contact_list_add("Bob", NULL, NULL, NULL, FALSE);
|
||||
|
||||
char *result = contact_list_find_contact("Ja");
|
||||
assert_string_equals("James", result);
|
||||
@ -200,9 +200,9 @@ static void find_third_exists(void)
|
||||
|
||||
static void find_returns_null(void)
|
||||
{
|
||||
contact_list_add("James", NULL, NULL, FALSE);
|
||||
contact_list_add("Dave", NULL, NULL, FALSE);
|
||||
contact_list_add("Bob", NULL, NULL, FALSE);
|
||||
contact_list_add("James", NULL, NULL, NULL, FALSE);
|
||||
contact_list_add("Dave", NULL, NULL, NULL, FALSE);
|
||||
contact_list_add("Bob", NULL, NULL, NULL, FALSE);
|
||||
|
||||
char *result = contact_list_find_contact("Mike");
|
||||
assert_is_null(result);
|
||||
@ -216,9 +216,9 @@ static void find_on_empty_returns_null(void)
|
||||
|
||||
static void find_twice_returns_second_when_two_match(void)
|
||||
{
|
||||
contact_list_add("James", NULL, NULL, FALSE);
|
||||
contact_list_add("Jamie", NULL, NULL, FALSE);
|
||||
contact_list_add("Bob", NULL, NULL, FALSE);
|
||||
contact_list_add("James", NULL, NULL, NULL, FALSE);
|
||||
contact_list_add("Jamie", NULL, NULL, NULL, FALSE);
|
||||
contact_list_add("Bob", NULL, NULL, NULL, FALSE);
|
||||
|
||||
char *result1 = contact_list_find_contact("Jam");
|
||||
char *result2 = contact_list_find_contact(result1);
|
||||
@ -229,16 +229,16 @@ static void find_twice_returns_second_when_two_match(void)
|
||||
|
||||
static void find_five_times_finds_fifth(void)
|
||||
{
|
||||
contact_list_add("Jama", NULL, NULL, FALSE);
|
||||
contact_list_add("Jamb", NULL, NULL, FALSE);
|
||||
contact_list_add("Mike", NULL, NULL, FALSE);
|
||||
contact_list_add("Dave", NULL, NULL, FALSE);
|
||||
contact_list_add("Jamm", NULL, NULL, FALSE);
|
||||
contact_list_add("Jamn", NULL, NULL, FALSE);
|
||||
contact_list_add("Matt", NULL, NULL, FALSE);
|
||||
contact_list_add("Jamo", NULL, NULL, FALSE);
|
||||
contact_list_add("Jamy", NULL, NULL, FALSE);
|
||||
contact_list_add("Jamz", NULL, NULL, FALSE);
|
||||
contact_list_add("Jama", NULL, NULL, NULL, FALSE);
|
||||
contact_list_add("Jamb", NULL, NULL, NULL, FALSE);
|
||||
contact_list_add("Mike", NULL, NULL, NULL, FALSE);
|
||||
contact_list_add("Dave", NULL, NULL, NULL, FALSE);
|
||||
contact_list_add("Jamm", NULL, NULL, NULL, FALSE);
|
||||
contact_list_add("Jamn", NULL, NULL, NULL, FALSE);
|
||||
contact_list_add("Matt", NULL, NULL, NULL, FALSE);
|
||||
contact_list_add("Jamo", NULL, NULL, NULL, FALSE);
|
||||
contact_list_add("Jamy", NULL, NULL, NULL, FALSE);
|
||||
contact_list_add("Jamz", NULL, NULL, NULL, FALSE);
|
||||
|
||||
char *result1 = contact_list_find_contact("Jam");
|
||||
char *result2 = contact_list_find_contact(result1);
|
||||
@ -255,9 +255,9 @@ static void find_five_times_finds_fifth(void)
|
||||
|
||||
static void find_twice_returns_first_when_two_match_and_reset(void)
|
||||
{
|
||||
contact_list_add("James", NULL, NULL, FALSE);
|
||||
contact_list_add("Jamie", NULL, NULL, FALSE);
|
||||
contact_list_add("Bob", NULL, NULL, FALSE);
|
||||
contact_list_add("James", NULL, NULL, NULL, FALSE);
|
||||
contact_list_add("Jamie", NULL, NULL, NULL, FALSE);
|
||||
contact_list_add("Bob", NULL, NULL, NULL, FALSE);
|
||||
|
||||
char *result1 = contact_list_find_contact("Jam");
|
||||
contact_list_reset_search_attempts();
|
||||
|
Loading…
Reference in New Issue
Block a user