[msvc] Update csproj files
[mono.git] / eglib / test / list.c
index ff14a93c119097c1a6c97eedf68a89f0b3f4a1c8..68dadee612afd0912105c7d880468529ee79173f 100644 (file)
@@ -315,10 +315,12 @@ static int intcompare (gconstpointer p1, gconstpointer p2)
 
 static gboolean verify_sort (GList *list, int len)
 {
+       int prev;
+
        if (list->prev)
                return FALSE;
 
-       int prev = GPOINTER_TO_INT (list->data);
+       prev = GPOINTER_TO_INT (list->data);
        len--;
        for (list = list->next; list; list = list->next) {
                int curr = GPOINTER_TO_INT (list->data);
@@ -386,6 +388,34 @@ test_list_sort ()
        return OK;
 }
 
+static gint
+find_custom (gconstpointer a, gconstpointer b)
+{
+       return(strcmp (a, b));
+}
+
+RESULT
+test_list_find_custom ()
+{
+       GList *list = NULL, *found;
+       char *foo = "foo";
+       char *bar = "bar";
+       char *baz = "baz";
+       
+       list = g_list_prepend (list, baz);
+       list = g_list_prepend (list, bar);
+       list = g_list_prepend (list, foo);
+       
+       found = g_list_find_custom (list, baz, find_custom);
+       
+       if (found == NULL)
+               return FAILED ("Find failed");
+       
+       g_list_free (list);
+       
+       return OK;
+}
+
 static Test list_tests [] = {
        {       "length", test_list_length},
        {          "nth", test_list_nth},
@@ -401,6 +431,7 @@ static Test list_tests [] = {
        {  "remove_link", test_list_remove_link},
        {  "remove_link", test_list_remove_link},
        {         "sort", test_list_sort},
+       {  "find_custom", test_list_find_custom},
        {NULL, NULL}
 };