summaryrefslogtreecommitdiff
path: root/gir
diff options
context:
space:
mode:
authorTomeu Vizoso <tomeu@sugarlabs.org>2010-04-09 16:10:34 +0200
committerTomeu Vizoso <tomeu@sugarlabs.org>2010-04-09 16:10:34 +0200
commitc6416126de8ff7a522c873786f92d876a0e41ac2 (patch)
treea67ae13b13b773564d02e7590aec14abdfbb68fb /gir
parent024d7d9c94fd533472a6abdcced94ee638c0d7fc (diff)
downloadgobject-introspection-c6416126de8ff7a522c873786f92d876a0e41ac2.tar.gz
Assert input values in Everything funcs
Diffstat (limited to 'gir')
-rw-r--r--gir/everything.c25
-rw-r--r--gir/everything.h4
2 files changed, 29 insertions, 0 deletions
diff --git a/gir/everything.c b/gir/everything.c
index 3957d06d..7d10dbce 100644
--- a/gir/everything.c
+++ b/gir/everything.c
@@ -3,12 +3,37 @@
#include "everything.h"
#include <gio/gio.h>
+static gboolean abort_on_error = TRUE;
+
+#define ASSERT_VALUE(condition) \
+ if (abort_on_error) \
+ g_assert (condition); \
+ else \
+ g_warn_if_fail (condition); \
+
+void set_abort_on_error (gboolean in)
+{
+ abort_on_error = in;
+}
+
/* basic types */
gboolean test_boolean (gboolean in)
{
return in;
}
+gboolean test_boolean_true (gboolean in)
+{
+ ASSERT_VALUE (in == TRUE);
+ return in;
+}
+
+gboolean test_boolean_false (gboolean in)
+{
+ ASSERT_VALUE (in == FALSE);
+ return in;
+}
+
gint8 test_int8 (gint8 in)
{
return in;
diff --git a/gir/everything.h b/gir/everything.h
index 04c27d70..f317a9d4 100644
--- a/gir/everything.h
+++ b/gir/everything.h
@@ -4,8 +4,12 @@
#include <glib-object.h>
#include <time.h>
+void set_abort_on_error (gboolean abort_on_error);
+
/* basic types */
gboolean test_boolean (gboolean in);
+gboolean test_boolean_true (gboolean in);
+gboolean test_boolean_false (gboolean in);
gint8 test_int8 (gint8 in);
guint8 test_uint8 (guint8 in);
gint16 test_int16 (gint16 in);