[libgda] Make sure g_set_error() is called with valid error domain and code



commit ebda7c4cb36fd3c19ef377c63d0cb15ae8869fd8
Author: Vivien Malerba <malerba gnome-db org>
Date:   Wed Aug 21 17:31:25 2013 +0200

    Make sure g_set_error() is called with valid error domain and code

 tests/.gitignore                       |    4 +-
 tests/Makefile.am                      |    2 +
 tests/data-model-errors.c              |    5 +-
 tests/data-models/Makefile.am          |    4 +-
 tests/data-models/check_data_proxy.c   |    3 +-
 tests/data-models/check_empty_rs.c     |    3 +-
 tests/data-models/check_model_errors.c |    2 +-
 tests/data-models/check_pmodel.c       |    7 +-
 tests/multi-threading/Makefile.am      |   10 ++-
 tests/multi-threading/common.c         |    3 +-
 tests/providers/Makefile.am            |    2 +
 tests/providers/prov-test-common.c     |   14 ++--
 tests/test-cnc-utils.c                 |    9 +-
 tests/test-errors.c                    |   30 +++++++
 tests/test-errors.h                    |   32 +++++++
 tests/value-holders/Makefile.am        |    6 +-
 tests/value-holders/check_holder.c     |  140 ++++++++++++++++----------------
 tests/value-holders/check_set.c        |   34 ++++----
 tests/value-holders/check_statement.c  |    4 +-
 tests/value-holders/common.c           |   16 ++--
 tests/value-holders/common.h           |    1 +
 21 files changed, 210 insertions(+), 121 deletions(-)
---
diff --git a/tests/.gitignore b/tests/.gitignore
index 232b794..0429d8a 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -5,4 +5,6 @@ test-identifiers-quotes
 test-sql-builder
 test-connection-string-split
 test-input-parsers
-test-quark-list
\ No newline at end of file
+test-quark-list
+*.log
+*.trs
\ No newline at end of file
diff --git a/tests/Makefile.am b/tests/Makefile.am
index dec1cce..f23467f 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -28,6 +28,8 @@ test_headers = \
 
 libgda_test_5_0_la_SOURCES = \
         $(test_headers) \
+       test-errors.h \
+       test-errors.c \
         gda-ddl-creator.c \
        test-cnc-utils.h \
        test-cnc-utils.c \
diff --git a/tests/data-model-errors.c b/tests/data-model-errors.c
index d8d180f..0f61e4d 100644
--- a/tests/data-model-errors.c
+++ b/tests/data-model-errors.c
@@ -25,6 +25,7 @@
 #include <libgda/gda-row.h>
 #include <data-model-errors.h>
 #include <libgda/gda-debug-macros.h>
+#include "test-errors.h"
 
 #define NCOLS 4
 typedef struct {
@@ -394,7 +395,7 @@ data_model_errors_set_value_at (GdaDataModel *model, gint col, gint row, const G
        if ((col < 0) || (col > NCOLS)) {
                gchar *tmp;
                tmp = g_strdup_printf ("Column %d out of range (0-%d)", col, NCOLS-1);
-               g_set_error (error, 0, 0, "%s", tmp);
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", tmp);
                g_free (tmp);
                return FALSE;
        }
@@ -450,7 +451,7 @@ data_model_errors_remove_row (GdaDataModel *model, gint row, GError **error)
                                               imodel->priv->rows->len - 1);
                else
                        str = g_strdup_printf ("Row %d not found (empty data model)", row);
-               g_set_error (error, 0, 0, "%s", str);
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", str);
                g_free (str);
                 return FALSE;
         }
diff --git a/tests/data-models/Makefile.am b/tests/data-models/Makefile.am
index 1c16276..96b8c43 100644
--- a/tests/data-models/Makefile.am
+++ b/tests/data-models/Makefile.am
@@ -11,7 +11,9 @@ TESTS_ENVIRONMENT = GDA_TOP_SRC_DIR="$(abs_top_srcdir)" GDA_TOP_BUILD_DIR="$(abs
 check_PROGRAMS = check_model_import check_virtual check_data_proxy check_model_copy check_pmodel 
check_empty_rs check_model_errors check_vcnc check_pivot
 TESTS = check_model_import check_virtual check_data_proxy check_model_copy check_pmodel check_empty_rs 
check_model_errors check_vcnc check_pivot
 
-common_sources = 
+common_sources = \
+       ../test-errors.h \
+       ../test-errors.c
 
 check_model_import_SOURCES = $(common_sources) check_model_import.c
 check_model_import_LDADD = \
diff --git a/tests/data-models/check_data_proxy.c b/tests/data-models/check_data_proxy.c
index 6ea3bdf..09f80d5 100644
--- a/tests/data-models/check_data_proxy.c
+++ b/tests/data-models/check_data_proxy.c
@@ -21,6 +21,7 @@
 #include <glib.h>
 #include <libgda/libgda.h>
 #include <stdarg.h>
+#include "../test-errors.h"
 
 #define fail(x) g_warning (x)
 #define fail_if(x,y) if (x) g_warning (y)
