Added few more stubs so that control reaches to DestroyDevice().
[mesa.git] / src / util / rb_tree_test.c
index a5952b3b52db141e4b254056efc046ecee88954e..7551add95c18a08877c009f0535000845102349c 100644 (file)
@@ -84,7 +84,28 @@ validate_tree_order(struct rb_tree *tree, unsigned expected_count)
              * show up in the list in order of insertion.  We insert them
              * in the order they are in in the array.
              */
-            if (prev == NULL || prev < n);
+            assert(prev == NULL || prev < n);
+        }
+
+        prev = n;
+        count++;
+    }
+    assert(count == expected_count);
+
+    prev = NULL;
+    max_val = -1;
+    count = 0;
+    rb_tree_foreach_safe(struct rb_test_node, n, tree, node) {
+        /* Everything should be in increasing order */
+        assert(n->key >= max_val);
+        if (n->key > max_val) {
+            max_val = n->key;
+        } else {
+            /* Things should be stable, i.e., given equal keys, they should
+             * show up in the list in order of insertion.  We insert them
+             * in the order they are in in the array.
+             */
+            assert(prev == NULL || prev < n);
         }
 
         prev = n;
@@ -105,7 +126,28 @@ validate_tree_order(struct rb_tree *tree, unsigned expected_count)
              * show up in the list in order of insertion.  We insert them
              * in the order they are in in the array.
              */
-            if (prev == NULL || prev > n);
+            assert(prev == NULL || prev > n);
+        }
+
+        prev = n;
+        count++;
+    }
+    assert(count == expected_count);
+
+    prev = NULL;
+    min_val = INT_MAX;
+    count = 0;
+    rb_tree_foreach_rev_safe(struct rb_test_node, n, tree, node) {
+        /* Everything should be in increasing order */
+        assert(n->key <= min_val);
+        if (n->key < min_val) {
+            min_val = n->key;
+        } else {
+            /* Things should be stable, i.e., given equal keys, they should
+             * show up in the list in order of insertion.  We insert them
+             * in the order they are in in the array.
+             */
+            assert(prev == NULL || prev > n);
         }
 
         prev = n;