mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Fix distcheck.
The trick in ff07762
that changing the automake default extension to
cpp, thus forcing C++ linking even with C sources, while it worked, had
the side-effect of breaking make-dist because it made automake look for
*.cpp to put in the tarball and there weren't any such files.
Instead, make the files which use test-engine-stuff.cpp also C++.
This commit is contained in:
parent
431a525b22
commit
5e7dd9d43a
@ -8,17 +8,13 @@ check_PROGRAMS = \
|
||||
test-sx \
|
||||
test-app-utils
|
||||
|
||||
AM_DEFAULT_SOURCE_EXT = .cpp
|
||||
|
||||
TESTS = \
|
||||
test-load-module \
|
||||
${check_PROGRAMS}
|
||||
|
||||
test_exp_parser_SOURCES = \
|
||||
test-exp-parser.c
|
||||
|
||||
test_print_parse_amount_SOURCES = \
|
||||
test-print-parse-amount.cpp
|
||||
test_scm_query_string_SOURCES = test-scm-query-string.cpp
|
||||
test_sx_SOURCES = test-sx.cpp
|
||||
test_print_parse_amount_SOURCES = test-print-parse-amount.cpp
|
||||
|
||||
GNC_TEST_DEPS = --gnc-module-dir ${top_builddir}/src/engine \
|
||||
--gnc-module-dir ${top_builddir}/src/app-utils \
|
||||
|
@ -1,7 +1,9 @@
|
||||
#include <libguile.h>
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include "config.h"
|
||||
#include <glib.h>
|
||||
#include <libguile.h>
|
||||
#include "guile-mappings.h"
|
||||
|
||||
#include "engine-helpers-guile.h"
|
||||
@ -10,7 +12,7 @@
|
||||
#include "test-stuff.h"
|
||||
#include "Query.h"
|
||||
#include "TransLog.h"
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
test_query (Query *q, SCM val2str)
|
@ -1,7 +1,9 @@
|
||||
#include <libguile.h>
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include "config.h"
|
||||
#include <glib.h>
|
||||
#include <libguile.h>
|
||||
#include "guile-mappings.h"
|
||||
|
||||
#include "engine-helpers-guile.h"
|
||||
@ -11,7 +13,7 @@
|
||||
#include "test-stuff.h"
|
||||
#include "Query.h"
|
||||
#include "TransLog.h"
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
test_query (Query *q, SCM val2str)
|
@ -1,3 +1,5 @@
|
||||
extern "C"
|
||||
{
|
||||
#include "config.h"
|
||||
#include <stdlib.h>
|
||||
#include <glib.h>
|
||||
@ -8,6 +10,7 @@
|
||||
|
||||
#include "test-stuff.h"
|
||||
#include "test-engine-stuff.h"
|
||||
}
|
||||
|
||||
static void
|
||||
test_basic()
|
||||
@ -67,7 +70,7 @@ test_empty()
|
||||
GDate *end;
|
||||
GncSxInstanceModel *model;
|
||||
|
||||
end = g_date_new_dmy(31, 12, way_in_the_future_year);
|
||||
end = g_date_new_dmy(31, (GDateMonth)12, way_in_the_future_year);
|
||||
model = gnc_sx_get_instances(end, TRUE);
|
||||
do_test(g_list_length(model->sx_instance_list) == 0, "no instances");
|
||||
g_object_unref(G_OBJECT(model));
|
@ -2133,7 +2133,8 @@ once_freq(const GDate *when)
|
||||
}
|
||||
|
||||
static SchedXaction*
|
||||
add_sx(gchar *name, const GDate *start, const GDate *end, const GDate *last_occur, Recurrence *r)
|
||||
add_sx(const gchar *name, const GDate *start, const GDate *end,
|
||||
const GDate *last_occur, Recurrence *r)
|
||||
{
|
||||
QofBook *book = qof_session_get_book(gnc_get_current_session());
|
||||
SchedXaction *sx = xaccSchedXactionMalloc(book);
|
||||
@ -2155,13 +2156,14 @@ add_sx(gchar *name, const GDate *start, const GDate *end, const GDate *last_occu
|
||||
}
|
||||
|
||||
SchedXaction*
|
||||
add_daily_sx(gchar *name, const GDate *start, const GDate *end, const GDate *last_occur)
|
||||
add_daily_sx(const gchar *name, const GDate *start,
|
||||
const GDate *end, const GDate *last_occur)
|
||||
{
|
||||
return add_sx(name, start, end, last_occur, daily_freq(start, 1));
|
||||
}
|
||||
|
||||
SchedXaction*
|
||||
add_once_sx(gchar *name, const GDate *when)
|
||||
add_once_sx(const gchar *name, const GDate *when)
|
||||
{
|
||||
return add_sx(name, when, NULL, NULL, once_freq(when));
|
||||
}
|
||||
|
@ -99,8 +99,9 @@ void make_random_changes_to_level (QofBook *book, Account *parent);
|
||||
void make_random_changes_to_book (QofBook *book);
|
||||
void make_random_changes_to_session (QofSession *session);
|
||||
|
||||
SchedXaction* add_daily_sx(gchar *name, const GDate *start, const GDate *end, const GDate *last_occur);
|
||||
SchedXaction* add_once_sx(gchar *name, const GDate *when);
|
||||
SchedXaction* add_daily_sx(const gchar *name, const GDate *start,
|
||||
const GDate *end, const GDate *last_occur);
|
||||
SchedXaction* add_once_sx(const gchar *name, const GDate *when);
|
||||
void remove_sx(SchedXaction *sx);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -68,6 +68,18 @@ GNC_TEST_DEPS = \
|
||||
--library-dir ${top_builddir}/src/backend/xml \
|
||||
--library-dir ${top_builddir}/src/backend/sql
|
||||
|
||||
test_account_object_SOURCES = test-account-object.cpp
|
||||
test_commodities_SOURCES = test-commodities.cpp
|
||||
test_date_SOURCES = test-date.cpp
|
||||
test_group_vs_book_SOURCES = test-group-vs-book.cpp
|
||||
test_lots_SOURCES = test-lots.cpp
|
||||
test_numeric_SOURCES = test-numeric.cpp
|
||||
test_query_SOURCES = test-query.cpp
|
||||
test_scm_query_SOURCES = test-scm-query.cpp
|
||||
test_split_vs_account_SOURCES = test-split-vs-account.cpp
|
||||
test_transaction_reversal_SOURCES = test-transaction-reversal.cpp
|
||||
test_transaction_voiding_SOURCES = test-transaction-voiding.cpp
|
||||
|
||||
TESTS_ENVIRONMENT = \
|
||||
GUILE_WARN_DEPRECATED=no \
|
||||
GUILE="${GUILE}" \
|
||||
@ -76,7 +88,6 @@ TESTS_ENVIRONMENT = \
|
||||
$(shell ${abs_top_srcdir}/src/gnc-test-env.pl --noexports ${GNC_TEST_DEPS})
|
||||
|
||||
check_PROGRAMS = ${TEST_GROUP_1} ${TEST_GROUP_2}
|
||||
AM_DEFAULT_SOURCE_EXT = .cpp
|
||||
|
||||
TESTS = ${TEST_GROUP_1} test-create-account ${TEST_GROUP_2}
|
||||
|
||||
|
@ -24,7 +24,8 @@
|
||||
* @brief Minimal test of reading/writing account parameters
|
||||
* @author David Hampton <hampton@employees.org>
|
||||
*/
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include "config.h"
|
||||
#include <unistd.h>
|
||||
#include <glib.h>
|
||||
@ -34,6 +35,7 @@
|
||||
#include "test-stuff.h"
|
||||
#include "test-engine-stuff.h"
|
||||
#include <qofinstance-p.h>
|
||||
}
|
||||
|
||||
static void
|
||||
run_test (void)
|
||||
@ -89,7 +91,7 @@ main (int argc, char **argv)
|
||||
|
||||
/* Any tests that cause an error or warning to be printed
|
||||
* automatically fail! */
|
||||
g_log_set_always_fatal( G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING );
|
||||
g_log_set_always_fatal((GLogLevelFlags)(G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING));
|
||||
/* Set up a reproducible test-case */
|
||||
srand(0);
|
||||
|
@ -22,7 +22,8 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301, USA.
|
||||
*/
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include "config.h"
|
||||
#include <glib.h>
|
||||
|
||||
@ -30,6 +31,7 @@
|
||||
#include "qof.h"
|
||||
#include "test-engine-stuff.h"
|
||||
#include "test-stuff.h"
|
||||
}
|
||||
|
||||
static void
|
||||
test_commodity(void)
|
||||
@ -50,7 +52,7 @@ test_commodity(void)
|
||||
|
||||
{
|
||||
char *fullname;
|
||||
const char *namespace;
|
||||
const char *name_space;
|
||||
char *mnemonic;
|
||||
char *cusip;
|
||||
int fraction;
|
||||
@ -59,12 +61,12 @@ test_commodity(void)
|
||||
|
||||
book = qof_book_new ();
|
||||
fullname = get_random_string();
|
||||
namespace = get_random_commodity_namespace();
|
||||
name_space = get_random_commodity_namespace();
|
||||
mnemonic = get_random_string();
|
||||
cusip = get_random_string();
|
||||
fraction = get_random_int_in_range(0, 10000);
|
||||
|
||||
com = gnc_commodity_new(book, fullname, namespace, mnemonic,
|
||||
com = gnc_commodity_new(book, fullname, name_space, mnemonic,
|
||||
cusip, fraction);
|
||||
|
||||
do_test(
|
||||
@ -75,7 +77,7 @@ test_commodity(void)
|
||||
"fullnames equal test");
|
||||
|
||||
do_test(
|
||||
g_strcmp0(namespace, gnc_commodity_get_namespace(com)) == 0,
|
||||
g_strcmp0(name_space, gnc_commodity_get_namespace(com)) == 0,
|
||||
"namespace equal test");
|
||||
|
||||
do_test(
|
||||
@ -96,10 +98,10 @@ test_commodity(void)
|
||||
g_strcmp0(fullname, gnc_commodity_get_fullname(com)) == 0,
|
||||
"reset fullnames equal test");
|
||||
|
||||
namespace = get_random_commodity_namespace();
|
||||
gnc_commodity_set_namespace(com, namespace);
|
||||
name_space = get_random_commodity_namespace();
|
||||
gnc_commodity_set_namespace(com, name_space);
|
||||
do_test(
|
||||
g_strcmp0(namespace, gnc_commodity_get_namespace(com)) == 0,
|
||||
g_strcmp0(name_space, gnc_commodity_get_namespace(com)) == 0,
|
||||
"reset namespace equal test");
|
||||
|
||||
mnemonic = get_random_string();
|
||||
@ -120,7 +122,7 @@ test_commodity(void)
|
||||
gnc_commodity_get_fraction(com) == fraction,
|
||||
"reset fraction code equal test");
|
||||
|
||||
com2 = gnc_commodity_new(book, fullname, namespace, mnemonic,
|
||||
com2 = gnc_commodity_new(book, fullname, name_space, mnemonic,
|
||||
cusip, fraction);
|
||||
do_test(
|
||||
gnc_commodity_equiv(com, com2), "commodity equiv");
|
@ -1,7 +1,8 @@
|
||||
/*
|
||||
* -- fix borken timezone test -- linas May 2004
|
||||
*/
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include "config.h"
|
||||
#include <ctype.h>
|
||||
#include <glib.h>
|
||||
@ -11,7 +12,7 @@
|
||||
#include "gnc-module.h"
|
||||
#include "test-stuff.h"
|
||||
#include "test-engine-stuff.h"
|
||||
|
||||
}
|
||||
|
||||
static gboolean
|
||||
check_time (Timespec ts, gboolean always_print)
|
@ -20,7 +20,8 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301, USA.
|
||||
*/
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include "config.h"
|
||||
#include <glib.h>
|
||||
#include "qof.h"
|
||||
@ -30,6 +31,7 @@
|
||||
#include "gnc-engine.h"
|
||||
#include "test-engine-stuff.h"
|
||||
#include "test-stuff.h"
|
||||
}
|
||||
|
||||
static gboolean
|
||||
account_tree_has_book (Account *parent, QofBook *book)
|
||||
@ -45,7 +47,7 @@ account_tree_has_book (Account *parent, QofBook *book)
|
||||
children = gnc_account_get_children(parent);
|
||||
for (node = children; node; node = node->next)
|
||||
{
|
||||
if (!account_tree_has_book (node->data, book))
|
||||
if (!account_tree_has_book (GNC_ACCOUNT(node->data), book))
|
||||
return FALSE;
|
||||
}
|
||||
g_list_free(children);
|
@ -24,7 +24,8 @@
|
||||
* @brief Minimal test to see if automatic lot scrubbing works.
|
||||
* @author Linas Vepstas <linas@linas.org>
|
||||
*/
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include "config.h"
|
||||
#include <ctype.h>
|
||||
#include <glib.h>
|
||||
@ -35,6 +36,7 @@
|
||||
#include "test-stuff.h"
|
||||
#include "test-engine-stuff.h"
|
||||
#include "Transaction.h"
|
||||
}
|
||||
|
||||
static gint transaction_num = 320;
|
||||
static gint max_iterate = 10;
|
||||
@ -80,7 +82,7 @@ main (int argc, char **argv)
|
||||
|
||||
/* Any tests that cause an error or warning to be printed
|
||||
* automatically fail! */
|
||||
g_log_set_always_fatal( G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING );
|
||||
g_log_set_always_fatal((GLogLevelFlags)(G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING));
|
||||
/* Set up a reproducible test-case */
|
||||
srand(0);
|
||||
/* Iterate the test a number of times */
|
@ -22,7 +22,8 @@
|
||||
* 02110-1301, USA.
|
||||
*/
|
||||
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include "config.h"
|
||||
#include <ctype.h>
|
||||
#include <glib.h>
|
||||
@ -30,6 +31,7 @@
|
||||
#include "test-stuff.h"
|
||||
#include "test-engine-stuff.h"
|
||||
#include "gnc-numeric.h"
|
||||
}
|
||||
|
||||
#define NREPS 2000
|
||||
|
@ -20,7 +20,8 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301, USA.
|
||||
*/
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include "config.h"
|
||||
#include <glib.h>
|
||||
#include "qof.h"
|
||||
@ -30,11 +31,12 @@
|
||||
#include "gnc-engine.h"
|
||||
#include "test-engine-stuff.h"
|
||||
#include "test-stuff.h"
|
||||
}
|
||||
|
||||
static int
|
||||
test_trans_query (Transaction *trans, gpointer data)
|
||||
{
|
||||
QofBook *book = data;
|
||||
QofBook *book = QOF_BOOK(data);
|
||||
GList *list;
|
||||
QofQuery *q;
|
||||
|
||||
@ -89,7 +91,7 @@ main (int argc, char **argv)
|
||||
int i;
|
||||
|
||||
qof_init();
|
||||
g_log_set_always_fatal( G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING );
|
||||
g_log_set_always_fatal((GLogLevelFlags)(G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING));
|
||||
|
||||
xaccLogDisable ();
|
||||
|
@ -1,7 +1,9 @@
|
||||
#include <libguile.h>
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include "config.h"
|
||||
#include <glib.h>
|
||||
#include <libguile.h>
|
||||
|
||||
#include "engine-helpers-guile.h"
|
||||
#include "gnc-module.h"
|
||||
@ -9,7 +11,7 @@
|
||||
#include "test-stuff.h"
|
||||
#include "Query.h"
|
||||
#include "TransLog.h"
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
test_query (QofQuery *q)
|
@ -21,7 +21,8 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301, USA.
|
||||
*/
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include "config.h"
|
||||
#include <glib.h>
|
||||
#include "qof.h"
|
||||
@ -32,6 +33,7 @@
|
||||
#include "test-engine-stuff.h"
|
||||
#include "test-stuff.h"
|
||||
#include "Transaction.h"
|
||||
}
|
||||
|
||||
static void
|
||||
run_test (void)
|
@ -21,7 +21,8 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301, USA.
|
||||
*/
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include "config.h"
|
||||
#include <glib.h>
|
||||
#include <string.h>
|
||||
@ -31,6 +32,7 @@
|
||||
#include "TransLog.h"
|
||||
#include "test-engine-stuff.h"
|
||||
#include "test-stuff.h"
|
||||
}
|
||||
|
||||
#define print_gnc_numeric(num) fprintf(stderr, "%s\n", gnc_numeric_to_string(num))
|
||||
|
||||
@ -53,7 +55,7 @@ run_test (void)
|
||||
{
|
||||
Account *acc1, *acc2;
|
||||
Transaction *transaction, *new_trans;
|
||||
gnc_numeric old, new;
|
||||
gnc_numeric old_num, new_num;
|
||||
QofBook *book;
|
||||
char *msg;
|
||||
int i;
|
||||
@ -91,17 +93,17 @@ run_test (void)
|
||||
new_trans = xaccTransReverse(transaction);
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
old = xaccSplitGetAmount(xaccTransGetSplit(transaction, i));
|
||||
new = xaccSplitGetAmount(xaccTransGetSplit(new_trans, i));
|
||||
if (gnc_numeric_eq(old, gnc_numeric_neg(new)))
|
||||
old_num = xaccSplitGetAmount(xaccTransGetSplit(transaction, i));
|
||||
new_num = xaccSplitGetAmount(xaccTransGetSplit(new_trans, i));
|
||||
if (gnc_numeric_eq(old_num, gnc_numeric_neg(new_num)))
|
||||
{
|
||||
msg = g_strdup_printf("Amount of split %d wrong after reversal\n", i);
|
||||
failure(msg);
|
||||
}
|
||||
|
||||
old = xaccSplitGetValue(xaccTransGetSplit(transaction, i));
|
||||
new = xaccSplitGetValue(xaccTransGetSplit(new_trans, i));
|
||||
if (gnc_numeric_eq(old, gnc_numeric_neg(new)))
|
||||
old_num = xaccSplitGetValue(xaccTransGetSplit(transaction, i));
|
||||
new_num = xaccSplitGetValue(xaccTransGetSplit(new_trans, i));
|
||||
if (gnc_numeric_eq(old_num, gnc_numeric_neg(new_num)))
|
||||
{
|
||||
msg = g_strdup_printf("Value of split %d wrong after reversal\n", i);
|
||||
failure(msg);
|
@ -21,7 +21,8 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301, USA.
|
||||
*/
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include "config.h"
|
||||
#include <glib.h>
|
||||
#include <string.h>
|
||||
@ -31,6 +32,7 @@
|
||||
#include "test-engine-stuff.h"
|
||||
#include "test-stuff.h"
|
||||
#include "Transaction.h"
|
||||
}
|
||||
|
||||
#define print_gnc_numeric(num) fprintf(stderr, "%s\n", gnc_numeric_to_string(num))
|
||||
|
||||
@ -59,7 +61,7 @@ run_test (void)
|
||||
Timespec ts;
|
||||
time64 now;
|
||||
|
||||
char *reason = "because I can";
|
||||
const char *reason = "because I can";
|
||||
|
||||
book = qof_book_new();
|
||||
|
Loading…
Reference in New Issue
Block a user