@@ -204,7 +205,7 @@ validate_row_changes (GdaDataProxy *proxy, gint row, gint proxied_row, gchar *to
                pop = g_value_get_int (cvalue);
                if (pop < 100) {
                        GError *error = NULL;
-                       g_set_error (&error, 0, 0,
+                       g_set_error (&error, TEST_ERROR, TEST_ERROR_GENERIC,
                                     "%s", "Population is too small");
                        return error;
                }
diff --git a/tests/data-models/check_empty_rs.c b/tests/data-models/check_empty_rs.c
index 3d0069f..5270ca0 100644
--- a/tests/data-models/check_empty_rs.c
+++ b/tests/data-models/check_empty_rs.c
@@ -21,6 +21,7 @@
 #include <libgda/gda-server-provider-extra.h>
 #include <stdlib.h>
 #include <string.h>
+#include "../test-errors.h"
 
 static gboolean run_test (const gchar *sql, const gchar *empty_rs_serial, GError **error);
 
@@ -92,7 +93,7 @@ run_test (const gchar *sql, const gchar *empty_rs_serial, GError **error)
                g_print ("Missing test data!\n  SQL: %s\n  SER: %s\n", sql, tsql);
        else if (strcmp (tsql, empty_rs_serial)) {
                g_print ("Test failed!\n  SQL: %s\n  EXP: %s\n  GOT: %s\n", sql, empty_rs_serial, tsql);
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "Failed serialized comparison");
                g_free (tsql);
                goto out;
diff --git a/tests/data-models/check_model_errors.c b/tests/data-models/check_model_errors.c
index 7cac808..24faf6b 100644
--- a/tests/data-models/check_model_errors.c
+++ b/tests/data-models/check_model_errors.c
@@ -295,7 +295,7 @@ compare_data_models (GdaDataModel *model1, GdaDataModel *model2, GError **error)
                 g_print ("Model2 is:\n");
                 gda_data_model_dump (model2, stdout);
 #endif
-               g_set_error (&lerror, 0, 0,
+               g_set_error (&lerror, TEST_ERROR, TEST_ERROR_GENERIC,
                             "%s", "There are some differences when comparing data models...");
                 goto onerror;
         }
diff --git a/tests/data-models/check_pmodel.c b/tests/data-models/check_pmodel.c
index 1a5765c..326cdb4 100644
--- a/tests/data-models/check_pmodel.c
+++ b/tests/data-models/check_pmodel.c
@@ -26,6 +26,7 @@
 #include <tests/gda-ddl-creator.h>
 #include <glib/gstdio.h>
 #include "../test-cnc-utils.h"
+#include "../test-errors.h"
 
 #define fail(x) g_warning (x)
 #define fail_if(x,y) if (x) g_warning (y)
@@ -1017,7 +1018,7 @@ test9 (GdaConnection *cnc)
        monitor_model_signals (model);
        g_value_set_string ((value = gda_value_new (G_TYPE_STRING)), "UK");
        if (! check_set_value_at_ext (model, 4, 1, value, cnc, stmt, params, &error)) {
-               if (error && (error->domain == 0) && (error->code == -1)) {
+               if (error && (error->domain == TEST_ERROR) && (error->code == TEST_ERROR_DIFFERENCES)) {
 #ifdef CHECK_EXTRA_INFO
                        g_print ("This error was expected (modified row would not have been in the 
SELECT)\n");
 #endif 
@@ -1984,7 +1985,7 @@ check_set_value_at_ext (GdaDataModel *model, gint col, gint row,
                        gda_data_model_dump (model, stdout);
                        gda_data_model_dump (rerun, stdout);
                        if (error) {
-                               g_set_error (error, 0, -1,
+                               g_set_error (error, TEST_ERROR, TEST_ERROR_DIFFERENCES,
                                             "%s", "There are some differences when re-running the SELECT 
statement...");
                        }
                }
@@ -2340,7 +2341,7 @@ compare_data_models (GdaDataModel *model1, GdaDataModel *model2, GError **error)
                 g_print ("Model2 is:\n");
                 gda_data_model_dump (model2, stdout);
 #endif
-               g_set_error (&lerror, 0, 0,
+               g_set_error (&lerror, TEST_ERROR, TEST_ERROR_GENERIC,
                             "%s", "There are some differences when comparing data models...");
                 goto onerror;
         }
diff --git a/tests/multi-threading/Makefile.am b/tests/multi-threading/Makefile.am
index 8e9bb83..d18e155 100644
--- a/tests/multi-threading/Makefile.am
+++ b/tests/multi-threading/Makefile.am
@@ -10,6 +10,12 @@ TESTS_ENVIRONMENT = GDA_TOP_SRC_DIR="$(abs_top_srcdir)" GDA_TOP_BUILD_DIR="$(abs
 TESTS = check_mutex check_parser check_cnc_lock check_threaded_cnc check_wrapper
 check_PROGRAMS = check_mutex check_parser check_cnc_lock check_threaded_cnc check_wrapper
 
+common_sources = \
+        ../test-errors.h \
+        ../test-errors.c \
+       common.c \
+       common.h
+
 check_mutex_SOURCES = check_mutex.c
 check_mutex_LDADD = \
        $(top_builddir)/libgda/libgda-5.0.la \
@@ -20,12 +26,12 @@ check_parser_LDADD = \
        $(top_builddir)/libgda/libgda-5.0.la \
        $(COREDEPS_LIBS)
 
-check_cnc_lock_SOURCES = check_cnc_lock.c common.c common.h
+check_cnc_lock_SOURCES = check_cnc_lock.c $(common_sources)
 check_cnc_lock_LDADD = \
        $(top_builddir)/libgda/libgda-5.0.la \
        $(COREDEPS_LIBS)
 
-check_threaded_cnc_SOURCES = check_threaded_cnc.c common.c common.h
+check_threaded_cnc_SOURCES = check_threaded_cnc.c $(common_sources)
 check_threaded_cnc_LDADD = \
        $(top_builddir)/libgda/libgda-5.0.la \
        $(COREDEPS_LIBS)
diff --git a/tests/multi-threading/common.c b/tests/multi-threading/common.c
index 0686230..d0b339f 100644
--- a/tests/multi-threading/common.c
+++ b/tests/multi-threading/common.c
@@ -17,6 +17,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 #include "common.h"
+#include "../test-errors.h"
 #include <string.h>
 #include <sql-parser/gda-sql-parser.h>
 #include <glib/gstdio.h>
@@ -35,7 +36,7 @@ create_sqlite_db (const gchar *dir, const gchar *dbname, const gchar *sqlfile, G
        /* create batch */
        prov = gda_config_get_provider ("SQLite", NULL);
        if (!prov) {
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "Cannot find the SQLite provider");
                return FALSE;
        }
diff --git a/tests/providers/Makefile.am b/tests/providers/Makefile.am
index c36061d..2d33817 100644
--- a/tests/providers/Makefile.am
+++ b/tests/providers/Makefile.am
@@ -41,6 +41,8 @@ TESTS += check_postgres
 endif
 
 common_sources = \
+       ../test-errors.h \
+       ../test-errors.c \
        prov-test-common.h \
        prov-test-common.c \
        prov-test-util.h \
diff --git a/tests/providers/prov-test-common.c b/tests/providers/prov-test-common.c
index 442e117..b8a135e 100644
--- a/tests/providers/prov-test-common.c
+++ b/tests/providers/prov-test-common.c
@@ -24,6 +24,8 @@
 #include <sql-parser/gda-sql-parser.h>
 #include <sql-parser/gda-sql-statement.h>
 #include "../test-cnc-utils.h"
+#include "../test-errors.h"
+
 
 #define CHECK_EXTRA_INFO
 /*#undef CHECK_EXTRA_INFO*/
@@ -52,7 +54,7 @@ prov_test_common_setup ()
        cnc = test_cnc_setup_connection (pinfo->id, "testcheckdb", &error);
        if (!cnc) {
                if (error) {
-                       if (error->domain != 0) {
+                       if (error->domain != TEST_ERROR) {
                                gchar *str = g_strdup_printf ("Could not setup connection: %s", 
                                                              error->message ? error->message : "No detail");
                                g_warning ("%s", str);
@@ -610,7 +612,7 @@ prov_test_common_check_data_select ()
                goto out;
        }
        if (remain) {
-               g_set_error (&error, 0, 0,
+               g_set_error (&error, TEST_ERROR, TEST_ERROR_PARSING,
                             "Parsing error, remains: %s", remain);
                number_failed ++;
                goto out;
@@ -630,7 +632,7 @@ prov_test_common_check_data_select ()
        }
 
        if (gda_data_model_get_n_rows (model) != 0) {
-               g_set_error (&error, 0, 0,
+               g_set_error (&error, TEST_ERROR, TEST_ERROR_GENERIC,
                             "Data model reports %d rows when 0 expected", gda_data_model_get_n_rows (model));
                number_failed ++;
                goto out;
@@ -649,7 +651,7 @@ prov_test_common_check_data_select ()
         }
 
        if (gda_data_model_get_n_rows (model) != 9) {
-               g_set_error (&error, 0, 0,
+               g_set_error (&error, TEST_ERROR, TEST_ERROR_GENERIC,
                             "Data model reports %d rows when 9 expected", gda_data_model_get_n_rows (model));
                number_failed ++;
                goto out;
@@ -658,7 +660,7 @@ prov_test_common_check_data_select ()
        /* check the columns haven't changed */
        ncols = gda_data_model_get_n_columns (model);
        if (i != ncols) {
-               g_set_error (&error, 0, 0,
+               g_set_error (&error, TEST_ERROR, TEST_ERROR_GENERIC,
                             "Number of columns has changed from %d to %d\n", i, ncols);
                number_failed ++;
                goto out;
@@ -666,7 +668,7 @@ prov_test_common_check_data_select ()
 
        for (i = 0; i < ncols; i++) {
                if (gda_data_model_describe_column (model, i) != g_slist_nth_data (columns, i)) {
-                       g_set_error (&error, 0, 0,
+                       g_set_error (&error, TEST_ERROR, TEST_ERROR_GENERIC,
                                     "GdaColumn %d has changed from %p to %p\n", i, 
                                     g_slist_nth_data (columns, i),
                                     gda_data_model_describe_column (model, i));
diff --git a/tests/test-cnc-utils.c b/tests/test-cnc-utils.c
index 29aad17..6aa4280 100644
--- a/tests/test-cnc-utils.c
+++ b/tests/test-cnc-utils.c
@@ -21,6 +21,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include "test-cnc-utils.h"
+#include "test-errors.h"
 #include "gda-ddl-creator.h"
 #include <libgda/gda-server-provider-extra.h>
 #include <libgda/sql-parser/gda-sql-parser.h>
@@ -121,7 +122,7 @@ test_cnc_setup_connection (const gchar *provider, const gchar *dbname, GError **
 
        prov_info = gda_config_get_provider_info (provider);
        if (!prov_info) {
-               g_set_error (error, 0, 0,
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC,
                             "Provider '%s' not found", provider);
                return NULL;
        }
@@ -215,7 +216,7 @@ test_cnc_setup_connection (const gchar *provider, const gchar *dbname, GError **
 
  out:
        if (!db_params && !cnc_params) 
-               g_set_error (error, 0, 0,
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC,
                             "Connection parameters not specified, test not executed (define %s_CNC_PARAMS or 
%s_DBCREATE_PARAMS to create a test DB)\n", upname, upname);
        g_free (upname);
 
@@ -361,7 +362,7 @@ test_cnc_load_data_from_file (GdaConnection *cnc, const gchar *table, const gcha
        /* loading XML file */
        import = gda_data_model_import_new_file (full_file, TRUE, NULL);
        if (gda_data_model_import_get_errors (GDA_DATA_MODEL_IMPORT (import))) {
-               g_set_error (error, 0, 0, "Error loading '%s' file", full_file);
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "Error loading '%s' file", full_file);
                return FALSE;
        }
 
@@ -446,7 +447,7 @@ test_cnc_load_data_from_file (GdaConnection *cnc, const gchar *table, const gcha
                }
 
                if (list || (j < ncols)) {
-                       g_set_error (error, 0, 0, "%s", 
+                       g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                                     "Incoherent number of columns in table and imported data");
                        gda_connection_rollback_transaction (cnc, NULL, NULL);
                        retval = FALSE;
diff --git a/tests/test-errors.c b/tests/test-errors.c
new file mode 100644
index 0000000..16ca3d6
--- /dev/null
+++ b/tests/test-errors.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2013 Vivien Malerba <malerba gnome-db org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+#include "test-errors.h"
+
+GQuark
+test_error_quark (void)
+{
+       static GQuark quark;
+        if (!quark)
+                quark = g_quark_from_static_string ("test_error");
+        return quark;
+}
+
+
diff --git a/tests/test-errors.h b/tests/test-errors.h
new file mode 100644
index 0000000..7311fd1
--- /dev/null
+++ b/tests/test-errors.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2013 Vivien Malerba <malerba gnome-db org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+#ifndef __TEST_ERRORS_H__
+#define __TEST_ERRORS_H__
+
+#include <glib.h>
+
+extern GQuark test_error_quark (void);
+#define TEST_ERROR test_error_quark ()
+
+enum {
+       TEST_ERROR_PARSING,
+       TEST_ERROR_GENERIC,
+       TEST_ERROR_DIFFERENCES
+};
+
+#endif
diff --git a/tests/value-holders/Makefile.am b/tests/value-holders/Makefile.am
index e89dd17..9dc736b 100644
--- a/tests/value-holders/Makefile.am
+++ b/tests/value-holders/Makefile.am
@@ -11,7 +11,11 @@ TESTS_ENVIRONMENT = GDA_TOP_SRC_DIR="$(abs_top_srcdir)" GDA_TOP_BUILD_DIR="$(abs
 TESTS = check_holder check_set check_statement
 check_PROGRAMS = check_holder check_set check_statement
 
-common_sources = common.c common.h
+common_sources = \
+       ../test-errors.h \
+       ../test-errors.c \
+       common.c \
+       common.h
 
 check_holder_SOURCES = check_holder.c $(common_sources)
 check_holder_LDADD = $(JSON_GLIB_LIBS) \
diff --git a/tests/value-holders/check_holder.c b/tests/value-holders/check_holder.c
index a3a6d80..01cd265 100644
--- a/tests/value-holders/check_holder.c
+++ b/tests/value-holders/check_holder.c
@@ -110,7 +110,7 @@ test1 (GError **error)
        emitted_signals_monitor_holder (h);
        cvalue = gda_holder_get_value (h);
        if (!gda_value_is_null (cvalue)) {
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "Expecting NULL value from new GdaHolder");
                return FALSE;
        }
@@ -127,7 +127,7 @@ test1 (GError **error)
 
        cvalue = gda_holder_get_value (h);
        if (!cvalue || gda_value_compare (value, cvalue)) {
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "GdaHolder's value is incorrect");
                return FALSE;
        }
@@ -146,7 +146,7 @@ test1 (GError **error)
 
        cvalue = gda_holder_get_value (h);
        if (!cvalue || gda_value_compare (copy, cvalue)) {
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "GdaHolder's value is incorrect");
                return FALSE;
        }
@@ -170,13 +170,13 @@ test2 (GError **error)
        value = gda_value_new_from_string ("TRUE", G_TYPE_BOOLEAN);
        cvalue = gda_holder_get_value (h);
        if (!cvalue || gda_value_compare (value, cvalue)) {
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "GdaHolder's value is incorrect");
                return FALSE;
        }
        gda_value_free (value);
        if (strcmp (gda_holder_get_id (h), "ABOOL")) {
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "GdaHolder's ID is incorrect");
                return FALSE;
        }
@@ -187,13 +187,13 @@ test2 (GError **error)
        value = gda_value_new_from_string ("A string value", G_TYPE_STRING);
        cvalue = gda_holder_get_value (h);
        if (!cvalue || gda_value_compare (value, cvalue)) {
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "GdaHolder's value is incorrect");
                return FALSE;
        }
        gda_value_free (value);
        if (strcmp (gda_holder_get_id (h), "Astring")) {
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "GdaHolder's ID is incorrect");
                return FALSE;
        }
@@ -203,13 +203,13 @@ test2 (GError **error)
        value = gda_value_new_from_string ("15", G_TYPE_INT);
        cvalue = gda_holder_get_value (h);
        if (!cvalue || gda_value_compare (value, cvalue)) {
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "GdaHolder's value is incorrect");
                return FALSE;
        }
        gda_value_free (value);
        if (strcmp (gda_holder_get_id (h), "AnInt")) {
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "GdaHolder's ID is incorrect");
                return FALSE;
        }
@@ -232,7 +232,7 @@ test3 (GError **error)
        h = gda_holder_new_boolean ("ABOOL", TRUE);
        emitted_signals_monitor_holder (h);
        if (!gda_holder_is_valid (h)) {
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "GdaHolder is invalid");
                return FALSE;
        }
@@ -240,13 +240,13 @@ test3 (GError **error)
        /***/
        gda_holder_force_invalid (h);
        if (gda_holder_is_valid (h)) {
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "GdaHolder is valid");
                return FALSE;
        }
        cvalue = gda_holder_get_value (h);
        if (cvalue) {
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "GdaHolder's value is incorrect");
                return FALSE;
        }
@@ -257,7 +257,7 @@ test3 (GError **error)
        if (! gda_holder_take_value (h, value, error))
                return FALSE;
        if (!gda_holder_is_valid (h)) {
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "GdaHolder is invalid");
                return FALSE;
        }
@@ -287,14 +287,14 @@ test4 (GError **error)
        
        cvalue = gda_holder_get_default_value (h);
        if (cvalue) {
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "GdaHolder should not have a default value");
                return FALSE;
        }
 
        /***/
        if (gda_holder_set_value_to_default (h)) {
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "Should not set GdaHolder's value to default");
                return FALSE;
        }
@@ -309,7 +309,7 @@ test4 (GError **error)
 
        cvalue = gda_holder_get_default_value (h);
        if (!cvalue || gda_value_compare (value, cvalue)) {
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "GdaHolder's default value is invalid");
                return FALSE;
        }
@@ -317,14 +317,14 @@ test4 (GError **error)
 
        /***/
        if (gda_holder_value_is_default (h)) {
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "GdaHolder's value should not be default");
                return FALSE;
        }
 
        /** Check value */
        if (! gda_holder_set_value_to_default (h)) {
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "Could not set GdaHolder's value to default");
                return FALSE;
        }
@@ -336,7 +336,7 @@ test4 (GError **error)
        cvalue = gda_holder_get_value (h);
        if (cvalue) {
                tests_common_display_value ("cvalue", cvalue);
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "GdaHolder's value is invalid");
                return FALSE;
        }
@@ -353,7 +353,7 @@ test4 (GError **error)
        cvalue = gda_holder_get_value (h);
        if (!cvalue || gda_value_compare (value, cvalue)) {
                tests_common_display_value ("cvalue", cvalue);
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "GdaHolder's value is invalid");
                return FALSE;
        }
@@ -367,7 +367,7 @@ test4 (GError **error)
 
        cvalue = gda_holder_get_default_value (h);
        if (!cvalue || gda_value_compare (value, cvalue)) {
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "GdaHolder's default value is invalid");
                return FALSE;
        }
@@ -375,7 +375,7 @@ test4 (GError **error)
 
        /***/
        if (gda_holder_value_is_default (h)) {
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "GdaHolder's value should not be default");
                return FALSE;
        }
