28 #include "gnc-module.h"
29 #include "qif-import.h"
30 #include "qif-import-p.h"
32 #include "test-stuff.h"
35 extern void qif_object_init(
void);
38 test_qif_load_file(
QifContext ctx,
const char *filename,
39 gint txn_count, gint acct_count, gboolean needs_acct)
43 printf(
"qif loading \"%s\"...\n", filename);
44 file = qif_file_new(ctx, filename);
45 do_test(file != NULL,
"failed to read file");
46 if (!file)
return NULL;
48 do_test(qif_object_list_count(file, QIF_O_TXN) == txn_count,
49 "Transaction count didn't match");
50 do_test(qif_object_map_count(file, QIF_O_ACCOUNT) == acct_count,
51 "Account count didn't match");
52 do_test(qif_file_needs_account(file) == needs_acct,
53 "Needs account flad didn't match");
63 const char *location = g_getenv(
"GNC_TEST_FILES");
66 ctx = qif_context_new();
67 do_test(ctx != NULL,
"failed to create the qif context");
71 location =
"test-files";
73 for (i = 0; i < 1; i++)
75 filename = g_strdup_printf(
"%s/%s", location,
"test-1-bank-txn.qif");
76 file = test_qif_load_file(ctx, filename, 1, 0, TRUE);
80 if (qif_file_needs_account(file))
81 qif_file_set_default_account(file,
"test-1-bank-txn");
83 do_test(qif_file_needs_account(file) == FALSE,
84 "'Needs account' flag not cleared properly");
86 do_test(qif_file_parse(file, NULL) == QIF_E_OK,
87 "file failed to parse.");
90 qif_context_destroy(ctx);
92 success(
"QIF test successful");
96 main_helper(
void *closure,
int argc,
char **argv)
100 print_test_results();
105 main(
int argc,
char **argv)
107 scm_boot_guile(argc, argv, main_helper, NULL);