GnuCash 2.4.99
test-engine-stuff.h
Go to the documentation of this file.
00001 
00005 #ifndef TEST_ENGINE_STUFF_H
00006 #define TEST_ENGINE_STUFF_H
00007 
00008 #include <glib.h>
00009 #include <stdlib.h>
00010 
00011 #include "qof.h"
00012 #include "Query.h"
00013 #include "gnc-pricedb.h"
00014 #include "SchedXaction.h"
00015 
00016 Timespec* get_random_timespec(void);
00017 void random_timespec_zero_nsec (gboolean zero_nsec);
00018 void random_timespec_usec_resolution (gboolean usec_resolution);
00019 
00020 kvp_value* get_random_kvp_value(int type);
00021 
00022 typedef struct
00023 {
00024     guchar *data;
00025     int len;
00026 } bin_data;
00027 
00028 bin_data* get_random_binary_data(void);
00029 
00030 kvp_frame* get_random_kvp_frame(void);
00031 gnc_numeric get_random_gnc_numeric(void);
00032 GncGUID* get_random_guid(void);
00033 GList* get_random_glist(void);
00034 
00035 void random_glist_strings_only (gboolean strings_only);
00036 void kvp_exclude_type (KvpValueType kvp_type);
00037 void set_max_kvp_depth (gint max_kvp_depth);
00038 void set_max_kvp_frame_elements (gint max_kvp_frame_elements);
00039 void set_max_account_tree_depth (gint max_tree_depth);
00040 void set_max_accounts_per_level (gint max_accounts);
00041 
00042 GNCPrice * get_random_price(QofBook *book);
00043 gboolean make_random_pricedb (QofBook *book, GNCPriceDB *pdb);
00044 GNCPriceDB * get_random_pricedb(QofBook *book);
00045 Account * get_random_account_tree(QofBook * book);
00046 Account* get_random_account(QofBook * book);
00047 Split* get_random_split(QofBook *book, Account *account, Transaction *trn);
00048 Transaction* get_random_transaction(QofBook *book);
00049 Transaction* get_random_transaction_with_currency(QofBook *book,
00050         gnc_commodity *currency,
00051         GList *account_list);
00052 gnc_commodity* get_random_commodity(QofBook *book);
00053 const char *get_random_commodity_namespace(void);
00054 
00055 typedef enum
00056 {
00057     RANDOM_QT      = 0,
00058     SIMPLE_QT      = 1 << 0,
00059     ACCOUNT_QT     = 1 << 1,
00060     SPLIT_KVP_QT   = 1 << 2,
00061     TRANS_KVP_QT   = 1 << 3,
00062     ACCOUNT_KVP_QT = 1 << 4,
00063     GUID_QT        = 1 << 5,
00064     ALL_QT         = (1 << 8) - 1
00065 } TestQueryTypes;
00066 
00067 QofQuery * get_random_query(void);
00068 QofQuery * make_trans_query (Transaction *trans, TestQueryTypes query_types);
00069 TestQueryTypes get_random_query_type (void);
00070 void trans_query_include_price (gboolean include_amounts);
00071 
00072 QofBook * get_random_book (void);
00073 QofSession * get_random_session (void);
00074 
00075 void add_random_transactions_to_book (QofBook *book, gint num_transactions);
00076 
00077 void make_random_changes_to_commodity (gnc_commodity *com);
00078 void make_random_changes_to_commodity_table (gnc_commodity_table *table);
00079 void make_random_changes_to_price (QofBook *book, GNCPrice *price);
00080 void make_random_changes_to_pricedb (QofBook *book, GNCPriceDB *pdb);
00081 void make_random_changes_to_split (Split *split);
00082 void make_random_changes_to_transaction (QofBook *book,
00083         Transaction *trans);
00084 void make_random_changes_to_transaction_and_splits (QofBook *book,
00085         Transaction *trans,
00086         GList *accounts);
00087 void make_random_changes_to_account (QofBook *book, Account *account);
00088 void make_random_changes_to_level (QofBook *book, Account *parent);
00089 void make_random_changes_to_book (QofBook *book);
00090 void make_random_changes_to_session (QofSession *session);
00091 
00092 SchedXaction* add_daily_sx(gchar *name, const GDate *start, const GDate *end, const GDate *last_occur);
00093 SchedXaction* add_once_sx(gchar *name, const GDate *when);
00094 void remove_sx(SchedXaction *sx);
00095 
00096 #endif
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines