GnuCash  2.6.99
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
test-split-vs-account.c
1 /***************************************************************************
2  * test-split-vs-account.c
3  *
4  * Tue Sep 27 19:44:50 2005
5  * Copyright 2005 GnuCash team
7  ****************************************************************************/
8 /*
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22  * 02110-1301, USA.
23  */
24 
25 #include "config.h"
26 #include <glib.h>
27 #include "qof.h"
28 #include "cashobjects.h"
29 #include "AccountP.h"
30 #include "TransLog.h"
31 #include "gnc-engine.h"
32 #include "test-engine-stuff.h"
33 #include "test-stuff.h"
34 #include "Transaction.h"
35 
36 static void
37 run_test (void)
38 {
39  Account *act1;
40  Account *act2;
41  //Split *spl;
42  QofSession *session;
43  QofBook *book;
44 
45  session = qof_session_new ();
46  book = qof_session_get_book (session);
47 
48  act1 = get_random_account(book);
49  do_test(act1 != NULL, "random account created");
50 
51  act2 = get_random_account(book);
52  do_test(act2 != NULL, "random account created");
53 #if 0
54  spl = get_random_split(book, act1, NULL);
55  do_test(spl != NULL, "random split created");
56 
57  do_test(act1 == xaccSplitGetAccount(spl), "xaccAccountInsertSplit()");
58 #endif
59  //FIXME
60  //xaccSplitSetAccount (spl, NULL);
61  //do_test(xaccSplitGetAccount(spl) == NULL, "xaccAccountRemoveSplit()");
62 }
63 
64 int
65 main (int argc, char **argv)
66 {
67  qof_init();
68  if (cashobjects_register())
69  {
70  xaccLogDisable ();
71  run_test ();
72  print_test_results();
73  }
74  qof_close();
75  return get_rv();
76 }
void xaccLogDisable(void)
Definition: TransLog.c:93
QofBook * qof_session_get_book(const QofSession *session)
All type declarations for the whole Gnucash engine.
API for the transaction logger.
void qof_close(void)
Safely close down the Query Object Framework.
Account * xaccSplitGetAccount(const Split *s)
Definition: Split.c:968
void qof_init(void)
Initialise the Query Object Framework.
API for Transactions and Splits (journal entries)