mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
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
This commit is contained in:
parent
b5c62a1385
commit
777074f482
@ -541,9 +541,11 @@ test_signal_free (TestSignal sigp)
|
|||||||
g_slice_free (_TestSignal, sig);
|
g_slice_free (_TestSignal, sig);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
guint
|
||||||
test_signal_assert_hits (TestSignal sigp, guint hits)
|
test_signal_return_hits (TestSignal sigp)
|
||||||
{
|
{
|
||||||
_TestSignal *sig = (_TestSignal *)sigp;
|
_TestSignal *sig = (_TestSignal *)sigp;
|
||||||
g_assert_cmpint (sig->hits, == , hits);
|
return sig->hits;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -268,11 +268,18 @@ const char* get_random_string_in_array(const char* str_list[]);
|
|||||||
typedef gpointer TestSignal;
|
typedef gpointer TestSignal;
|
||||||
TestSignal test_signal_new (QofInstance *entity, QofEventId eventType,
|
TestSignal test_signal_new (QofInstance *entity, QofEventId eventType,
|
||||||
gpointer event_data);
|
gpointer event_data);
|
||||||
/* test_signal_assert_hits calls g_assert_cmpuint with an ==
|
/* test_signal_return_hits gets the number of times the TestSignal has
|
||||||
* operator. Use it in a test program to see if a TestSignal has been
|
* been called.
|
||||||
* emitted the number of times you expect.
|
|
||||||
*/
|
*/
|
||||||
void test_signal_assert_hits (TestSignal sig, guint hits);
|
guint test_signal_return_hits (TestSignal sig);
|
||||||
|
|
||||||
|
/* test_signal_assert_hits is a convenience macro which wraps
|
||||||
|
* test_signal_return_hits with and equality assertion.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define test_signal_assert_hits(sig, hits) \
|
||||||
|
g_assert_cmpint (test_signal_return_hits (sig), ==, hits)
|
||||||
|
|
||||||
void test_signal_free (TestSignal sig);
|
void test_signal_free (TestSignal sig);
|
||||||
|
|
||||||
/* For Scheme testing access:
|
/* For Scheme testing access:
|
||||||
|
Loading…
Reference in New Issue
Block a user