Commit Graph

24 Commits

Author SHA1 Message Date
John Ralls
6d32b6f693 [Testing] Separate unit test functions from make check functions.
I'd originally put the functions supporting log detection, qof event handling, and mock-counting in test-stuff along with the functions that support the older "make check" integration tests. There are now more unit test support functions than there are of the older functions, so it's time for them to move out on their own.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@22132 57a11ea4-9604-0410-9ed3-97b8803252fd
2012-04-03 21:35:19 +00:00
John Ralls
0ecb61dd13 Testing: Provide a test_destroy function/macro combination.
Works on GObjects. Asserts if the object isn't a GObject (which may be the case if it has already been finalized) or if the object's finalize method isn't called (indicating a leak).

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@22114 57a11ea4-9604-0410-9ed3-97b8803252fd
2012-03-24 22:20:19 +00:00
John Ralls
777074f482 Testing: Rewrite test_signal_assert_hits as a function/macro combination
Now the assert reports the location in the test program where it fails instead of inside test-stuff.c.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@22113 57a11ea4-9604-0410-9ed3-97b8803252fd
2012-03-24 22:20:08 +00:00
John Ralls
b5c62a1385 Testing: Add a basic print-to-stdout log handler as a test debugging aid.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@22112 57a11ea4-9604-0410-9ed3-97b8803252fd
2012-03-24 22:19:58 +00:00
Christian Stimming
3fcdf59adf Re-indentation of source code.
As usual, re-indentation was done using astyle-1.24 using the following options:

  astyle --indent=spaces=4 --brackets=break --pad-oper --pad-header --suffix=none

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@21816 57a11ea4-9604-0410-9ed3-97b8803252fd
2012-01-01 20:36:46 +00:00
John Ralls
f7604f117f [Testing] Provide list error handler, rename some functions
Add an GTestFatalFunc which can examine a list of error conditions and suppress those messages and prevent their exiting while passing through any unexpected errors.

Rename test_silent_logger to test_null_handler and change it to a GTestFatalFunc (it can still be used as a GLogFunc).

Rename test_handle_faults to test_checked_handler and improve its flow and message display. It no longer asserts on a bad match.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@21668 57a11ea4-9604-0410-9ed3-97b8803252fd
2011-12-05 00:06:28 +00:00
John Ralls
2ab005524a [Testing] Test facility for QofEvents and improve fatal-handling
For use from tests based on glib testing. Create a private structure to
compare to and register a handler which tests the event parameters
against the private structure and counts the number of valid hits.
Provides a test function for checking that the event handler has been
hit the requisite number of times.

Pass through, rather than testing, logs with a lower (i.e., less
important rather than lower-value) loglevel than the one the handler was
set up for. Test the log message rather than overwriting the pre-set one
with the actual message.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@21523 57a11ea4-9604-0410-9ed3-97b8803252fd
2011-11-05 23:04:23 +00:00
Christian Stimming
1961766c99 Re-indentation of source code.
As usual, re-indentation was done using astyle-1.24 using the following options:

  astyle --indent=spaces=4 --brackets=break --pad-oper --pad-header --suffix=none

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@21205 57a11ea4-9604-0410-9ed3-97b8803252fd
2011-08-22 07:10:56 +00:00
John Ralls
2a565cf498 Testing: Fixed test_reset_called() return type
Author: Muslim Chochlov

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@20938 57a11ea4-9604-0410-9ed3-97b8803252fd
2011-07-17 21:22:11 +00:00
John Ralls
e7534148cc Testing: Add some convenience functions to make it
easier to test callbacks and to intercept and
ignore or test expected error log messages.

Much lifted from Muslim's test-qofbook.c

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@20928 57a11ea4-9604-0410-9ed3-97b8803252fd
2011-07-14 17:06:13 +00:00
John Ralls
4dc91e4441 Testing: Fix an error in the GNC_TEST_ADD macro that
ate user data for the fixture.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@20927 57a11ea4-9604-0410-9ed3-97b8803252fd
2011-07-14 17:06:04 +00:00
John Ralls
fb0f27b043 Add unit test utility macros
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@20768 57a11ea4-9604-0410-9ed3-97b8803252fd
2011-06-18 23:20:20 +00:00
Christian Stimming
61c16a06dd Re-indentation of source code, next batch.
This also strips trailing whitespaces from lines where they existed.
This re-indentation was done using astyle-1.23 using the following options:

astyle --indent=spaces=4 --brackets=break --pad-oper

Discussed at http://lists.gnucash.org/pipermail/gnucash-devel/2009-August/026121.html

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18535 57a11ea4-9604-0410-9ed3-97b8803252fd
2009-12-29 20:12:48 +00:00
Joshua Sled
fa132e4bab match quotes (breaks editor syntax hilighting)
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13721 57a11ea4-9604-0410-9ed3-97b8803252fd
2006-03-31 21:08:24 +00:00
Chris Shoemaker
ec1bcb86df Return the actual number of test failures with get_rv().
Use shorter strings for commodity mnemonics.
   Ensure that test splits amount and value have the same sign.
   Avoid numerical overflow in rate calculation when generating test splits.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13718 57a11ea4-9604-0410-9ed3-97b8803252fd
2006-03-31 01:43:16 +00:00
David Hampton
4b04137e7d Never include "config.h" from a header file. Doing so makes it nigh
impossible to override configuration settings.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13549 57a11ea4-9604-0410-9ed3-97b8803252fd
2006-03-09 05:51:07 +00:00
Derek Atkins
0f0080c964 Integration of the new Query subsystem, to replace the old Query
infrastructure.  This also replaces the old "Find Transaction"
	dialog with the new gnome-search dialog.  Registers, Reports, SXs,
	etc. all test out fine.  Integration with SQL has been "done"
	(i.e. it compiles cleanly) but not "tested."  Lots of the old code
	is still there, but #ifdef'ed out.  That code will go away
	shortly.

	There is only one known loss-of-functionality: the query->xml-v1
	converter was not re-implemented.  The current intention is, if
	this functionality is required, to use the query->scm converter
	and then convert the scm->string and insert that into an XML
	document.

	Fix a Transaction Void bug.

	Fix a few bugs in test code.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@6951 57a11ea4-9604-0410-9ed3-97b8803252fd
2002-06-05 21:59:35 +00:00
Derek Atkins
aec026dd2e provide a get_random_numeric()
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@6934 57a11ea4-9604-0410-9ed3-97b8803252fd
2002-06-01 02:05:22 +00:00
Dave Peticolas
bcae323c49 Work on test infrastructure.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@5658 57a11ea4-9604-0410-9ed3-97b8803252fd
2001-10-16 00:50:01 +00:00
Dave Peticolas
1506523cf6 2001-10-12 Dave Peticolas <dave@krondo.com>
* src/test-core/test-stuff.c (get_random_string_without): new func

	* src/engine/test-core/test-engine-stuff.c
	(get_random_kvp_frame_depth): fix bug
	(get_random_session): new func

	* src/engine/Account.c (xaccAccountEqual): more warnings, use
	gnc_commodity_equal

	* src/engine/Group.c (xaccGroupEqual): more warnings

	* src/engine/Transaction.c: use gnc_commodity_equal

	* src/engine/gnc-book.c (gnc_book_equal): compare commodity tables

	* src/engine/gnc-commodity.c (gnc_commodity_equal): new func
	(gnc_commodity_table_equal): new func

	* src/engine/gnc-session.c (gnc_session_begin): destroy old backend

	* src/backend/postgres/test/.cvsignore: ignore test files

	* src/backend/postgres/test/Makefile.am: add file backend .la
	to get symbols for gdb

	* src/backend/postgres/test/run-tests.sh: remove test files
	before starting test

	* src/backend/postgres/test/test-db.c: when books differ, write
	out xml files

	* src/backend/file/test/test-xml-account.c (test_add_account):
	fix for strong commodity equal test


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@5581 57a11ea4-9604-0410-9ed3-97b8803252fd
2001-10-12 10:50:35 +00:00
Dave Peticolas
3a4d567892 2001-10-11 Dave Peticolas <dave@krondo.com>
* src/test-core/test-stuff.c: allow option of including funky
	characters in random strings

	* src/engine/Transaction.c (xaccTransEqual): add warning strings

	* src/backend/postgres/test/.cvsignore: ignore test-escape

	* src/backend/postgres/test/test-escape: test string escaping

	* src/backend/postgres/test/Makefile.am: add test-escape

	* src/backend/postgres/builder.c (sqlBuild_Where_Str): don't
	escape string twice

	* src/backend/postgres/escape.c (sqlEscapeString): check for
	already-escaped string

	* src/backend/postgres/kvp-sql.c: escape path strings

	* src/backend/file/test/test-xml-transaction.c (test_add_transaction):
	test in reverse order, first orig, then new.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@5574 57a11ea4-9604-0410-9ed3-97b8803252fd
2001-10-11 08:22:44 +00:00
Dave Peticolas
904b2c2acb Fix some module versioning problems.
Distinguish between book full path and book logging path.
Work on test infrastructure.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@5437 57a11ea4-9604-0410-9ed3-97b8803252fd
2001-09-28 09:04:43 +00:00
Dave Peticolas
e5af9794bb More work on test infrastructure.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@5170 57a11ea4-9604-0410-9ed3-97b8803252fd
2001-08-18 00:13:45 +00:00
Dave Peticolas
f959452ec4 Add tests module. Fix warnings and bugs.
Note to module writers: include gnc-module-api.h to make sure
your signatures are correct.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@5168 57a11ea4-9604-0410-9ed3-97b8803252fd
2001-08-17 22:49:17 +00:00