2005-11-01 21:32:36 -06:00
|
|
|
/***************************************************************************
|
|
|
|
* test-querynew.c
|
|
|
|
*
|
|
|
|
* Tue Sep 27 19:18:57 2005
|
|
|
|
* Copyright 2005 GnuCash team
|
|
|
|
****************************************************************************/
|
|
|
|
/*
|
|
|
|
* 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
|
2005-11-16 23:35:02 -06:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
|
|
* 02110-1301, USA.
|
2005-11-01 21:32:36 -06:00
|
|
|
*/
|
2010-02-17 23:31:54 -06:00
|
|
|
|
2017-10-26 04:14:21 -05:00
|
|
|
#include <config.h>
|
2002-02-03 19:55:33 -06:00
|
|
|
#include <glib.h>
|
2003-09-12 08:17:26 -05:00
|
|
|
#include <stdio.h>
|
2012-04-03 16:35:19 -05:00
|
|
|
#include <qof.h>
|
|
|
|
#include <test-stuff.h>
|
|
|
|
#include <unittest-support.h>
|
|
|
|
#include "../cashobjects.h"
|
2002-02-03 19:55:33 -06:00
|
|
|
|
|
|
|
#define TEST_MODULE_NAME "TestModuleName"
|
|
|
|
#define TEST_CORE "TestCoreType"
|
|
|
|
#define TEST_PARAM "test-param"
|
|
|
|
#define BAD_PARAM "bad-param"
|
|
|
|
|
|
|
|
static int test_sort (gpointer a, gpointer b)
|
|
|
|
{
|
2010-02-17 23:31:54 -06:00
|
|
|
return 0;
|
2002-02-03 19:55:33 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
static int test_core_param (gpointer a)
|
|
|
|
{
|
2010-02-17 23:31:54 -06:00
|
|
|
return 0;
|
2002-02-03 19:55:33 -06:00
|
|
|
}
|
|
|
|
|
2003-09-27 11:33:06 -05:00
|
|
|
static void test_class (void)
|
2002-02-03 19:55:33 -06:00
|
|
|
{
|
2010-02-17 23:31:54 -06:00
|
|
|
static QofParam params[] =
|
|
|
|
{
|
|
|
|
{ TEST_PARAM, TEST_CORE, (QofAccessFunc)test_core_param, NULL },
|
|
|
|
{ NULL },
|
|
|
|
};
|
2002-02-03 19:55:33 -06:00
|
|
|
|
2011-12-04 18:08:01 -06:00
|
|
|
gchar *msg1 = "qof_class_get_parameter: assertion `obj_name' failed";
|
|
|
|
gchar *msg2 = "qof_class_get_parameter: assertion `parameter' failed";
|
|
|
|
gchar *logdomain = "qof";
|
|
|
|
guint loglevel = G_LOG_LEVEL_CRITICAL;
|
|
|
|
TestErrorStruct check1 = { loglevel, logdomain, msg1 };
|
|
|
|
TestErrorStruct check2 = { loglevel, logdomain, msg2 };
|
|
|
|
test_add_error (&check1);
|
|
|
|
test_add_error (&check2);
|
|
|
|
g_log_set_handler (logdomain, loglevel,
|
2012-01-01 14:36:46 -06:00
|
|
|
(GLogFunc)test_list_handler, NULL);
|
2011-12-04 18:08:01 -06:00
|
|
|
|
2002-10-17 19:32:50 -05:00
|
|
|
|
2010-02-17 23:31:54 -06:00
|
|
|
qof_class_register (TEST_MODULE_NAME, (QofSortFunc)test_sort, params);
|
2002-02-03 19:55:33 -06:00
|
|
|
|
2010-02-17 23:31:54 -06:00
|
|
|
do_test (qof_class_get_parameter (TEST_MODULE_NAME, TEST_PARAM)
|
|
|
|
== ¶ms[0], "qof_class_get_parameter");
|
|
|
|
do_test (qof_class_get_parameter (NULL, NULL) == NULL,
|
|
|
|
"qof_class_get_parameter (NULL, NULL)");
|
|
|
|
do_test (qof_class_get_parameter (TEST_MODULE_NAME, NULL) == NULL,
|
|
|
|
"qof_class_get_parameter (TEST_MODULE_NAME, NULL)");
|
|
|
|
do_test (qof_class_get_parameter (TEST_MODULE_NAME, BAD_PARAM) == NULL,
|
|
|
|
"qof_class_get_parameter (TEST_MODULE_NAME, BAD_PARAM)");
|
|
|
|
do_test (qof_class_get_parameter (NULL, TEST_PARAM) == NULL,
|
|
|
|
"qof_class_get_parameter (NULL, TEST_PARAM)");
|
2002-02-03 19:55:33 -06:00
|
|
|
|
2010-02-17 23:31:54 -06:00
|
|
|
do_test (qof_class_get_parameter_getter (TEST_MODULE_NAME, TEST_PARAM)
|
|
|
|
== (QofAccessFunc)test_core_param,
|
|
|
|
"qof_class_get_parameter_getter");
|
2002-02-03 19:55:33 -06:00
|
|
|
|
2012-08-07 12:24:55 -05:00
|
|
|
do_test (g_strcmp0 (qof_class_get_parameter_type (TEST_MODULE_NAME,
|
2013-10-31 17:23:28 -05:00
|
|
|
TEST_PARAM),
|
|
|
|
TEST_CORE) == 0, "qof_class_get_parameter_type");
|
2002-02-03 19:55:33 -06:00
|
|
|
|
2010-02-17 23:31:54 -06:00
|
|
|
/* do_test (qof_class_get_default_sort (TEST_MODULE_NAME) == test_sort,
|
|
|
|
"qof_class_get_default_sort");
|
|
|
|
do_test (qof_class_get_default_sort (NULL) == NULL,
|
|
|
|
"qof_class_get_default_sort (NULL)");*/
|
2011-12-04 18:08:01 -06:00
|
|
|
test_clear_error_list ();
|
2002-02-03 19:55:33 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
static void test_query_core (void)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_querynew (void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2005-11-01 21:32:36 -06:00
|
|
|
int
|
|
|
|
main (int argc, char **argv)
|
2002-02-03 19:55:33 -06:00
|
|
|
{
|
2010-02-17 23:31:54 -06:00
|
|
|
qof_init();
|
|
|
|
if (cashobjects_register())
|
|
|
|
{
|
|
|
|
test_query_core();
|
|
|
|
test_class();
|
|
|
|
test_querynew();
|
|
|
|
}
|
|
|
|
qof_close();
|
|
|
|
print_test_results();
|
|
|
|
return get_rv();
|
2002-02-03 19:55:33 -06:00
|
|
|
}
|