]> Pileus Git - ~andy/gtk/commitdiff
Move asserts to gtktreemodelrefcount.h for other unit tests to use
authorKristian Rietveld <kris@gtk.org>
Thu, 2 Jun 2011 14:20:08 +0000 (16:20 +0200)
committerKristian Rietveld <kris@gtk.org>
Mon, 22 Aug 2011 19:30:31 +0000 (21:30 +0200)
gtk/tests/gtktreemodelrefcount.h
gtk/tests/modelrefcount.c

index c8c8e89dfd16605a0ad805c9096e44779b2aa2a1..5d457622b8adda66dc3a516cfc66b9a0ace37209 100644 (file)
@@ -62,4 +62,82 @@ gboolean      gtk_tree_model_ref_count_check_node  (GtkTreeModelRefCount *ref_mo
                                                     GtkTreeIter          *iter,
                                                     gint                  expected_ref_count);
 
+/* A couple of helpers for the tests.  Since this model will never be used
+ * outside of unit tests anyway, it is probably fine to have these here
+ * without namespacing.
+ */
+
+static inline void
+assert_entire_model_unreferenced (GtkTreeModelRefCount *ref_model)
+{
+  g_assert_cmpint (gtk_tree_model_ref_count_check_level (ref_model, NULL, 0,
+                                                         TRUE),
+                   ==, TRUE);
+}
+
+static inline void
+assert_root_level_unreferenced (GtkTreeModelRefCount *ref_model)
+{
+  g_assert_cmpint (gtk_tree_model_ref_count_check_level (ref_model, NULL, 0,
+                                                         FALSE),
+                   ==, TRUE);
+}
+
+static inline void
+assert_level_unreferenced (GtkTreeModelRefCount *ref_model,
+                           GtkTreeIter          *iter)
+{
+  g_assert_cmpint (gtk_tree_model_ref_count_check_level (ref_model, iter,
+                                                         0, FALSE),
+                   ==, TRUE);
+}
+
+static inline void
+assert_entire_model_referenced (GtkTreeModelRefCount *ref_model,
+                                gint                  ref_count)
+{
+  g_assert_cmpint (gtk_tree_model_ref_count_check_level (ref_model, NULL,
+                                                         ref_count, TRUE),
+                   ==, TRUE);
+}
+
+static inline void
+assert_not_entire_model_referenced (GtkTreeModelRefCount *ref_model,
+                                    gint                  ref_count)
+{
+  g_assert_cmpint (gtk_tree_model_ref_count_check_level (ref_model, NULL,
+                                                         ref_count, TRUE),
+                   ==, FALSE);
+}
+
+static inline void
+assert_root_level_referenced (GtkTreeModelRefCount *ref_model,
+                              gint                  ref_count)
+{
+  g_assert_cmpint (gtk_tree_model_ref_count_check_level (ref_model, NULL,
+                                                         ref_count, FALSE),
+                   ==, TRUE);
+}
+
+static inline void
+assert_level_referenced (GtkTreeModelRefCount *ref_model,
+                         gint                  ref_count,
+                         GtkTreeIter          *iter)
+{
+  g_assert_cmpint (gtk_tree_model_ref_count_check_level (ref_model, iter,
+                                                         ref_count, FALSE),
+                   ==, TRUE);
+}
+
+static inline void
+assert_node_ref_count (GtkTreeModelRefCount *ref_model,
+                       GtkTreeIter          *iter,
+                       gint                  ref_count)
+{
+  g_assert_cmpint (gtk_tree_model_ref_count_check_node (ref_model, iter,
+                                                        ref_count),
+                   ==, TRUE);
+}
+
+
 #endif /* __GTK_TREE_MODEL_REF_COUNT_H__ */
index c94d60f7e61c979301708977e24577684786d2bf..f1c9d7ac832d9a49b7bd16909f2c048e391193cb 100644 (file)
 #include "gtktreemodelrefcount.h"
 #include "treemodel.h"
 
-/* A couple of helpers for the tests */
-
-static inline void
-assert_entire_model_unreferenced (GtkTreeModelRefCount *ref_model)
-{
-  g_assert_cmpint (gtk_tree_model_ref_count_check_level (ref_model, NULL, 0,
-                                                         TRUE),
-                   ==, TRUE);
-}
-
-static inline void
-assert_root_level_unreferenced (GtkTreeModelRefCount *ref_model)
-{
-  g_assert_cmpint (gtk_tree_model_ref_count_check_level (ref_model, NULL, 0,
-                                                         FALSE),
-                   ==, TRUE);
-}
-
-static inline void
-assert_level_unreferenced (GtkTreeModelRefCount *ref_model,
-                           GtkTreeIter          *iter)
-{
-  g_assert_cmpint (gtk_tree_model_ref_count_check_level (ref_model, iter,
-                                                         0, FALSE),
-                   ==, TRUE);
-}
-
-static inline void
-assert_entire_model_referenced (GtkTreeModelRefCount *ref_model,
-                                gint                  ref_count)
-{
-  g_assert_cmpint (gtk_tree_model_ref_count_check_level (ref_model, NULL,
-                                                         ref_count, TRUE),
-                   ==, TRUE);
-}
-
-    static inline void
-assert_not_entire_model_referenced (GtkTreeModelRefCount *ref_model,
-                                    gint                  ref_count)
-{
-  g_assert_cmpint (gtk_tree_model_ref_count_check_level (ref_model, NULL,
-                                                         ref_count, TRUE),
-                   ==, FALSE);
-}
-
-static inline void
-assert_root_level_referenced (GtkTreeModelRefCount *ref_model,
-                              gint                  ref_count)
-{
-  g_assert_cmpint (gtk_tree_model_ref_count_check_level (ref_model, NULL,
-                                                         ref_count, FALSE),
-                   ==, TRUE);
-}
-
-static inline void
-assert_level_referenced (GtkTreeModelRefCount *ref_model,
-                         gint                  ref_count,
-                         GtkTreeIter          *iter)
-{
-  g_assert_cmpint (gtk_tree_model_ref_count_check_level (ref_model, iter,
-                                                         ref_count, FALSE),
-                   ==, TRUE);
-}
-
-static inline void
-assert_node_ref_count (GtkTreeModelRefCount *ref_model,
-                       GtkTreeIter          *iter,
-                       gint                  ref_count)
-{
-  g_assert_cmpint (gtk_tree_model_ref_count_check_node (ref_model, iter,
-                                                        ref_count),
-                   ==, TRUE);
-}
-
 /* And the tests themselves */
 
 static void