Move test.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@5183 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Dave Peticolas
2001-08-18 20:07:03 +00:00
parent e03c240649
commit 33d1726882
3 changed files with 80 additions and 0 deletions

View File

@@ -6,4 +6,5 @@ test-load-engine
test-commodities
test-freq-spec
test-resolve-file-path
test-scm-query
test-split-vs-account

View File

@@ -11,6 +11,8 @@ LDADD = \
${top_srcdir}/src/gnc-module/libgncmodule.la \
${top_srcdir}/src/test-core/libgncmod-test.la \
../libgncmod-engine.la \
../libgw-engine.la \
../libgw-glib.la \
../test-core/libgncmod-test-engine.la \
${GLIB_LIBS} \
-lltdl
@@ -21,6 +23,7 @@ TESTS = \
test-commodities \
test-freq-spec \
test-resolve-file-path \
test-scm-query \
test-split-vs-account
TESTS_ENVIRONMENT = \
@@ -34,4 +37,5 @@ bin_PROGRAMS = \
test-freq-spec \
test-load-engine \
test-resolve-file-path \
test-scm-query \
test-split-vs-account

View File

@@ -0,0 +1,75 @@
#include <glib.h>
#include <guile/gh.h>
#include "engine-helpers.h"
#include "gnc-module.h"
#include "test-engine-stuff.h"
#include "test-stuff.h"
#include "Query.h"
static void
test_query (Query *q)
{
SCM scm_q;
Query *q2;
scm_q = gnc_query2scm (q);
q2 = gnc_scm2query (scm_q);
if (!xaccQueryEqual (q, q2))
{
failure ("queries don't match");
gh_display (scm_q); gh_newline ();
scm_q = gnc_query2scm (q2);
gh_display (scm_q); gh_newline ();
exit (1);
}
else
{
success ("queries match");
}
xaccFreeQuery (q2);
}
static void
run_tests (void)
{
Query *q;
int i;
test_query (NULL);
q = xaccMallocQuery ();
test_query (q);
xaccFreeQuery (q);
for (i = 0; i < 10; i++)
{
q = get_random_query ();
test_query (q);
xaccFreeQuery (q);
}
}
static void
main_helper (int argc, char **argv)
{
gnc_module_load("gnucash/engine", 0);
run_tests ();
print_test_results ();
exit (get_rv ());
}
int
main (int argc, char **argv)
{
gh_enter (argc, argv, main_helper);
return 0;
}