1
/***************************************************************************
4
* Tue Sep 27 19:18:57 2005
5
* Copyright 2005 GnuCash team
6
****************************************************************************/
8
* This program is free software; you can redistribute it and/or modify
9
* it under the terms of the GNU General Public License as published by
10
* the Free Software Foundation; either version 2 of the License, or
11
* (at your option) any later version.
13
* This program is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
18
* You should have received a copy of the GNU General Public License
19
* along with this program; if not, write to the Free Software
20
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
28
#include "cashobjects.h"
29
#include "test-stuff.h"
31
#define TEST_MODULE_NAME "TestModuleName"
32
#define TEST_CORE "TestCoreType"
33
#define TEST_PARAM "test-param"
34
#define BAD_PARAM "bad-param"
36
static int test_sort (gpointer a, gpointer b)
41
static int test_core_param (gpointer a)
46
static void test_class (void)
48
static QofParam params[] = {
49
{ TEST_PARAM, TEST_CORE, (QofAccessFunc)test_core_param, NULL },
53
fprintf (stderr, "\tTesting the qof_query_object interface. \n"
54
"\tYou may see some \"** CRITICAL **\" messages, which you can safely ignore\n");
56
qof_class_register (TEST_MODULE_NAME, (QofSortFunc)test_sort, params);
58
do_test (qof_class_get_parameter (TEST_MODULE_NAME, TEST_PARAM)
59
== ¶ms[0], "qof_class_get_parameter");
60
do_test (qof_class_get_parameter (NULL, NULL) == NULL,
61
"qof_class_get_parameter (NULL, NULL)");
62
do_test (qof_class_get_parameter (TEST_MODULE_NAME, NULL) == NULL,
63
"qof_class_get_parameter (TEST_MODULE_NAME, NULL)");
64
do_test (qof_class_get_parameter (TEST_MODULE_NAME, BAD_PARAM) == NULL,
65
"qof_class_get_parameter (TEST_MODULE_NAME, BAD_PARAM)");
66
do_test (qof_class_get_parameter (NULL, TEST_PARAM) == NULL,
67
"qof_class_get_parameter (NULL, TEST_PARAM)");
69
do_test (qof_class_get_parameter_getter (TEST_MODULE_NAME, TEST_PARAM)
70
== (QofAccessFunc)test_core_param,
71
"qof_class_get_parameter_getter");
73
do_test (safe_strcmp (qof_class_get_parameter_type (TEST_MODULE_NAME,
75
TEST_CORE) == 0, "qof_class_get_parameter_type");
77
/* do_test (qof_class_get_default_sort (TEST_MODULE_NAME) == test_sort,
78
"qof_class_get_default_sort");
79
do_test (qof_class_get_default_sort (NULL) == NULL,
80
"qof_class_get_default_sort (NULL)");*/
83
static void test_query_core (void)
88
static void test_querynew (void)
93
main (int argc, char **argv)
96
if(cashobjects_register()) {
102
print_test_results();