GnuCash  5.6-150-g038405b370+
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
38 typedef struct KvpValueImpl KvpValue;
39 #define __KVP_VALUE
40 #endif
41 #ifndef __KVP_FRAME
42 typedef struct KvpFrameImpl KvpFrame;
43 #define __KVP_FRAME
44 #endif
45 
46 #ifdef __cplusplus
47 extern "C"
48 {
49 #endif
50 time64 get_random_time(void);
51 
52 KvpValue* get_random_kvp_value(int type);
53 
54 typedef struct
55 {
56  guchar *data;
57  int len;
58 } bin_data;
59 
60 bin_data* get_random_binary_data(void);
61 
62 KvpFrame* get_random_kvp_frame(void);
63 gnc_numeric get_random_gnc_numeric(int64_t);
64 GncGUID* get_random_guid(void);
65 
66 void set_max_kvp_depth (gint max_kvp_depth);
67 void set_max_kvp_frame_elements (gint max_kvp_frame_elements);
68 void set_max_account_tree_depth (gint max_tree_depth);
69 void set_max_accounts_per_level (gint max_accounts);
70 
71 GNCPrice * get_random_price(QofBook *book);
72 gboolean make_random_pricedb (QofBook *book, GNCPriceDB *pdb);
73 GNCPriceDB * get_random_pricedb(QofBook *book);
74 Account * get_random_account_tree(QofBook * book);
75 Account* get_random_account(QofBook * book);
76 Split* get_random_split(QofBook *book, Account *account, Transaction *trn);
77 Transaction* get_random_transaction(QofBook *book);
78 Transaction* get_random_transaction_with_currency(QofBook *book,
79  gnc_commodity *currency,
80  GList *account_list);
81 gnc_commodity* get_random_commodity(QofBook *book);
82 const char *get_random_commodity_namespace(void);
83 
84 typedef 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 
96 QofQuery * get_random_query(void);
97 QofQuery * make_trans_query (Transaction *trans, TestQueryTypes query_types);
98 TestQueryTypes get_random_query_type (void);
99 void trans_query_include_price (gboolean include_amounts);
100 
101 QofBook * get_random_book (void);
102 QofSession * get_random_session (void);
103 
104 void add_random_transactions_to_book (QofBook *book, gint num_transactions);
105 
106 void make_random_changes_to_commodity (gnc_commodity *com);
107 void make_random_changes_to_commodity_table (gnc_commodity_table *table);
108 void make_random_changes_to_price (QofBook *book, GNCPrice *price);
109 void make_random_changes_to_pricedb (QofBook *book, GNCPriceDB *pdb);
110 void make_random_changes_to_split (Split *split);
111 void make_random_changes_to_transaction (QofBook *book,
112  Transaction *trans);
113 void make_random_changes_to_transaction_and_splits (QofBook *book,
114  Transaction *trans,
115  GList *accounts);
116 void make_random_changes_to_account (QofBook *book, Account *account);
117 void make_random_changes_to_level (QofBook *book, Account *parent);
118 void make_random_changes_to_book (QofBook *book);
119 void make_random_changes_to_session (QofSession *session);
120 
121 SchedXaction* add_daily_sx(const gchar *name, const GDate *start,
122  const GDate *end, const GDate *last_occur);
123 SchedXaction* add_once_sx(const gchar *name, const GDate *when);
124 void remove_sx(SchedXaction *sx);
125 
126 #ifdef __cplusplus
127 }
128 #endif
129 #endif
Implements KvpFrame.
Definition: kvp-frame.hpp:109
a simple price database for gnucash
STRUCTS.
Implements KvpValue using boost::variant.
Definition: kvp-value.hpp:52
gint64 time64
Most systems that are currently maintained, including Microsoft Windows, BSD-derived Unixes and Linux...
Definition: gnc-date.h:87
Scheduled Transactions public handling routines.
The type used to store guids in C.
Definition: guid.h:75
A Query.
Definition: qofquery.cpp:74