--- tests/check_money.6.c 2006-11-21 18:19:15.000000000 -0500
+++ tests/check_money.7.c 2006-11-21 18:19:15.000000000 -0500
@@ -2,15 +2,26 @@
#include <check.h>
#include "../src/money.h"
+Money *five_dollars;
+
+void
+setup (void)
+{
+ five_dollars = money_create (5, "USD");
+}
+
+void
+teardown (void)
+{
+ money_free (five_dollars);
+}
+
START_TEST (test_money_create)
{
- Money *m;
- m = money_create (5, "USD");
- fail_unless (money_amount (m) == 5,
+ fail_unless (money_amount (five_dollars) == 5,
"Amount not set correctly on creation");
- fail_unless (strcmp (money_currency (m), "USD") == 0,
+ fail_unless (strcmp (money_currency (five_dollars), "USD") == 0,
"Currency not set correctly on creation");
- money_free (m);
}
END_TEST
@@ -38,6 +49,7 @@
/* Core test case */
TCase *tc_core = tcase_create ("Core");
+ tcase_add_checked_fixture (tc_core, setup, teardown);
tcase_add_test (tc_core, test_money_create);
suite_add_tcase (s, tc_core);
syntax highlighted by Code2HTML, v. 0.9.1