@@ -401,7 +401,7 @@ test5 (GError **error)
 
        cvalue = gda_holder_get_default_value (h);
        if (cvalue) {
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "GdaHolder should not have a default value");
                return FALSE;
        }
@@ -414,21 +414,21 @@ test5 (GError **error)
 
        cvalue = gda_holder_get_default_value (h);
        if (!cvalue || gda_value_compare (defvalue, cvalue)) {
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "GdaHolder's default value is invalid");
                return FALSE;
        }
 
        /***/
        if (gda_holder_value_is_default (h)) {
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "GdaHolder's value should not be default");
                return FALSE;
        }
 
        /** Check value */
        if (! gda_holder_set_value_to_default (h)) {
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "Could not set GdaHolder's value to default");
                return FALSE;
        }
@@ -440,7 +440,7 @@ test5 (GError **error)
        cvalue = gda_holder_get_value (h);
        if (!cvalue || gda_value_compare (defvalue, cvalue)) {
                tests_common_display_value ("cvalue", cvalue);
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "GdaHolder's value is invalid");
                return FALSE;
        }
@@ -457,7 +457,7 @@ test5 (GError **error)
        cvalue = gda_holder_get_value (h);
        if (!cvalue || gda_value_compare (value, cvalue)) {
                tests_common_display_value ("cvalue", cvalue);
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "GdaHolder's value is invalid");
                return FALSE;
        }
