#include <glib.h>
#include "test.h"
-char*
+RESULT
test_list_length ()
{
GList *list = g_list_prepend (NULL, "foo");
return NULL;
}
-char*
+RESULT
test_list_nth ()
{
char *foo = "foo";
if (nth->data != baz)
return "nth failed. #3";
- return NULL;
+ return OK;
}
-char*
+RESULT
test_list_index ()
{
int i;
if (i != 2)
return "index failed. #3";
- return NULL;
+ return OK;
}
-char*
+RESULT
test_list_append ()
{
GList *list = g_list_prepend (NULL, "first");
if (g_list_length (list) != 2)
return "Append failed";
- return NULL;
+ return OK;
}
-char *
+
+RESULT
test_list_last ()
{
GList *foo = g_list_prepend (NULL, "foo");
if (strcmp ("quux", last->data))
return "last failed. #2";
- return NULL;
+ return OK;
}
-char *
+RESULT
test_list_concat ()
{
GList *foo = g_list_prepend (NULL, "foo");
if (g_list_last (list) != bar)
return "Concat failed. #5";
- return NULL;
+ return OK;
}
return 1;
}
-char*
+RESULT
test_list_insert_sorted ()
{
GList *list = g_list_prepend (NULL, "a");
/* insert at the middle */
list = g_list_insert_sorted (list, "aa", compare);
if (strcmp ("aa", list->next->data))
- return result ("insert_sorted failed. #1");
+ return FAILED ("insert_sorted failed. #1");
/* insert at the beginning */
list = g_list_insert_sorted (list, "", compare);
if (strcmp ("", list->data))
- return result ("insert_sorted failed. #2");
+ return FAILED ("insert_sorted failed. #2");
/* insert at the end */
list = g_list_insert_sorted (list, "aaaa", compare);
if (strcmp ("aaaa", g_list_last (list)->data))
- return result ("insert_sorted failed. #3");
+ return FAILED ("insert_sorted failed. #3");
- return NULL;
+ return OK;
}
-char *
+RESULT
test_list_copy ()
{
int i, length;
if (strcmp (g_list_nth (list, i)->data,
g_list_nth (copy, i)->data))
return "copy failed.";
- return NULL;
+ return OK;
}
-char *
+RESULT
test_list_reverse ()
{
guint i, length;
g_list_nth (reverse, j)->data))
return "reverse failed. #2";
}
- return NULL;
+ return OK;
}
static Test list_tests [] = {