GnuCash 2.4.99
test-split-vs-account.c
00001 /***************************************************************************
00002  *            test-split-vs-account.c
00003  *
00004  *  Tue Sep 27 19:44:50 2005
00005  *  Copyright  2005  GnuCash team
00006  *  linux@codehelp.co.uk
00007  ****************************************************************************/
00008 /*
00009  *  This program is free software; you can redistribute it and/or modify
00010  *  it under the terms of the GNU General Public License as published by
00011  *  the Free Software Foundation; either version 2 of the License, or
00012  *  (at your option) any later version.
00013  *
00014  *  This program is distributed in the hope that it will be useful,
00015  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  *  GNU General Public License for more details.
00018  *
00019  *  You should have received a copy of the GNU General Public License
00020  *  along with this program; if not, write to the Free Software
00021  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00022  *  02110-1301, USA.
00023  */
00024 
00025 #include "config.h"
00026 #include <glib.h>
00027 #include "qof.h"
00028 #include "cashobjects.h"
00029 #include "AccountP.h"
00030 #include "TransLog.h"
00031 #include "gnc-engine.h"
00032 #include "test-engine-stuff.h"
00033 #include "test-stuff.h"
00034 #include "Transaction.h"
00035 
00036 static void
00037 run_test (void)
00038 {
00039     Account *act1;
00040     Account *act2;
00041     //Split *spl;
00042     QofSession *session;
00043     QofBook *book;
00044 
00045     session = qof_session_new ();
00046     book = qof_session_get_book (session);
00047 
00048     act1 = get_random_account(book);
00049     do_test(act1 != NULL, "random account created");
00050 
00051     act2 = get_random_account(book);
00052     do_test(act2 != NULL, "random account created");
00053 #if 0
00054     spl = get_random_split(book, act1, NULL);
00055     do_test(spl != NULL, "random split created");
00056 
00057     do_test(act1 == xaccSplitGetAccount(spl), "xaccAccountInsertSplit()");
00058 #endif
00059     //FIXME
00060     //xaccSplitSetAccount (spl, NULL);
00061     //do_test(xaccSplitGetAccount(spl) == NULL, "xaccAccountRemoveSplit()");
00062 }
00063 
00064 int
00065 main (int argc, char **argv)
00066 {
00067     qof_init();
00068     if (cashobjects_register())
00069     {
00070         xaccLogDisable ();
00071         run_test ();
00072         print_test_results();
00073     }
00074     qof_close();
00075     return get_rv();
00076 }
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines