5 #include "guile-mappings.h"
7 #include "engine-helpers-guile.h"
8 #include "gnc-module.h"
9 #include "gnc-guile-utils.h"
11 #include "test-stuff.h"
17 test_query (Query *q, SCM val2str)
26 scm_q = gnc_query2scm (q);
27 args = scm_cons (scm_q, SCM_EOL);
28 str_q = scm_apply (val2str, args, SCM_EOL);
30 args = scm_cons (scm_from_utf8_string (
"'"), scm_cons (str_q, SCM_EOL));
31 str_q = scm_string_append (args);
33 str2 = gnc_scm_to_utf8_string (str_q);
36 res_q = scm_c_eval_string (str2);
43 q2 = gnc_scm2query (res_q);
47 failure (
"queries don't match");
48 fprintf (stderr,
"%s\n\n", str2 ? str2 :
"(null)");
49 scm_q = gnc_query2scm (q2);
50 scm_display (scm_q, SCM_UNDEFINED);
51 scm_newline (SCM_UNDEFINED);
57 success (
"queries match");
70 val2str = scm_c_eval_string (
"gnc:value->string");
71 g_return_if_fail (scm_is_procedure (val2str));
73 for (i = 0; i < 1000; i++)
75 q = get_random_query ();
76 test_query (q, val2str);
82 q = get_random_query ();
83 test_query (q, val2str);
91 main_helper (
void *closure,
int argc,
char **argv)
93 gnc_module_system_init ();
94 gnc_module_load(
"gnucash/engine", 0);
95 gnc_module_load(
"gnucash/app-utils", 0);
107 print_test_results ();
113 main (
int argc,
char **argv)
115 g_setenv (
"GNC_UNINSTALLED",
"1", TRUE);
120 scm_boot_guile (argc, argv, main_helper, NULL);
void xaccLogDisable(void)
gboolean qof_query_equal(const QofQuery *q1, const QofQuery *q2)
void qof_query_destroy(QofQuery *q)
API for the transaction logger.