@@ -465,7 +465,7 @@ test5 (GError **error)
        
        /***/
        if (gda_holder_value_is_default (h)) {
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "GdaHolder's value should not be default");
                return FALSE;
        }
@@ -482,7 +482,7 @@ test5 (GError **error)
        cvalue = gda_holder_get_value (h);
        if (!cvalue || gda_value_compare (value, cvalue)) {
                tests_common_display_value ("cvalue", cvalue);
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "GdaHolder's value is invalid");
                return FALSE;
        }
@@ -490,7 +490,7 @@ test5 (GError **error)
 
        /***/
        if (!gda_holder_value_is_default (h)) {
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "GdaHolder's value should be default");
                return FALSE;
        }
@@ -516,7 +516,7 @@ test6 (GError **error)
        emitted_signals_monitor_holder (h);
        emitted_signals_reset ();
        if (cvalue) {
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "GdaHolder should not have a default value");
                return FALSE;
        }
@@ -529,21 +529,21 @@ test6 (GError **error)
 
        cvalue = gda_holder_get_default_value (h);
        if (!cvalue || gda_value_compare (defvalue, cvalue)) {
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "GdaHolder's default value is invalid");
                return FALSE;
        }
 
        /***/
        if (gda_holder_value_is_default (h)) {
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "GdaHolder's value should not be default");
                return FALSE;
        }
 
        /** Check value */
        if (! gda_holder_set_value_to_default (h)) {
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "Could not set GdaHolder's value to default");
                return FALSE;
        }
