GnuCash c935c2f+
Loading...
Searching...
No Matches
test-engine-stuff.h
Go to the documentation of this file.
1
4/********************************************************************\
5 * This program is free software; you can redistribute it and/or *
6 * modify it under the terms of the GNU General Public License as *
7 * published by the Free Software Foundation; either version 2 of *
8 * the License, or (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License*
16 * along with this program; if not, contact: *
17 * *
18 * Free Software Foundation Voice: +1-617-542-5942 *
19 * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
20 * Boston, MA 02110-1301, USA gnu@gnu.org *
21 * *
22\********************************************************************/
23
24
25#ifndef TEST_ENGINE_STUFF_H
26#define TEST_ENGINE_STUFF_H
27
28#include <glib.h>
29#include <stdlib.h>
30#include <stdint.h>
31
32#include "qof.h"
33#include "Query.h"
34#include "gnc-pricedb.h"
35#include "SchedXaction.h"
36
37#ifndef __KVP_VALUE
38typedef struct KvpValueImpl KvpValue;
39#define __KVP_VALUE
40#endif
41#ifndef __KVP_FRAME
42typedef struct KvpFrameImpl KvpFrame;
43#define __KVP_FRAME
44#endif
45
46#ifdef __cplusplus
47extern "C"
48{
49#endif
50time64 get_random_time(void);
51
52KvpValue* get_random_kvp_value(int type);
53
54typedef struct
55{
56 guchar *data;
57 int len;
58} bin_data;
59
60bin_data* get_random_binary_data(void);
61
62KvpFrame* get_random_kvp_frame(void);
63gnc_numeric get_random_gnc_numeric(int64_t);
64GncGUID* get_random_guid(void);
65
66void set_max_kvp_depth (gint max_kvp_depth);
67void set_max_kvp_frame_elements (gint max_kvp_frame_elements);
68void set_max_account_tree_depth (gint max_tree_depth);
69void set_max_accounts_per_level (gint max_accounts);
70
71GNCPrice * get_random_price(QofBook *book);
72gboolean make_random_pricedb (QofBook *book, GNCPriceDB *pdb);
73GNCPriceDB * get_random_pricedb(QofBook *book);
74Account * get_random_account_tree(QofBook * book);
75Account* get_random_account(QofBook * book);
76Split* get_random_split(QofBook *book, Account *account, Transaction *trn);
77Transaction* get_random_transaction(QofBook *book);
78Transaction* get_random_transaction_with_currency(QofBook *book,
79 gnc_commodity *currency,
80 GList *account_list);
81gnc_commodity* get_random_commodity(QofBook *book);
82const char *get_random_commodity_namespace(void);
83
84typedef enum
85{
86 RANDOM_QT = 0,
87 SIMPLE_QT = 1 << 0,
88 ACCOUNT_QT = 1 << 1,
89 SPLIT_KVP_QT = 1 << 2,
90 TRANS_KVP_QT = 1 << 3,
91 ACCOUNT_KVP_QT = 1 << 4,
92 GUID_QT = 1 << 5,
93 ALL_QT = (1 << 8) - 1
94} TestQueryTypes;
95
96QofQuery * get_random_query(void);
97QofQuery * make_trans_query (Transaction *trans, TestQueryTypes query_types);
98TestQueryTypes get_random_query_type (void);
99void trans_query_include_price (gboolean include_amounts);
100
101QofBook * get_random_book (void);
102QofSession * get_random_session (void);
103
104void add_random_transactions_to_book (QofBook *book, gint num_transactions);
105
106void make_random_changes_to_commodity (gnc_commodity *com);
107void make_random_changes_to_commodity_table (gnc_commodity_table *table);
108void make_random_changes_to_price (QofBook *book, GNCPrice *price);
109void make_random_changes_to_pricedb (QofBook *book, GNCPriceDB *pdb);
110void make_random_changes_to_split (Split *split);
111void make_random_changes_to_transaction (QofBook *book,
112 Transaction *trans);
113void make_random_changes_to_transaction_and_splits (QofBook *book,
114 Transaction *trans,
115 GList *accounts);
116void make_random_changes_to_account (QofBook *book, Account *account);
117void make_random_changes_to_level (QofBook *book, Account *parent);
118void make_random_changes_to_book (QofBook *book);
119void make_random_changes_to_session (QofSession *session);
120
121SchedXaction* add_daily_sx(const gchar *name, const GDate *start,
122 const GDate *end, const GDate *last_occur);
123SchedXaction* add_once_sx(const gchar *name, const GDate *when);
124void remove_sx(SchedXaction *sx);
125
126#ifdef __cplusplus
127}
128#endif
129#endif
Scheduled Transactions public handling routines.
a simple price database for gnucash
gint64 time64
Most systems that are currently maintained, including Microsoft Windows, BSD-derived Unixes and Linux...
Definition gnc-date.h:87
STRUCTS.
The type used to store guids in C.
Definition guid.h:75
Implements KvpFrame.
Implements KvpValue using boost::variant.
Definition kvp-value.hpp:53
QofBook reference.
Definition qofbook-p.hpp:47
A Query.
Definition qofquery.cpp:75