[gtk+] Move asserts to gtktreemodelrefcount.h for other unit tests to use



commit d241323b08f71c322054099a1a809de485eabc0d
Author: Kristian Rietveld <kris gtk org>
Date:   Thu Jun 2 16:20:08 2011 +0200

    Move asserts to gtktreemodelrefcount.h for other unit tests to use

 gtk/tests/gtktreemodelrefcount.h |   78 ++++++++++++++++++++++++++++++++++++++
 gtk/tests/modelrefcount.c        |   74 ------------------------------------
 2 files changed, 78 insertions(+), 74 deletions(-)
---
diff --git a/gtk/tests/gtktreemodelrefcount.h b/gtk/tests/gtktreemodelrefcount.h
index c8c8e89..5d45762 100644
--- a/gtk/tests/gtktreemodelrefcount.h
+++ b/gtk/tests/gtktreemodelrefcount.h
@@ -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__ */
diff --git a/gtk/tests/modelrefcount.c b/gtk/tests/modelrefcount.c
index c94d60f..f1c9d7a 100644
--- a/gtk/tests/modelrefcount.c
+++ b/gtk/tests/modelrefcount.c
@@ -20,80 +20,6 @@
 #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



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]