@@ -555,7 +555,7 @@ test6 (GError **error)
        cvalue = gda_holder_get_value (h);
        if (cvalue) {
                tests_common_display_value ("cvalue", cvalue);
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "GdaHolder's value is invalid");
                return FALSE;
        }
@@ -567,7 +567,7 @@ test6 (GError **error)
        cvalue = gda_holder_get_value (h);
        if (!cvalue || gda_value_compare (value, cvalue)) {
                tests_common_display_value ("cvalue", cvalue);
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "GdaHolder's value is invalid");
                return FALSE;
        }
@@ -575,7 +575,7 @@ test6 (GError **error)
        
        /***/
        if (gda_holder_value_is_default (h)) {
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "GdaHolder's value should not be default");
                return FALSE;
        }
@@ -615,7 +615,7 @@ test7 (GError **error)
        cvalue = gda_holder_get_value (h1);
        if (!cvalue || gda_value_compare (value, cvalue)) {
                tests_common_display_value ("Slave", cvalue);
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "Slave GdaHolder's value is wrong");
                return FALSE;
        }
@@ -635,7 +635,7 @@ test7 (GError **error)
        cvalue = gda_holder_get_value (h1);
        if (!cvalue || gda_value_compare (value, cvalue)) {
                tests_common_display_value ("Slave", cvalue);
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "Slave GdaHolder's value is wrong");
                return FALSE;
        }
@@ -654,13 +654,13 @@ test7 (GError **error)
 
        cvalue = gda_holder_get_value (h2);
        if (!cvalue || gda_value_compare (value, cvalue)) {
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "Master GdaHolder's value is wrong");
                return FALSE;
        }
        cvalue = gda_holder_get_value (h1);
        if (!cvalue || gda_value_compare (value, cvalue)) {
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "Slave GdaHolder's value is wrong");
                return FALSE;
        }
@@ -673,7 +673,7 @@ test7 (GError **error)
 
        cvalue = gda_holder_get_value (h1);
        if (!cvalue || gda_value_compare (value, cvalue)) {
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "Slave GdaHolder's value is wrong");
                return FALSE;
        }
@@ -691,14 +691,14 @@ test7 (GError **error)
 
        cvalue = gda_holder_get_value (h1);
        if (!cvalue || gda_value_compare (value, cvalue)) {
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "Slave GdaHolder's value is wrong");
                return FALSE;
        }
 
        cvalue = gda_holder_get_value (h2);
        if (!cvalue || !gda_value_compare (value, cvalue)) {
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "Master GdaHolder's value is wrong");
                return FALSE;
        }
@@ -735,7 +735,7 @@ test8 (GError **error)
 
        /***/
        if (!gda_holder_value_is_default (h)) {
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "GdaHolder's value should be default");
                return FALSE;
        }
