GnuCash  2.6.99
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
test-engine-stuff.h
Go to the documentation of this file.
1 
5 #ifndef TEST_ENGINE_STUFF_H
6 #define TEST_ENGINE_STUFF_H
7 
8 #include <glib.h>
9 #include <stdlib.h>
10 #include <stdint.h>
11 
12 #include "qof.h"
13 #include "Query.h"
14 #include "gnc-pricedb.h"
15 #include "SchedXaction.h"
16 
17 Timespec* get_random_timespec(void);
18 void random_timespec_zero_nsec (gboolean zero_nsec);
19 void random_timespec_usec_resolution (gboolean usec_resolution);
20 
21 KvpValue* get_random_kvp_value(int type);
22 
23 typedef struct
24 {
25  guchar *data;
26  int len;
27 } bin_data;
28 
29 bin_data* get_random_binary_data(void);
30 
31 KvpFrame* get_random_kvp_frame(void);
32 gnc_numeric get_random_gnc_numeric(int64_t);
33 GncGUID* get_random_guid(void);
34 GList* get_random_glist(void);
35 
36 void random_glist_strings_only (gboolean strings_only);
37 void kvp_exclude_type (KvpValueType kvp_type);
38 void set_max_kvp_depth (gint max_kvp_depth);
39 void set_max_kvp_frame_elements (gint max_kvp_frame_elements);
40 void set_max_account_tree_depth (gint max_tree_depth);
41 void set_max_accounts_per_level (gint max_accounts);
42 
43 GNCPrice * get_random_price(QofBook *book);
44 gboolean make_random_pricedb (QofBook *book, GNCPriceDB *pdb);
45 GNCPriceDB * get_random_pricedb(QofBook *book);
46 Account * get_random_account_tree(QofBook * book);
47 Account* get_random_account(QofBook * book);
48 Split* get_random_split(QofBook *book, Account *account, Transaction *trn);
49 Transaction* get_random_transaction(QofBook *book);
50 Transaction* get_random_transaction_with_currency(QofBook *book,
51  gnc_commodity *currency,
52  GList *account_list);
53 gnc_commodity* get_random_commodity(QofBook *book);
54 const char *get_random_commodity_namespace(void);
55 
56 typedef enum
57 {
58  RANDOM_QT = 0,
59  SIMPLE_QT = 1 << 0,
60  ACCOUNT_QT = 1 << 1,
61  SPLIT_KVP_QT = 1 << 2,
62  TRANS_KVP_QT = 1 << 3,
63  ACCOUNT_KVP_QT = 1 << 4,
64  GUID_QT = 1 << 5,
65  ALL_QT = (1 << 8) - 1
66 } TestQueryTypes;
67 
68 QofQuery * get_random_query(void);
69 QofQuery * make_trans_query (Transaction *trans, TestQueryTypes query_types);
70 TestQueryTypes get_random_query_type (void);
71 void trans_query_include_price (gboolean include_amounts);
72 
73 QofBook * get_random_book (void);
74 QofSession * get_random_session (void);
75 
76 void add_random_transactions_to_book (QofBook *book, gint num_transactions);
77 
78 void make_random_changes_to_commodity (gnc_commodity *com);
79 void make_random_changes_to_commodity_table (gnc_commodity_table *table);
80 void make_random_changes_to_price (QofBook *book, GNCPrice *price);
81 void make_random_changes_to_pricedb (QofBook *book, GNCPriceDB *pdb);
82 void make_random_changes_to_split (Split *split);
83 void make_random_changes_to_transaction (QofBook *book,
84  Transaction *trans);
85 void make_random_changes_to_transaction_and_splits (QofBook *book,
86  Transaction *trans,
87  GList *accounts);
88 void make_random_changes_to_account (QofBook *book, Account *account);
89 void make_random_changes_to_level (QofBook *book, Account *parent);
90 void make_random_changes_to_book (QofBook *book);
91 void make_random_changes_to_session (QofSession *session);
92 
93 SchedXaction* add_daily_sx(gchar *name, const GDate *start, const GDate *end, const GDate *last_occur);
94 SchedXaction* add_once_sx(gchar *name, const GDate *when);
95 void remove_sx(SchedXaction *sx);
96 
97 #endif
a simple price database for gnucash
KvpValueType
possible types in the union KvpValue
Definition: kvp_frame.h:93
Use a 64-bit unsigned int timespec.
Definition: gnc-date.h:299
struct _QofQuery QofQuery
Definition: qofquery.h:90
Definition: guid.h:65
Definition: SplitP.h:71
struct KvpFrameImpl KvpFrame
Definition: kvp_frame.h:76
Scheduled Transactions public handling routines.
struct KvpValueImpl KvpValue
Definition: kvp_frame.h:80