"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "libgnucash/engine/test/test-query.cpp" between
gnucash-5.0.tar.bz2 and gnucash-5.1.tar.bz2

About: GnuCash is personal and small-business financial-accounting software.

test-query.cpp  (gnucash-5.0.tar.bz2):test-query.cpp  (gnucash-5.1.tar.bz2)
skipping to change at line 39 skipping to change at line 39
#include "TransLog.h" #include "TransLog.h"
#include "gnc-engine.h" #include "gnc-engine.h"
#include "test-engine-stuff.h" #include "test-engine-stuff.h"
#include "test-stuff.h" #include "test-stuff.h"
static int static int
test_trans_query (Transaction *trans, gpointer data) test_trans_query (Transaction *trans, gpointer data)
{ {
QofBook *book = QOF_BOOK(data); QofBook *book = QOF_BOOK(data);
GList *list; GList *list;
QofQuery *q;
q = make_trans_query (trans, ALL_QT); QofQuery *q = make_trans_query (trans, ALL_QT);
qof_query_set_book (q, book); qof_query_set_book (q, book);
list = xaccQueryGetTransactions (q, QUERY_TXN_MATCH_ANY); list = xaccQueryGetTransactions (q, QUERY_TXN_MATCH_ANY);
qof_query_destroy (q);
if (g_list_length (list) != 1) if (g_list_length (list) != 1)
{ {
failure_args ("test number returned", __FILE__, __LINE__, failure_args ("test number returned", __FILE__, __LINE__,
"number of matching transactions %d not 1", "number of matching transactions %d not 1",
g_list_length (list)); g_list_length (list));
g_list_free (list); g_list_free (list);
return 13; return 13;
} }
if (list->data != trans) if (list->data != trans)
{ {
failure ("matching transaction is wrong"); failure ("matching transaction is wrong");
g_list_free (list); g_list_free (list);
return 13; return 13;
} }
success ("found right transaction"); success ("found right transaction");
qof_query_destroy (q);
g_list_free (list); g_list_free (list);
return 0; return 0;
} }
static void static void
run_test (void) run_test (void)
{ {
QofSession *session; QofSession *session;
Account *root; Account *root;
QofBook *book; QofBook *book;
session = get_random_session (); session = get_random_session ();
book = qof_session_get_book (session); book = qof_session_get_book (session);
root = gnc_book_get_root_account (book); root = gnc_book_get_root_account (book);
add_random_transactions_to_book (book, 20); add_random_transactions_to_book (book, 20);
xaccAccountTreeForEachTransaction (root, test_trans_query, book); xaccAccountTreeForEachTransaction (root, test_trans_query, book);
qof_session_end (session); qof_session_destroy (session);
} }
int int
main (int argc, char **argv) main (int argc, char **argv)
{ {
int i; int i;
qof_init(); qof_init();
g_log_set_always_fatal((GLogLevelFlags)(G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_W ARNING)); g_log_set_always_fatal((GLogLevelFlags)(G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_W ARNING));
 End of changes. 6 change blocks. 
5 lines changed or deleted 4 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)