@@ -769,7 +769,7 @@ test9 (GError **error)
                return FALSE;
 
        if ((gda_holder_get_source_model (h, &col) != model) || (col != 1)) {
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "GdaHolder's source is wrong");
                return FALSE;
        }
@@ -782,7 +782,7 @@ test9 (GError **error)
        if (!emitted_signals_check_empty (NULL, "source-changed", error))
                return FALSE;
        if ((gda_holder_get_source_model (h, &col) != model) || (col != 0)) {
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "GdaHolder's source is wrong");
                return FALSE;
        }
@@ -796,7 +796,7 @@ test9 (GError **error)
                return FALSE;
 
        if (gda_holder_get_source_model (h, NULL)) {
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "GdaHolder's source should be NULL");
                return FALSE;
        }
@@ -824,7 +824,7 @@ t10_validate_change_cb (GdaHolder *h, const GValue *value, gchar *token)
        else {
                GError *error = NULL;
                g_print ("GdaHolder change refused\n");
-               g_set_error (&error, 0, 0,
+               g_set_error (&error, TEST_ERROR, TEST_ERROR_GENERIC,
                             "%s", "GdaHolder change refused!");
                return error;
        }
@@ -859,7 +859,7 @@ test10 (GError **error)
        value = gda_value_new_from_string ("my other string", G_TYPE_STRING);
        emitted_signals_reset ();
        if (gda_holder_set_value (h, value, error)) {
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "GdaHolder's change should have failed");
                return FALSE;
        }
@@ -871,7 +871,7 @@ test10 (GError **error)
        value = gda_value_new_from_string ("my string", G_TYPE_STRING);
        cvalue = gda_holder_get_value (h);
        if (!cvalue || gda_value_differ (value, cvalue)) {
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "GdaHolder's value is incorrect");
                return FALSE;
        }
@@ -891,7 +891,7 @@ test10 (GError **error)
        /***/
        cvalue = gda_holder_get_value (h);
        if (!cvalue || gda_value_differ (value, cvalue)) {
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "GdaHolder's value is incorrect");
                return FALSE;
        }
@@ -916,7 +916,7 @@ test11 (GError **error)
        value = gda_value_new_from_string ("my string", G_TYPE_STRING);
        emitted_signals_reset ();
        if (gda_holder_set_value (h, value, NULL)) {
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "GdaHolder's change should have failed");
                return FALSE;
        }
@@ -944,7 +944,7 @@ test11 (GError **error)
        /***/
        cvalue = gda_holder_get_value (h);
        if (!cvalue || gda_value_differ (value, cvalue)) {
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "GdaHolder's value is incorrect");
                return FALSE;
        }
@@ -967,7 +967,7 @@ test12 (GError **error)
        /***/
        value = gda_value_new_from_string ("my string", G_TYPE_STRING);
        if (gda_holder_get_attribute (h, "attname1")) {
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "gda_holder_get_attribute() should have retunred NULL");
                return FALSE;
        }
@@ -975,13 +975,13 @@ test12 (GError **error)
        gda_value_free (value);
        cvalue = gda_holder_get_attribute (h, "attname1");
        if (!cvalue) {
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "gda_holder_get_attribute() should have retunred a value");
                return FALSE;
        }
        value = gda_value_new_from_string ("my string", G_TYPE_STRING);
        if (gda_value_differ (cvalue, value)) {
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "gda_holder_get_attribute() retunred a wrong value");
                return FALSE;
        }
@@ -994,12 +994,12 @@ test12 (GError **error)
        copy = gda_holder_copy (h);
        cvalue = gda_holder_get_attribute (copy, "attname1");
        if (!cvalue) {
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "gda_holder_get_attribute() should have retunred a value");
                return FALSE;
        }
        if (gda_value_differ (cvalue, value)) {
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "gda_holder_get_attribute() retunred a wrong value");
                return FALSE;
        }
@@ -1007,7 +1007,7 @@ test12 (GError **error)
 
        g_object_get (G_OBJECT (copy), "name", &name, NULL);
        if (strcmp (name, "thename")) {
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "gda_holder_copy() did not copy the name");
                return FALSE;
        }
@@ -1033,7 +1033,7 @@ test13 (GError **error)
        }
        g_object_set (h2, "g-type", G_TYPE_STRING, NULL);
        if (gda_holder_get_g_type (h1) != G_TYPE_STRING) {
-               g_set_error (error, 0, 0,
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC,
                             "%s", "Bind-to holder type set did not propagate to holder's type, case 1");
                g_object_unref (h1);
                g_object_unref (h2);
@@ -1051,7 +1051,7 @@ test13 (GError **error)
                return FALSE;
        }
        if (gda_holder_get_g_type (h1) != G_TYPE_INT) {
-               g_set_error (error, 0, 0,
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC,
                             "%s", "Bind-to holder type set did not propagate to holder's type, case 2");
                g_object_unref (h1);
                g_object_unref (h2);
@@ -1070,14 +1070,14 @@ test13 (GError **error)
        }
        g_object_set (h2, "g-type", G_TYPE_STRING, NULL);
        if (gda_holder_get_g_type (h1) != G_TYPE_STRING) {
-               g_set_error (error, 0, 0,
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC,
                             "%s", "Holder type changed when it should not have, case 1");
                g_object_unref (h1);
                g_object_unref (h2);
                return FALSE;
        }
        if (gda_holder_get_bind (h1) != h2) {
-               g_set_error (error, 0, 0,
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC,
                             "%s", "Bind broken when it should not have been");
                g_object_unref (h1);
                g_object_unref (h2);
@@ -1096,14 +1096,14 @@ test13 (GError **error)
        }
        g_object_set (h2, "g-type", G_TYPE_INT, NULL);
        if (gda_holder_get_g_type (h1) != G_TYPE_STRING) {
-               g_set_error (error, 0, 0,
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC,
                             "%s", "Holder type changed when it should not have, case 2");
                g_object_unref (h1);
                g_object_unref (h2);
                return FALSE;
        }
        if (gda_holder_get_bind (h1) == h2) {
-               g_set_error (error, 0, 0,
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC,
                             "%s", "Bind not broken when it should have been");
                g_object_unref (h1);
                g_object_unref (h2);
@@ -1143,7 +1143,7 @@ emitted_signals_find (gpointer obj, const gchar *signal_name, GError **error)
                        return TRUE;
                }
        }
