~siretart/gnucash/ubuntu-fullsource

« back to all changes in this revision

Viewing changes to src/engine/test/test-querynew.c

  • Committer: Reinhard Tartler
  • Date: 2008-08-03 07:25:46 UTC
  • Revision ID: siretart@tauware.de-20080803072546-y6p8xda8zpfi62ys
import gnucash_2.2.4.orig.tar.gz

The original tarball had the md5sum: 27e660297dc5b8ce574515779d05a5a5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
 *            test-querynew.c
 
3
 *
 
4
 *  Tue Sep 27 19:18:57 2005
 
5
 *  Copyright  2005  GnuCash team
 
6
 ****************************************************************************/
 
7
/*
 
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.
 
12
 *
 
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.
 
17
 *
 
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
 
21
 *  02110-1301, USA.
 
22
 */
 
23
 
 
24
#include "config.h"
 
25
#include <glib.h>
 
26
#include <stdio.h>
 
27
#include "qof.h"
 
28
#include "cashobjects.h"
 
29
#include "test-stuff.h"
 
30
 
 
31
#define TEST_MODULE_NAME        "TestModuleName"
 
32
#define TEST_CORE               "TestCoreType"
 
33
#define TEST_PARAM              "test-param"
 
34
#define BAD_PARAM               "bad-param"
 
35
 
 
36
static int test_sort (gpointer a, gpointer b)
 
37
{
 
38
  return 0;
 
39
}
 
40
 
 
41
static int test_core_param (gpointer a)
 
42
{
 
43
  return 0;
 
44
}
 
45
 
 
46
static void test_class (void)
 
47
{
 
48
  static QofParam params[] = {
 
49
    { TEST_PARAM, TEST_CORE, (QofAccessFunc)test_core_param, NULL },
 
50
    { NULL },
 
51
  };
 
52
 
 
53
  fprintf (stderr, "\tTesting the qof_query_object interface. \n"
 
54
           "\tYou may see some \"** CRITICAL **\" messages, which you can safely ignore\n");
 
55
 
 
56
  qof_class_register (TEST_MODULE_NAME, (QofSortFunc)test_sort, params);
 
57
 
 
58
  do_test (qof_class_get_parameter (TEST_MODULE_NAME, TEST_PARAM)
 
59
           == &params[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)");
 
68
 
 
69
  do_test (qof_class_get_parameter_getter (TEST_MODULE_NAME, TEST_PARAM)
 
70
           == (QofAccessFunc)test_core_param,
 
71
           "qof_class_get_parameter_getter");
 
72
 
 
73
  do_test (safe_strcmp (qof_class_get_parameter_type (TEST_MODULE_NAME,
 
74
                                                     TEST_PARAM),
 
75
                        TEST_CORE) == 0, "qof_class_get_parameter_type");
 
76
 
 
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)");*/
 
81
}
 
82
 
 
83
static void test_query_core (void)
 
84
{
 
85
 
 
86
}
 
87
 
 
88
static void test_querynew (void)
 
89
{
 
90
}
 
91
 
 
92
int
 
93
main (int argc, char **argv)
 
94
{
 
95
     qof_init();
 
96
     if(cashobjects_register()) {
 
97
          test_query_core();
 
98
          test_class();
 
99
          test_querynew();
 
100
     }
 
101
     qof_close();
 
102
     print_test_results();
 
103
     return get_rv();
 
104
}