-       g_set_error (error, 0, 0,
+       g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC,
                     "Signal \"%s\" has not been emitted", signal_name);
        g_object_unref (obj);
        return FALSE;
@@ -1157,7 +1157,7 @@ emitted_signals_notfind (gpointer obj, const gchar *signal_name, GError **error)
                EmittedSignal *es = (EmittedSignal *) list->data;
                if ((es->obj == obj) && (!strcmp (es->signal_name, signal_name))) {
                        signals_list = g_slist_delete_link (signals_list, list);
-                       g_set_error (error, 0, 0,
+                       g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC,
                                     "Signal \"%s\" has been emitted", signal_name);
                        g_object_unref (obj);
 
@@ -1175,7 +1175,7 @@ emitted_signals_check_empty (gpointer obj, const gchar *signal_name, GError **er
                EmittedSignal *es = (EmittedSignal *) list->data;
                if ((!obj || (es->obj == obj)) && 
                    (!signal_name || (!strcmp (es->signal_name, signal_name)))) {
-                       g_set_error (error, 0, 0,
+                       g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC,
                                     "Signal \"%s\" has been emitted", es->signal_name);
                        emitted_signals_reset ();
                        return FALSE;
diff --git a/tests/value-holders/check_set.c b/tests/value-holders/check_set.c
index f7c44bb..4650c1d 100644
--- a/tests/value-holders/check_set.c
+++ b/tests/value-holders/check_set.c
@@ -133,7 +133,7 @@ test2 (GError **error)
 
        h = gda_set_get_holder (set, "H1");
        if (!h) {
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "Could not find GdaHolder H1");
                return FALSE;
        }
@@ -191,7 +191,7 @@ t3_validate_holder_change (GdaSet *set, GdaHolder *h, const GValue *value, gchar
                else {
                        GError *error = NULL;
                        g_print ("GdaHolder change refused\n");
-                       g_set_error (&error, 0, 0,
+                       g_set_error (&error, TEST_ERROR, TEST_ERROR_GENERIC,
                                     "%s", "GdaHolder change refused!");
                        return error;
                }
@@ -221,18 +221,18 @@ test3 (GError **error)
        h = gda_set_get_holder (set, "H2");
        g_value_set_int ((value = gda_value_new (G_TYPE_INT)), 333);
        if (gda_holder_set_value (h, value, &lerror)) {
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "gda_holder_set_value() should have been refused and failed");
                return FALSE;
        }
        gda_value_free (value);
        if (!lerror) {
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "Returned GError should not be NULL");
                return FALSE;
        }
        if (strcmp (lerror->message, "GdaHolder change refused!")) {
-               g_set_error (error, 0, 0,
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC,
                             "Returned GError's message is wrong, should be 'GdaHolder change refused!' and 
is '%s'",
                             lerror->message);
                return FALSE;
@@ -244,7 +244,7 @@ test3 (GError **error)
        g_value_set_int ((value = gda_value_new (G_TYPE_INT)), 1234);
        cvalue = gda_set_get_holder_value (set, "H2");
        if (!cvalue || gda_value_differ (value, cvalue)) {
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "GdaHolder's value is incorrect");
                return FALSE;
        }
@@ -257,7 +257,7 @@ test3 (GError **error)
        
        /***/cvalue = gda_set_get_holder_value (set, "H2");
        if (!cvalue || gda_value_differ (value, cvalue)) {
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "GdaHolder's value is incorrect");
                return FALSE;
        }
@@ -288,7 +288,7 @@ test4 (GError **error)
 
        h = gda_set_get_holder (set, "H1");
        if (!h) {
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "Could not find GdaHolder H1");
                return FALSE;
        }
@@ -330,7 +330,7 @@ t5_validate_change (GdaSet *set, gchar *token)
        else {
                GError *error = NULL;
                g_print ("GdaSet change refused\n");
-               g_set_error (&error, 0, 0,
+               g_set_error (&error, TEST_ERROR, TEST_ERROR_GENERIC,
                             "%s", "GdaSet change refused!");
                return error;
        }
@@ -353,18 +353,18 @@ test5 (GError **error)
                          G_CALLBACK (t5_validate_change), "MyToken2");
 
        if (gda_set_is_valid (set, &lerror)) {
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "gda_set_is_valid() should have returned FALSE");
                return FALSE;
        }
 
        if (!lerror) {
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "Returned GError should not be NULL");
                return FALSE;
        }
        if (strcmp (lerror->message, "GdaSet change refused!")) {
-               g_set_error (error, 0, 0,
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC,
                             "Returned GError's message is wrong, should be 'GdaHolder change refused!' and 
is '%s'",
                             lerror->message);
                return FALSE;
@@ -376,7 +376,7 @@ test5 (GError **error)
        h = gda_set_get_holder (set, "H2");
        g_value_set_int ((value = gda_value_new (G_TYPE_INT)), 125);
        if (!gda_holder_set_value (h, value, NULL)) {
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "gda_holder_set_value() should not have failed");
                return FALSE;
        }
@@ -385,7 +385,7 @@ test5 (GError **error)
        h = gda_set_get_holder (set, "H3");
        g_value_set_char ((value = gda_value_new (G_TYPE_CHAR)), 'd');
        if (!gda_holder_set_value (h, value, NULL)) {
-               g_set_error (error, 0, 0, "%s", 
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "%s", 
                             "gda_holder_set_value() should not have failed");
                return FALSE;
        }
@@ -428,7 +428,7 @@ emitted_signals_find (gpointer obj, const gchar *signal_name, GError **error)
                        return TRUE;
                }
        }
-       g_set_error (error, 0, 0,
+       g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC,
                     "Signal \"%s\" has not been emitted", signal_name);
        g_object_unref (obj);
        return FALSE;
@@ -443,7 +443,7 @@ emitted_signals_notfind (gpointer obj, const gchar *signal_name, GError **error)
                EmittedSignal *es = (EmittedSignal *) list->data;
                if ((es->obj == obj) && (!strcmp (es->signal_name, signal_name))) {
                        signals_list = g_slist_delete_link (signals_list, list);
-                       g_set_error (error, 0, 0,
+                       g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC,
                                     "Signal \"%s\" has been emitted", signal_name);
                        g_object_unref (obj);
 
@@ -462,7 +462,7 @@ emitted_signals_check_empty (gpointer obj, const gchar *signal_name, GError **er
                EmittedSignal *es = (EmittedSignal *) list->data;
                if ((!obj || (es->obj == obj)) && 
                    (!signal_name || (!strcmp (es->signal_name, signal_name)))) {
-                       g_set_error (error, 0, 0,
+                       g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC,
                                     "Signal \"%s\" has been emitted", es->signal_name);
                        emitted_signals_reset ();
                        return FALSE;
diff --git a/tests/value-holders/check_statement.c b/tests/value-holders/check_statement.c
index 59eeba3..b4866c3 100644
--- a/tests/value-holders/check_statement.c
+++ b/tests/value-holders/check_statement.c
@@ -163,7 +163,7 @@ test2 (GError **error)
        
        fname = g_build_filename (ROOT_DIR, "tests", "parser", "testdata.xml", NULL);
        if (! g_file_test (fname, G_FILE_TEST_EXISTS)) {
-                g_set_error (error, 0, 0, "File '%s' does not exist\n", fname);
+                g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC, "File '%s' does not exist\n", fname);
                return FALSE;
         }
        doc = xmlParseFile (fname);
@@ -242,7 +242,7 @@ test2 (GError **error)
                        gda_sql_statement_free (sqlst);
                        
                        if (strcmp (ser1, ser2)) {
-                               g_set_error (error, 0, 0,
+                               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC,
                                             "Statement failed, ID: %s\nSQL: %s\nSER1: %s\nSER2 :%s", 
                                             id, rsql, ser1, ser2);
                                g_free (ser1);
diff --git a/tests/value-holders/common.c b/tests/value-holders/common.c
index 3ca9e68..ee07ae3 100644
--- a/tests/value-holders/common.c
+++ b/tests/value-holders/common.c
@@ -355,7 +355,7 @@ tests_common_check_holder (GHashTable *data, const gchar *id, GdaHolder *h, GErr
                JsonParser *jparser;
                jparser = json_parser_new ();
                if (!json_parser_load_from_data (jparser, s, -1, NULL)) 
-                       g_set_error (error, 0, 0,
+                       g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC,
                                     "Unknown ID '%s', GdaHolder is: %s (JSON INVALID)\n", id, s);
                else {
                        JsonGenerator *jgen;
@@ -364,7 +364,7 @@ tests_common_check_holder (GHashTable *data, const gchar *id, GdaHolder *h, GErr
                        g_object_set (G_OBJECT (jgen), "pretty", TRUE, "indent", 5, NULL);
                        json_generator_set_root (jgen, json_parser_get_root (jparser));
                        out = json_generator_to_data (jgen, NULL);
-                       g_set_error (error, 0, 0,
+                       g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC,
                                     "Unknown ID '%s', GdaHolder is: %s\nJSON: %s\n", id, s, out);
                        g_print ("%s\n", out);
                        g_free (out);
@@ -372,7 +372,7 @@ tests_common_check_holder (GHashTable *data, const gchar *id, GdaHolder *h, GErr
                }
                g_object_unref (jparser);
 #else
-               g_set_error (error, 0, 0,
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC,
                             "Unknown ID '%s', GdaHolder is: %s\n", id, s);
 #endif
 
@@ -382,7 +382,7 @@ tests_common_check_holder (GHashTable *data, const gchar *id, GdaHolder *h, GErr
        }
 
        if (strcmp (got, s)) {
-               g_set_error (error, 0, 0,
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC,
                             "GdaHolder error:\nexp: %s\ngot: %s\n", got, s);
                g_free (s);
                g_object_unref (h);
@@ -407,7 +407,7 @@ tests_common_check_set (GHashTable *data, const gchar *id, GdaSet *set, GError *
                JsonParser *jparser;
                jparser = json_parser_new ();
                if (!json_parser_load_from_data (jparser, s, -1, NULL)) 
-                       g_set_error (error, 0, 0,
+                       g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC,
                                     "Unknown ID '%s', GdaSet is: %s (JSON INVALID)\n", id, s);
                else {
                        JsonGenerator *jgen;
@@ -416,14 +416,14 @@ tests_common_check_set (GHashTable *data, const gchar *id, GdaSet *set, GError *
                        g_object_set (G_OBJECT (jgen), "pretty", TRUE, "indent", 5, NULL);
                        json_generator_set_root (jgen, json_parser_get_root (jparser));
                        out = json_generator_to_data (jgen, NULL);
-                       g_set_error (error, 0, 0,
+                       g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC,
                                     "Unknown ID '%s', GdaSet is: %s\nJSON: %s\n", id, s, out);
                        g_free (out);
                        g_object_unref (jgen);
                }
                g_object_unref (jparser);
 #else
-               g_set_error (error, 0, 0,
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC,
                             "Unknown ID '%s', GdaSet is: %s\n", id, s);
 #endif
 
@@ -433,7 +433,7 @@ tests_common_check_set (GHashTable *data, const gchar *id, GdaSet *set, GError *
        }
 
        if (strcmp (got, s)) {
-               g_set_error (error, 0, 0,
+               g_set_error (error, TEST_ERROR, TEST_ERROR_GENERIC,
                             "GdaSet error:\nexp: %s\ngot: %s\n", got, s);
                g_free (s);
                g_object_unref (set);
diff --git a/tests/value-holders/common.h b/tests/value-holders/common.h
index 1c65dc6..9ca4348 100644
--- a/tests/value-holders/common.h
+++ b/tests/value-holders/common.h
@@ -17,6 +17,7 @@
  */
 #include <libgda/libgda.h>
 #include <string.h>
+#include "../test-errors.h"
 
 #ifndef _COMMON_H_
 #define _COMMON_H_


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