[gnome-keyring] Move remainder to new style tests.



commit 0854932ebd93cf247097506f6a87c65f75bfa08a
Author: Stef Walter <stef memberwebs com>
Date:   Sun May 10 19:13:08 2009 +0000

    Move remainder to new style tests.
    
    Remove old tests based on cu-test package, and use glib tests
    exclusively.
---
 daemon/keyrings/tests/Makefile.am               |    2 +-
 daemon/keyrings/tests/unit-test-keyring-file.c  |  147 +++--
 daemon/keyrings/tests/unit-test-keyring-login.c |   72 ++--
 daemon/keyrings/tests/unit-test-login-prompt.c  |   55 ++-
 daemon/util/tests/.gitignore                    |    1 +
 egg/tests/.gitignore                            |    2 +
 gcr/tests/.gitignore                            |    2 +
 library/tests/Makefile.am                       |    5 +-
 library/tests/unit-test-daemon-setup.c          |   17 +-
 library/tests/unit-test-keyrings-prompt.c       |  102 ++--
 library/tests/unit-test-keyrings.c              |  257 +++++----
 library/tests/unit-test-login-prompt.c          |   41 +-
 library/tests/unit-test-memory.c                |   61 +--
 library/tests/unit-test-other.c                 |   41 +-
 pam/tests/Makefile.am                           |    5 +-
 pam/tests/unit-test-pam-setup.c                 |   17 +-
 pam/tests/unit-test-pam.c                       |   32 +-
 pkcs11/rpc-layer/Makefile.am                    |    1 -
 pkcs11/ssh-store/tests/.gitignore               |    5 +-
 tests/Makefile.am                               |    8 +-
 tests/cu-test/AllTests.c                        |   25 -
 tests/cu-test/CuTest.c                          |  309 ----------
 tests/cu-test/CuTest.h                          |  111 ----
 tests/cu-test/CuTestTest.c                      |  709 -----------------------
 tests/cu-test/README                            |  209 -------
 tests/cu-test/license.txt                       |   38 --
 tests/cu-test/make-tests.sh                     |   51 --
 tests/gtest-helpers.c                           |   10 +-
 tests/gtest-helpers.h                           |   10 +
 tests/gtest.make                                |   21 +-
 tests/prep-gtest.sh                             |   31 +-
 tests/prep-tests.sh                             |  115 ----
 tests/test-helpers.c                            |  122 ----
 tests/test-helpers.h                            |   33 -
 tests/test.make                                 |   62 --
 35 files changed, 479 insertions(+), 2250 deletions(-)

diff --git a/daemon/keyrings/tests/Makefile.am b/daemon/keyrings/tests/Makefile.am
index 705dd18..a24f535 100644
--- a/daemon/keyrings/tests/Makefile.am
+++ b/daemon/keyrings/tests/Makefile.am
@@ -16,4 +16,4 @@ UNIT_LIBS =  \
 
 EXTRA_DIST = test-data
 
-include $(top_srcdir)/tests/test.make
+include $(top_srcdir)/tests/gtest.make
diff --git a/daemon/keyrings/tests/unit-test-keyring-file.c b/daemon/keyrings/tests/unit-test-keyring-file.c
index 12eaa36..25d0908 100644
--- a/daemon/keyrings/tests/unit-test-keyring-file.c
+++ b/daemon/keyrings/tests/unit-test-keyring-file.c
@@ -36,19 +36,6 @@
 #include <glib.h>
 #include <string.h>
 
-/* 
- * Each test looks like (on one line):
- *     void unit_test_xxxxx (CuTest* cu)
- * 
- * Each setup looks like (on one line):
- *     void unit_setup_xxxxx (void)
- * 
- * Each teardown looks like (on one line):
- *     void unit_teardown_xxxxx (void)
- * 
- * Tests be run in the order specified here.
- */
-
 static GQuark
 location_for_test_data (const gchar *filename)
 {
@@ -67,38 +54,52 @@ location_for_test_data (const gchar *filename)
 }
  
 static void
-validate_keyring_contents (GkrKeyring *keyring, CuTest *cu)
+validate_keyring_contents (GkrKeyring *keyring)
 {
 	GnomeKeyringAccessControl *ac;
 	GkrKeyringItem* item; 
 	GArray *attrs;
 	
 	/* The keyring itself */
-	CuAssert (cu, "Missing keyring name", keyring->keyring_name != NULL);
-	CuAssert (cu, "Invalid keyring name", g_str_equal (keyring->keyring_name, "unit-test-keyring"));
-	CuAssert (cu, "Bad lock settings", !keyring->lock_on_idle && keyring->lock_timeout == 0);
-	CuAssert (cu, "Bad Creation Time", keyring->ctime == 1198027852);
-	CuAssert (cu, "Bad Modification Time", keyring->mtime == 1198027852);
-	CuAssert (cu, "Wrong number of items", g_list_length (keyring->items) == 2);
+	/* "Missing keyring name" */
+	g_assert (keyring->keyring_name != NULL);
+	/* "Invalid keyring name" */
+	g_assert_cmpstr (keyring->keyring_name, ==, "unit-test-keyring");
+	/* "Bad lock settings" */
+	g_assert (!keyring->lock_on_idle && keyring->lock_timeout == 0);
+	/* "Bad Creation Time" */
+	g_assert_cmpint (keyring->ctime, ==, 1198027852);
+	/* "Bad Modification Time" */
+	g_assert_cmpint (keyring->mtime, ==, 1198027852);
+	/* "Wrong number of items" */
+	g_assert_cmpint (g_list_length (keyring->items), ==, 2);
 	
 	/* Item #2 */
 	item = gkr_keyring_get_item (keyring, 2);
-	CuAssert (cu, "Couldn't find item", item != NULL);
-	CuAssert (cu, "Invalid item type", item->type == GNOME_KEYRING_ITEM_GENERIC_SECRET);
-	CuAssert (cu, "Missing secret", item->secret != NULL);
-	CuAssert (cu, "Wrong secret", g_str_equal (item->secret, "item-secret"));
-	CuAssert (cu, "Bad Creation Time", item->ctime == 1198027852);
+	/* "Couldn't find item" */
+	g_assert (item != NULL);
+	/* "Invalid item type" */
+	g_assert_cmpint (item->type, ==, GNOME_KEYRING_ITEM_GENERIC_SECRET);
+	/* "Missing secret" */
+	g_assert (item->secret != NULL);
+	/* "Wrong secret" */
+	g_assert_cmpstr (item->secret, ==, "item-secret");
+	/* "Bad Creation Time" */
+	g_assert_cmpint (item->ctime, ==, 1198027852);
 	
 	/* Item #2 ACL */
-	CuAssert (cu, "Bad ACLs", g_list_length (item->acl) == 1);
+	/* "Bad ACLs" */
+	g_assert_cmpint (g_list_length (item->acl), ==, 1);
 	ac = (GnomeKeyringAccessControl*)item->acl->data;
-	CuAssert (cu, "Invalid ACL", ac && ac->application);
-	CuAssert (cu, "Invalid ACL Path", ac->application->pathname && 
-			g_str_equal (ac->application->pathname, "/data/projects/gnome-keyring/library/tests/.libs/run-auto-test"));
-	CuAssert (cu, "Invalid ACL Display Name", ac->application->display_name && 
-			g_str_equal (ac->application->display_name, "run-auto-test"));
-	CuAssert (cu, "Invalid ACL Access Type", 
-			ac->types_allowed == (GNOME_KEYRING_ACCESS_READ | GNOME_KEYRING_ACCESS_WRITE | GNOME_KEYRING_ACCESS_REMOVE)); 
+	/* "Invalid ACL" */
+	g_assert (ac && ac->application);
+	/* "Invalid ACL Path" */
+	g_assert (ac->application->pathname && strstr (ac->application->pathname, "run-auto-test"));
+	/* "Invalid ACL Display Name" */
+	g_assert (ac->application->display_name);
+	g_assert_cmpstr (ac->application->display_name, ==, "run-auto-test");
+	/* "Invalid ACL Access Type" */
+	g_assert_cmpint (ac->types_allowed, ==, (GNOME_KEYRING_ACCESS_READ | GNOME_KEYRING_ACCESS_WRITE | GNOME_KEYRING_ACCESS_REMOVE)); 
 		
 	/* Item #3 */
 	attrs = gnome_keyring_attribute_list_new ();
@@ -108,14 +109,19 @@ validate_keyring_contents (GkrKeyring *keyring, CuTest *cu)
 	gnome_keyring_attribute_list_append_uint32 (attrs, "num", 3); 
 	item = gkr_keyring_find_item (keyring, GNOME_KEYRING_ITEM_GENERIC_SECRET, attrs, TRUE);
 	gnome_keyring_attribute_list_free (attrs);
-	CuAssert (cu, "Couldn't find item #3", item != NULL);
-	CuAssert (cu, "Invalid item found", item->id == 3);
-	CuAssert (cu, "Invalid item type", item->type == GNOME_KEYRING_ITEM_GENERIC_SECRET);
-	CuAssert (cu, "Missing secret", item->secret != NULL);
-	CuAssert (cu, "Wrong secret", g_str_equal (item->secret, "item-secret"));
+	/* "Couldn't find item #3" */
+	g_assert (item != NULL);
+	/* "Invalid item found" */
+	g_assert_cmpint (item->id, ==, 3);
+	/* "Invalid item type" */
+	g_assert_cmpint (item->type, ==, GNOME_KEYRING_ITEM_GENERIC_SECRET);
+	/* "Missing secret" */
+	g_assert (item->secret != NULL);
+	/* "Wrong secret" */
+	g_assert_cmpstr (item->secret, ==, "item-secret");
 }
 
-void unit_test_keyring_parse_encrypted (CuTest *cu)
+DEFINE_TEST(keyring_parse_encrypted)
 {
 	GkrKeyring *encrypted, *plain;
 	EggBuffer buffer, output;
@@ -136,34 +142,41 @@ void unit_test_keyring_parse_encrypted (CuTest *cu)
 	data = g_memdup (data, n_data); /* Make a copy for double parse */
 	ret = gkr_keyring_binary_parse (encrypted, &buffer);
 	egg_buffer_uninit (&buffer);
-	CuAssert (cu, "couldn't parse encrypted keyring", ret == 1);
-	CuAssert (cu, "didn't unlock encrypted keyring", !encrypted->locked);
+	/* "couldn't parse encrypted keyring" */
+	g_assert (ret == 1);
+	/* "didn't unlock encrypted keyring" */
+	g_assert (!encrypted->locked);
 	
-	validate_keyring_contents (encrypted, cu);
+	validate_keyring_contents (encrypted);
 
 	/* Double parse shouldn't change it */
 	egg_buffer_init_allocated (&buffer, (guchar*)data, n_data, NULL);
 	ret = gkr_keyring_binary_parse (encrypted, &buffer);
 	egg_buffer_uninit (&buffer);
-	CuAssert (cu, "couldn't parse encrypted keyring", ret == 1);
-	CuAssert (cu, "didn't unlock encrypted keyring", !encrypted->locked);
+	/* "couldn't parse encrypted keyring" */
+	g_assert (ret == 1);
+	/* "didn't unlock encrypted keyring" */
+	g_assert (!encrypted->locked);
 	
-	validate_keyring_contents (encrypted, cu);
+	validate_keyring_contents (encrypted);
 	
 	/* Output same data in the cleartext format */
 	egg_buffer_init (&output, 128);
 	success = gkr_keyring_textual_generate (encrypted, &output);
-	CuAssert (cu, "couldn't generate textual data", success);
+	/* "couldn't generate textual data" */
+	g_assert (success);
 	
 	/* Make sure it parses */
 	ret = gkr_keyring_textual_parse (plain, &output);
-	CuAssert (cu, "couldn't parse generated textual data", ret == 1);
-	CuAssert (cu, "keyring should not be locked", !plain->locked);
+	/* "couldn't parse generated textual data" */
+	g_assert (ret == 1);
+	/* "keyring should not be locked" */
+	g_assert (!plain->locked);
 	
-	validate_keyring_contents (plain, cu);
+	validate_keyring_contents (plain);
 }
 
-void unit_test_keyring_parse_plain (CuTest *cu)
+DEFINE_TEST(keyring_parse_plain)
 {
 	GkrKeyring *keyring;
 	EggBuffer buffer;
@@ -179,21 +192,25 @@ void unit_test_keyring_parse_plain (CuTest *cu)
 	/* Parse it */
 	egg_buffer_init_static (&buffer, (guchar*)data, n_data);
 	ret = gkr_keyring_textual_parse (keyring, &buffer);
-	CuAssert (cu, "couldn't parse generated textual data", ret == 1);
-	CuAssert (cu, "keyring should not be locked", !keyring->locked);
+	/* "couldn't parse generated textual data" */
+	g_assert (ret == 1);
+	/* "keyring should not be locked" */
+	g_assert (!keyring->locked);
 	
-	validate_keyring_contents (keyring, cu);
+	validate_keyring_contents (keyring);
 	
 	/* Double parse shouldn't change it */
 	egg_buffer_init_static (&buffer, (guchar*)data, n_data);
 	ret = gkr_keyring_textual_parse (keyring, &buffer);
-	CuAssert (cu, "couldn't parse generated textual data", ret == 1);
-	CuAssert (cu, "keyring should not be locked", !keyring->locked);
+	/* "couldn't parse generated textual data" */
+	g_assert (ret == 1);
+	/* "keyring should not be locked" */
+	g_assert (!keyring->locked);
 	
-	validate_keyring_contents (keyring, cu);
+	validate_keyring_contents (keyring);
 }
 
-void unit_test_keyring_double_lock_encrypted (CuTest *cu)
+DEFINE_TEST(keyring_double_lock_encrypted)
 {
 	GkrKeyring *encrypted;
 	gboolean ret;
@@ -201,35 +218,37 @@ void unit_test_keyring_double_lock_encrypted (CuTest *cu)
 	encrypted = gkr_keyring_new ("encrypted", location_for_test_data ("encrypted.keyring"));
 	encrypted->password = egg_secure_strdup ("my-keyring-password");
 	ret = gkr_keyring_update_from_disk (encrypted);
-	CuAssert (cu, "couldn't parse generated textual data", ret == TRUE);
+	/* "couldn't parse generated textual data" */
+	g_assert (ret == TRUE);
 	
 	/* Lock it */
 	gkr_keyring_lock (encrypted);
-	CuAssert (cu, "locked", encrypted->locked);
+	g_assert (encrypted->locked);
 	
 	/* Should succeed */
 	gkr_keyring_lock (encrypted);
-	CuAssert (cu, "locked", encrypted->locked);
+	g_assert (encrypted->locked);
 	
 	g_object_unref (encrypted);
 }
 
-void unit_test_keyring_double_lock_plain (CuTest *cu)
+DEFINE_TEST(keyring_double_lock_plain)
 {
 	GkrKeyring *keyring;
 	gboolean ret;
 	
 	keyring = gkr_keyring_new ("plain", location_for_test_data ("plain.keyring"));
 	ret = gkr_keyring_update_from_disk (keyring);
-	CuAssert (cu, "couldn't parse generated textual data", ret == TRUE);
+	/* "couldn't parse generated textual data" */
+	g_assert (ret == TRUE);
 
 	/* Lock it, shouldn't actually work, no way to lock */
 	gkr_keyring_lock (keyring);
-	CuAssert (cu, "locked", !keyring->locked);
+	g_assert (!keyring->locked);
 	
 	/* Shouldn't crash */
 	gkr_keyring_lock (keyring);
-	CuAssert (cu, "locked", !keyring->locked);
+	g_assert (!keyring->locked);
 	
 	g_object_unref (keyring);
 }
diff --git a/daemon/keyrings/tests/unit-test-keyring-login.c b/daemon/keyrings/tests/unit-test-keyring-login.c
index a8403eb..d81fa50 100644
--- a/daemon/keyrings/tests/unit-test-keyring-login.c
+++ b/daemon/keyrings/tests/unit-test-keyring-login.c
@@ -35,20 +35,7 @@
 #include <glib.h>
 #include <memory.h>
 
-/* 
- * Each test looks like (on one line):
- *     void unit_test_xxxxx (CuTest* cu)
- * 
- * Each setup looks like (on one line):
- *     void unit_setup_xxxxx (void)
- * 
- * Each teardown looks like (on one line):
- *     void unit_teardown_xxxxx (void)
- * 
- * Tests be run in the order specified here.
- */
-
-void unit_setup_keyrings_login (void)
+DEFINE_SETUP(keyrings_login)
 {
 	gkr_keyrings_update();
 
@@ -63,50 +50,58 @@ void unit_setup_keyrings_login (void)
 }
 
 static void 
-verify_no_ask (GkrAskRequest *req, gpointer data)
+verify_no_ask (GkrAskRequest *req, gpointer unused)
 {
-	CuTest *cu = (CuTest*)data;
-	CuAssert (cu, "should not have prompted", FALSE);
+	/* "should not have prompted" */
+	g_assert_not_reached ();
 }
 
-void unit_test_keyrings_login (CuTest* cu)
+DEFINE_TEST(keyrings_login)
 {
 	GkrKeyring *login;
 	gboolean ret;
 
-	gkr_ask_daemon_set_hook (verify_no_ask, cu);
+	gkr_ask_daemon_set_hook (verify_no_ask, NULL);
 	
 	/* Unlock and create a new login keyring */
 	ret = gkr_keyring_login_unlock ("blah");
-	CuAssert (cu, "gkr_keyring_login_unlock() return FALSE", ret);
-	CuAssert (cu, "login not marked unlocked", gkr_keyring_login_is_unlocked ());
+	/* "gkr_keyring_login_unlock() return FALSE" */
+	g_assert (ret);
+	/* "login not marked unlocked" */
+	g_assert (gkr_keyring_login_is_unlocked ());
 	
 	/* Make sure it worked */
 	login = gkr_keyrings_get_login ();
-	CuAssert (cu, "invalid keyring created by gkr_keyring_login_unlock()", login != NULL);
+	/* "invalid keyring created by gkr_keyring_login_unlock()" */
+	g_assert (login != NULL);
 	
 	/* Now lock it */
 	gkr_keyring_login_lock ();
-	CuAssert (cu, "didn't lock right keyring", login->locked);
-	CuAssert (cu, "login not marked locked", !gkr_keyring_login_is_unlocked ());
+	/* "didn't lock right keyring" */
+	g_assert (login->locked);
+	/* "login not marked locked" */
+	g_assert (!gkr_keyring_login_is_unlocked ());
 	
 	/* And unlock it again */
 	ret = gkr_keyring_login_unlock ("blah");
-	CuAssert (cu, "gkr_keyring_login_unlock() returned FALSE", ret);
+	/* "gkr_keyring_login_unlock() returned FALSE" */
+	g_assert (ret);
 	
 	/* Make sure it didn't create a new keyring */
-	CuAssert (cu, "gkr_keyring_login_unlock() created a second keyring", 
-	          login == gkr_keyrings_get_login());
+	/* "gkr_keyring_login_unlock() created a second keyring" */
+	g_assert (login == gkr_keyrings_get_login());
 }
 
-void unit_test_keyrings_login_master (CuTest *cu)
+DEFINE_TEST(keyrings_login_master)
 {
 	const gchar *master = gkr_keyring_login_master();
-	CuAssert (cu, "no master password in login keyring", master != NULL);
-	CuAssert (cu, "wrong master password in login keyring", strcmp (master, "blah") == 0);
+	/* "no master password in login keyring" */
+	g_assert (master != NULL);
+	/* "wrong master password in login keyring" */
+	g_assert_cmpstr (master, ==, "blah");
 }
 
-void unit_test_keyrings_login_secrets (CuTest* cu)
+DEFINE_TEST(keyrings_login_secrets)
 {
 	const gchar *password;
 	
@@ -120,8 +115,10 @@ void unit_test_keyrings_login_secrets (CuTest* cu)
 	password = gkr_keyring_login_lookup_secret (GNOME_KEYRING_ITEM_GENERIC_SECRET,
 	                                 "attr-string", "string",
 	                                 NULL);
-	CuAssert (cu, "no secret found in login keyring", password != NULL);
-	CuAssert (cu, "wrong secret found in login keyring", strcmp (password, "secret") == 0);
+	/* "no secret found in login keyring */
+	g_assert (password != NULL);
+	/* "wrong secret found in login keyring" */
+	g_assert_cmpstr (password, ==, "secret");
 	
 	/* Change it to a different password */
 	gkr_keyring_login_attach_secret (GNOME_KEYRING_ITEM_GENERIC_SECRET,
@@ -133,8 +130,10 @@ void unit_test_keyrings_login_secrets (CuTest* cu)
 	password = gkr_keyring_login_lookup_secret (GNOME_KEYRING_ITEM_GENERIC_SECRET,
 	                                 "attr-string", "string",
 	                                 NULL);
-	CuAssert (cu, "no secret found in login keyring", password != NULL);
-	CuAssert (cu, "wrong secret found in login keyring", strcmp (password, "other") == 0);
+	/* "no secret found in login keyring" */
+	g_assert (password != NULL);
+	/* "wrong secret found in login keyring" */
+	g_assert_cmpstr (password, ==, "other");
 
 	/* Remove it */
 	gkr_keyring_login_remove_secret  (GNOME_KEYRING_ITEM_GENERIC_SECRET,
@@ -145,5 +144,6 @@ void unit_test_keyrings_login_secrets (CuTest* cu)
 	password = gkr_keyring_login_lookup_secret (GNOME_KEYRING_ITEM_GENERIC_SECRET,
 	                                 "attr-string", "string",
 	                                 NULL);
-	CuAssert (cu, "secret wasn't deleted properly", password == NULL);
+	/* "secret wasn't deleted properly" */
+	g_assert (password == NULL);
 }
diff --git a/daemon/keyrings/tests/unit-test-login-prompt.c b/daemon/keyrings/tests/unit-test-login-prompt.c
index 0be12f4..b0f957d 100644
--- a/daemon/keyrings/tests/unit-test-login-prompt.c
+++ b/daemon/keyrings/tests/unit-test-login-prompt.c
@@ -50,7 +50,7 @@ static void
 TELL(const char* what)
 	{ printf("INTERACTION: %s\n", what); }
 
-void unit_setup_keyrings_login (void)
+DEFINE_START(keyrings_login)
 {
 	/* Remove the current login keyring */
 	GkrKeyring *login = gkr_keyrings_get_login ();
@@ -61,55 +61,68 @@ void unit_setup_keyrings_login (void)
 static gboolean had_prompt = FALSE;
 
 static void 
-verify_ask (GkrAskRequest *req, gpointer data)
+verify_ask (GkrAskRequest *req, gpointer unused)
 {
-	CuTest *cu = (CuTest*)data;
-	
-	CuAssert (cu, "should only have one prompt", !had_prompt);
+	/* "should only have one prompt" */
+	g_assert (!had_prompt);
 	had_prompt = TRUE;
 }
 
-void unit_test_keyrings_login (CuTest* cu)
+DEFINE_TEST(keyrings_login)
 {
 	gboolean ret;
 
-	gkr_ask_daemon_set_hook (verify_ask, cu);
+	gkr_ask_daemon_set_hook (verify_ask, NULL);
 
-	CuAssert (cu, "login not marked locked", !gkr_keyring_login_is_unlocked ());
+	/* "login not marked locked" */
+	g_assert (!gkr_keyring_login_is_unlocked ());
 	
 	/* cancel the prompt */
 	TELL("Press 'DENY'");
 	had_prompt = FALSE;
 	ret = gkr_keyring_login_unlock (NULL);
-	CuAssert (cu, "no prompt appeared", had_prompt);
-	CuAssert (cu, "gkr_keyring_login_unlock() return TRUE", !ret);
-	CuAssert (cu, "login not marked locked", !gkr_keyring_login_is_unlocked ());
+	/* "no prompt appeared" */
+	g_assert (had_prompt);
+	/* "gkr_keyring_login_unlock() return TRUE" */
+	g_assert (!ret);
+	/* "login not marked locked" */
+	g_assert (!gkr_keyring_login_is_unlocked ());
 	
 	/* Now create a keyring */
 	TELL("Type 'blah' and press 'OK'");
 	had_prompt = FALSE;
 	ret = gkr_keyring_login_unlock (NULL);
-	CuAssert (cu, "no prompt appeared", had_prompt);
-	CuAssert (cu, "gkr_keyring_login_unlock() return FALSE", ret);
-	CuAssert (cu, "login not marked unlocked", gkr_keyring_login_is_unlocked ());
+	/*  "no prompt appeared" */
+	g_assert (had_prompt);
+	/* "gkr_keyring_login_unlock() return FALSE" */
+	g_assert (ret);
+	/* "login not marked unlocked" */
+	g_assert (gkr_keyring_login_is_unlocked ());
 	
 	/* Now lock it */
 	gkr_keyring_login_lock ();
-	CuAssert (cu, "didn't lock right keyring", !gkr_keyring_login_is_unlocked ());
+	/* "didn't lock right keyring" */
+	g_assert (!gkr_keyring_login_is_unlocked ());
 	
 	/* cancel the prompt */
 	TELL("Press 'DENY'");
 	had_prompt = FALSE;
 	ret = gkr_keyring_login_unlock (NULL);
-	CuAssert (cu, "no prompt appeared", had_prompt);
-	CuAssert (cu, "gkr_keyring_login_unlock() return TRUE", !ret);
-	CuAssert (cu, "login not marked locked", !gkr_keyring_login_is_unlocked ());
+	/* "no prompt appeared" */
+	g_assert (had_prompt);
+	/* "gkr_keyring_login_unlock() return TRUE" */
+	g_assert (!ret);
+	/* "login not marked locked" */
+	g_assert (!gkr_keyring_login_is_unlocked ());
 	
 	/* Now create a keyring */
 	TELL("Type 'blah' and press 'OK'");
 	had_prompt = FALSE;
 	ret = gkr_keyring_login_unlock (NULL);
-	CuAssert (cu, "no prompt appeared", had_prompt);
-	CuAssert (cu, "gkr_keyring_login_unlock() return FALSE", ret);
-	CuAssert (cu, "login not marked unlocked", gkr_keyring_login_is_unlocked ());
+	/* "no prompt appeared" */
+	g_assert (had_prompt);
+	/* "gkr_keyring_login_unlock() return FALSE" */
+	g_assert (ret);
+	/* "login not marked unlocked" */
+	g_assert (gkr_keyring_login_is_unlocked ());
 }
diff --git a/daemon/util/tests/.gitignore b/daemon/util/tests/.gitignore
index 7290a08..b23ddd1 100644
--- a/daemon/util/tests/.gitignore
+++ b/daemon/util/tests/.gitignore
@@ -3,4 +3,5 @@
 Makefile
 Makefile.in
 run-auto-test*
+run-prompt-test*
 
diff --git a/egg/tests/.gitignore b/egg/tests/.gitignore
index 1ff6d55..d21fd7e 100644
--- a/egg/tests/.gitignore
+++ b/egg/tests/.gitignore
@@ -6,3 +6,5 @@
 /Makefile
 /Makefile.in
 /run-auto-test
+run-prompt-test*
+
diff --git a/gcr/tests/.gitignore b/gcr/tests/.gitignore
index 217eaf9..3562174 100644
--- a/gcr/tests/.gitignore
+++ b/gcr/tests/.gitignore
@@ -6,3 +6,5 @@
 /.deps
 /.libs
 /ui-test-details
+run-prompt-test*
+
diff --git a/library/tests/Makefile.am b/library/tests/Makefile.am
index cacf5fe..dd26cc8 100644
--- a/library/tests/Makefile.am
+++ b/library/tests/Makefile.am
@@ -14,7 +14,4 @@ UNIT_LIBS =  \
 	$(top_builddir)/egg/libegg.la \
 	$(top_builddir)/library/libgnome-keyring.la
 
-UNIT_FLAGS = \
-	-DEXTERNAL_TEST
-	
-include $(top_srcdir)/tests/test.make
+include $(top_srcdir)/tests/gtest.make
diff --git a/library/tests/unit-test-daemon-setup.c b/library/tests/unit-test-daemon-setup.c
index 3e7cf9f..b8d822f 100644
--- a/library/tests/unit-test-daemon-setup.c
+++ b/library/tests/unit-test-daemon-setup.c
@@ -31,22 +31,9 @@
 
 #include "library/gnome-keyring.h"
 
-/* 
- * Each test looks like (on one line):
- *     void unit_test_xxxxx (CuTest* cu)
- * 
- * Each setup looks like (on one line):
- *     void unit_setup_xxxxx (void);
- * 
- * Each teardown looks like (on one line):
- *     void unit_teardown_xxxxx (void);
- * 
- * Tests be run in the order specified here.
- */
- 
 static GPid daemon_pid;
 
-void unit_setup_daemon (void)
+DEFINE_START(setup_daemon)
 {
 	GError *err = NULL;
 	gchar *args[3];
@@ -86,7 +73,7 @@ void unit_setup_daemon (void)
 	sleep (2);
 }
 
-void unit_teardown_daemon (void)
+DEFINE_STOP(setup_daemon)
 {
 	if (daemon_pid)
 		kill (daemon_pid, SIGTERM);
diff --git a/library/tests/unit-test-keyrings-prompt.c b/library/tests/unit-test-keyrings-prompt.c
index 5074336..5e37c08 100644
--- a/library/tests/unit-test-keyrings-prompt.c
+++ b/library/tests/unit-test-keyrings-prompt.c
@@ -30,19 +30,6 @@
 
 #include "library/gnome-keyring.h"
 
-/* 
- * Each test looks like (on one line):
- *     void unit_test_xxxxx (CuTest* cu)
- * 
- * Each setup looks like (on one line):
- *     void unit_setup_xxxxx (void);
- * 
- * Each teardown looks like (on one line):
- *     void unit_teardown_xxxxx (void);
- * 
- * Tests be run in the order specified here.
- */
- 
 static void 
 TELL(const char* what)
 {
@@ -56,50 +43,49 @@ gchar* default_keyring = NULL;
 #define DISPLAY_NAME "Item Display Name"
 #define SECRET "item-secret"
 
-void unit_test_stash_default (CuTest* cu)
+DEFINE_TEST(stash_default)
 {
 	GnomeKeyringResult res;
 	res = gnome_keyring_get_default_keyring_sync (&default_keyring);
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);	
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
 }
 
-void unit_test_create_prompt_keyring (CuTest* cu)
+DEFINE_TEST(create_prompt_keyring)
 {
 	GnomeKeyringResult res;
 
 	TELL("press 'DENY'");
 	res = gnome_keyring_create_sync (KEYRING_NAME, NULL);
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_DENIED, res);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_DENIED, ==, res);
 	
 	TELL("type in a new keyring password and click 'OK'");
 	
 	res = gnome_keyring_create_sync (KEYRING_NAME, NULL);
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
 
 	res = gnome_keyring_create_sync (KEYRING_NAME, NULL);
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_ALREADY_EXISTS, res);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_ALREADY_EXISTS, ==, res);
 	
 	res = gnome_keyring_set_default_keyring_sync (KEYRING_NAME);
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
 }
 
-
-void unit_test_change_prompt_keyring (CuTest* cu)
+DEFINE_TEST(change_prompt_keyring)
 {
 	GnomeKeyringResult res;
 
 	TELL("press 'DENY' here");	
 
 	res = gnome_keyring_change_password_sync (KEYRING_NAME, NULL, NULL); 
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_DENIED, res);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_DENIED, ==, res);
 	
 	TELL("type in original password then new keyring password and click 'OK'");
 
 	res = gnome_keyring_change_password_sync (KEYRING_NAME, NULL, NULL); 
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res); 
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
 }
 
-void unit_test_acls (CuTest* cu)
+DEFINE_TEST(acls)
 {
 	GnomeKeyringResult res;
 	GnomeKeyringAccessControl *ac, *acl;
@@ -111,11 +97,11 @@ void unit_test_acls (CuTest* cu)
 	/* Create teh item */
 	res = gnome_keyring_item_create_sync (KEYRING_NAME, GNOME_KEYRING_ITEM_GENERIC_SECRET, 
 	                                      "Fry", NULL, "secret", FALSE, &id);
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
 	
 	/* Get the ACLs */
 	gnome_keyring_item_get_acl_sync (KEYRING_NAME, id, &acls);
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
 
 	/* Make sure we're in the list, since we created */
 	prog = g_get_prgname ();
@@ -128,18 +114,20 @@ void unit_test_acls (CuTest* cu)
 		}
 	}
 	
-	CuAssert(cu, "couldn't find ACL for this process on new item", acl != NULL);
+	/* "couldn't find ACL for this process on new item" */
+	g_assert (acl != NULL);
 	
 	/* Now remove all ACLs from the item */
 	l = NULL;
 	gnome_keyring_item_set_acl_sync (KEYRING_NAME, id, l);
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
 	
 	/* Shouldn't be prompted here, not accessing secrets */
 	TELL("No prompt should show up at this point");
 	res = gnome_keyring_item_get_info_full_sync (KEYRING_NAME, id, GNOME_KEYRING_ITEM_INFO_BASICS, &info);
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);
-	CuAssert(cu, "returned a secret when it shouldn't have", gnome_keyring_item_info_get_secret (info) == NULL);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
+	/* "returned a secret when it shouldn't have" */
+	g_assert (gnome_keyring_item_info_get_secret (info) == NULL);
 	sleep(2);
 
 	/* Now try to read the item, should be prompted */
@@ -147,24 +135,25 @@ void unit_test_acls (CuTest* cu)
 	TELL("Press 'Allow Once' to give program access to the data");
 #endif
 	res = gnome_keyring_item_get_info_sync (KEYRING_NAME, id, &info); 
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);
-	CuAssert(cu, "didn't return a secret when it should have", gnome_keyring_item_info_get_secret (info) != NULL);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
+	/* "didn't return a secret when it should have" */
+	g_assert (gnome_keyring_item_info_get_secret (info) != NULL);
 	
 #ifdef ENABLE_ACL_PROMPTS
 	/* Now try to read the item again, give forever access */
 	TELL("Press 'Always Allow' to give program access to the data");
 	res = gnome_keyring_item_get_info_sync (KEYRING_NAME, id, &info); 
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
 	
 	/* Now try to read the item, should be prompted */
 	TELL("No prompt should show up at this point");
 	res = gnome_keyring_item_get_info_sync (KEYRING_NAME, id, &info); 
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
 	sleep(2);	
 #endif
 }
 
-void unit_test_application_secret (CuTest* cu)
+DEFINE_TEST(application_secret)
 {
 	GnomeKeyringResult res;
 	GnomeKeyringItemInfo *info;
@@ -175,43 +164,43 @@ void unit_test_application_secret (CuTest* cu)
 	res = gnome_keyring_item_create_sync (KEYRING_NAME, 
 			GNOME_KEYRING_ITEM_GENERIC_SECRET | GNOME_KEYRING_ITEM_APPLICATION_SECRET, 
 	                "Fry", NULL, "secret", FALSE, &id);
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
 
 	/* Remove all ACLs from the item */
 	acls = NULL;
 	gnome_keyring_item_set_acl_sync (KEYRING_NAME, id, acls);
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
 	
 	/* Shouldn't be prompted here, not accessing secrets */
 	TELL("No prompt should show up at this point");
 	res = gnome_keyring_item_get_info_full_sync (KEYRING_NAME, id, GNOME_KEYRING_ITEM_INFO_BASICS, &info);
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_DENIED, res);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_DENIED, ==, res);
 	sleep(2);
 
 	/* Now try to read the item, should be prompted */
 	TELL("No prompt should show up at this point");
 	res = gnome_keyring_item_get_info_sync (KEYRING_NAME, id, &info); 
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_DENIED, res);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_DENIED, ==, res);
 	sleep(2);
 }
 
-void unit_test_unlock_prompt (CuTest *cu)
+DEFINE_TEST(unlock_prompt)
 {
 	GnomeKeyringResult res;
 	
 	res = gnome_keyring_lock_all_sync ();
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
 
 	TELL("press 'DENY' here");
 	res = gnome_keyring_unlock_sync (KEYRING_NAME, NULL);
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_DENIED, res);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_DENIED, ==, res);
 
 	TELL("type in keyring password and click 'OK'");
 	res = gnome_keyring_unlock_sync (KEYRING_NAME, NULL);
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
 }
 
-void unit_test_find_locked (CuTest *cu)
+DEFINE_TEST(find_locked)
 {
 	GnomeKeyringResult res;
 	GnomeKeyringAttributeList* attrs;
@@ -234,21 +223,22 @@ void unit_test_find_locked (CuTest *cu)
 	/* Create teh item */
 	res = gnome_keyring_item_create_sync (NULL, GNOME_KEYRING_ITEM_GENERIC_SECRET, 
 	                                      "Yay!", attrs, SECRET, FALSE, &id);
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
 	
 	/* Lock the keyring ... */
 	res = gnome_keyring_lock_all_sync ();
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
 
 	/* Now, try to access the item */	
 	TELL("type in keyring password and click 'OK'");
 	res = gnome_keyring_find_items_sync (GNOME_KEYRING_ITEM_GENERIC_SECRET, attrs, &found);
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
 
-	CuAssert(cu, "Wrong number of items found", g_list_length (found) == 1);
+	/* "Wrong number of items found" */
+	g_assert_cmpint (g_list_length (found), ==, 1);
 }
 
-void unit_test_get_info_locked (CuTest *cu)
+DEFINE_TEST(get_info_locked)
 {
 	GnomeKeyringResult res;
 	GnomeKeyringItemInfo *info;
@@ -257,27 +247,27 @@ void unit_test_get_info_locked (CuTest *cu)
 	/* Create teh item */
 	res = gnome_keyring_item_create_sync (NULL, GNOME_KEYRING_ITEM_GENERIC_SECRET, 
 	                                      "My test locked", NULL, SECRET, FALSE, &id);
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
 	
 	/* Lock the keyring ... */
 	res = gnome_keyring_lock_all_sync ();
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
 
 	/* Now, try to access the item */	
 	TELL("type in keyring password and click 'OK'");
 	res = gnome_keyring_item_get_info_sync (NULL, id, &info);
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
 }
 
-void unit_test_cleaup (CuTest* cu)
+DEFINE_TEST(cleanup)
 {
 	GnomeKeyringResult res;
 	
 	res = gnome_keyring_delete_sync (KEYRING_NAME);
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);	
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
 
 	if (default_keyring) {
 		res = gnome_keyring_set_default_keyring_sync (default_keyring);
-		CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);
+		g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
 	}	
 }
diff --git a/library/tests/unit-test-keyrings.c b/library/tests/unit-test-keyrings.c
index c5a9717..46f2fe0 100644
--- a/library/tests/unit-test-keyrings.c
+++ b/library/tests/unit-test-keyrings.c
@@ -29,19 +29,6 @@
 
 #include "library/gnome-keyring.h"
 
-/* 
- * Each test looks like (on one line):
- *     void unit_test_xxxxx (CuTest* cu)
- * 
- * Each setup looks like (on one line):
- *     void unit_setup_xxxxx (void);
- * 
- * Each teardown looks like (on one line):
- *     void unit_teardown_xxxxx (void);
- * 
- * Tests be run in the order specified here.
- */
- 
 static GList* keyrings = NULL;
 
 #define PASSWORD "my-keyring-password"
@@ -50,75 +37,76 @@ static GList* keyrings = NULL;
 #define DISPLAY_NAME "Item Display Name"
 #define SECRET "item-secret"
 
-void unit_test_remove_incomplete (CuTest* cu)
+DEFINE_TEST(remove_incomplete)
 {
 	GnomeKeyringResult res;
 	
 	res = gnome_keyring_delete_sync (KEYRING_NAME);
-	if (res != GNOME_KEYRING_RESULT_NO_SUCH_KEYRING) 	
-		CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);	
+	if (res != GNOME_KEYRING_RESULT_NO_SUCH_KEYRING)
+		g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
 }
 
-void unit_test_create_keyring (CuTest* cu)
+DEFINE_TEST(create_keyring)
 {
 	GnomeKeyringResult res;
 	
 	/* No default keyring */
-	res = gnome_keyring_set_default_keyring_sync (NULL);	
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);	
+	res = gnome_keyring_set_default_keyring_sync (NULL);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
 	
 	res = gnome_keyring_create_sync (KEYRING_NAME, PASSWORD);
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
 	
 	res = gnome_keyring_create_sync (KEYRING_NAME, PASSWORD);
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_ALREADY_EXISTS, res);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_ALREADY_EXISTS, ==, res);
 }
 
-void unit_test_set_default_keyring (CuTest* cu)
+DEFINE_TEST(set_default_keyring)
 {
 	GnomeKeyringResult res;
 	gchar* name;
 	
 	res = gnome_keyring_set_default_keyring_sync (KEYRING_NAME);
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);	
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);	
 
 	res = gnome_keyring_set_default_keyring_sync (INVALID_KEYRING_NAME);
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_NO_SUCH_KEYRING, res);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_NO_SUCH_KEYRING, ==, res);
 		
 	res = gnome_keyring_get_default_keyring_sync (&name);
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);	
-	CuAssertPtrNotNull(cu, name);
-	CuAssertStrEquals(cu, name, KEYRING_NAME);	
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
+	g_assert (name != NULL);
+	g_assert_cmpstr (name, ==, KEYRING_NAME);
 }
 
-void unit_test_delete_keyring (CuTest* cu)
+DEFINE_TEST(delete_keyring)
 {
 	GnomeKeyringResult res;
 	gchar* name;
 	
 	res = gnome_keyring_delete_sync (KEYRING_NAME);
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);	
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
 	
 	res = gnome_keyring_delete_sync (KEYRING_NAME);
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_NO_SUCH_KEYRING, res);	
+	g_assert_cmpint (GNOME_KEYRING_RESULT_NO_SUCH_KEYRING, ==, res);	
 
 	res = gnome_keyring_get_default_keyring_sync (&name);
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);
-	CuAssert(cu, "returning deleted keyring as default", name == NULL || strcmp (name, KEYRING_NAME) != 0);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
+	/* "returning deleted keyring as default" */
+	g_assert(name == NULL || strcmp (name, KEYRING_NAME) != 0);
 }
 
-void unit_test_recreate_keyring (CuTest* cu)
+DEFINE_TEST(recreate_keyring)
 {
 	GnomeKeyringResult res;
 
 	/* Create the test keyring again and set as default */
 	res = gnome_keyring_create_sync (KEYRING_NAME, PASSWORD);
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);	
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
 	res = gnome_keyring_set_default_keyring_sync (KEYRING_NAME);
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);		
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
 }
 
-void unit_test_create_list_items (CuTest* cu)
+DEFINE_TEST(create_list_items)
 {
 	GnomeKeyringResult res;
 	guint id, id2, id3;
@@ -129,76 +117,81 @@ void unit_test_create_list_items (CuTest* cu)
 	/* Try in an invalid keyring */
 	res = gnome_keyring_item_create_sync (INVALID_KEYRING_NAME, GNOME_KEYRING_ITEM_GENERIC_SECRET, 
 	                                      DISPLAY_NAME, NULL, SECRET, FALSE, &id);
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_NO_SUCH_KEYRING, res);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_NO_SUCH_KEYRING, ==, res);
 
 	/* Create for real in valid keyring */
 	res = gnome_keyring_item_create_sync (KEYRING_NAME, GNOME_KEYRING_ITEM_GENERIC_SECRET, 
 	                                      DISPLAY_NAME, NULL, SECRET, FALSE, &id);
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
 
 	/* Update the item, shouldn't create new */
 	res = gnome_keyring_item_create_sync (KEYRING_NAME, GNOME_KEYRING_ITEM_GENERIC_SECRET, 
 	                                      DISPLAY_NAME, NULL, SECRET, TRUE, &id3);
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);
-	CuAssert(cu, "Updated item doesn't have the same id", id == id3);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
+	/* "Updated item doesn't have the same id" */
+	g_assert_cmpint (id, ==, id3);
 
 	/* Update in NULL keyring, should use default */
 	res = gnome_keyring_item_create_sync (NULL, GNOME_KEYRING_ITEM_GENERIC_SECRET, 
 	                                      DISPLAY_NAME, NULL, SECRET, TRUE, &id3);
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);
-	CuAssert(cu, "Updated item in NULL keyring doesn't have the same id", id == id3);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
+	/* "Updated item doesn't have the same id" */
+	g_assert_cmpint (id, ==, id3);
 			
 	/* Create new,  shouldn't update */
 	res = gnome_keyring_item_create_sync (KEYRING_NAME, GNOME_KEYRING_ITEM_GENERIC_SECRET, 
 	                                      "Another display name", NULL, SECRET, FALSE, &id2);
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);
-	CuAssert(cu, "Two items created with the same id", id2 != id);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
+	/* "Two items created with the same id" */
+	g_assert_cmpint (id, !=, id2);
 	
 	/* Set some attributes, NULL keyring = default */
 	attrs = gnome_keyring_attribute_list_new ();
 	gnome_keyring_attribute_list_append_string (attrs, "bender", "rocks");
 	res = gnome_keyring_item_set_attributes_sync (NULL, id, attrs);
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
 
 	/* List ids that were created */
 	res = gnome_keyring_list_item_ids_sync (KEYRING_NAME, &ids); 
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
 	
 	/* Check that they're the same ids */
-	CuAssert(cu, "Wrong number of ids created", g_list_length (ids) == 2);
+	/* "Wrong number of ids created" */
+	g_assert_cmpint (g_list_length (ids), ==, 2);
 	if (g_list_length (ids) == 2) {
-		CuAssertIntEquals(cu, id, GPOINTER_TO_UINT (ids->data));
-		CuAssertIntEquals(cu, id2, GPOINTER_TO_UINT (ids->next->data));
+		g_assert_cmpint (id, ==, GPOINTER_TO_UINT (ids->data));
+		g_assert_cmpint (id2, ==, GPOINTER_TO_UINT (ids->next->data));
 	}
 	
 	/* Now make sure both have that same secret */
 	res = gnome_keyring_item_get_info_sync (KEYRING_NAME, id, &info); 
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
 	if (res == GNOME_KEYRING_RESULT_OK)
-		CuAssert(cu, "Secret has changed", strcmp (gnome_keyring_item_info_get_secret (info), SECRET) == 0);	
+		/* "Secret has changed" */
+		g_assert_cmpstr (gnome_keyring_item_info_get_secret (info), ==, SECRET);	
 
 	/* And try it with a NULL (ie: default) keyring */
 	res = gnome_keyring_item_get_info_sync (NULL, id2, &info); 
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
 	if (res == GNOME_KEYRING_RESULT_OK)
-		CuAssert(cu, "Secret has changed", strcmp (gnome_keyring_item_info_get_secret (info), SECRET) == 0);
+		g_assert_cmpstr (gnome_keyring_item_info_get_secret (info), ==, SECRET);	
 		
 	/* Set the info back, should work */
 	res = gnome_keyring_item_set_info_sync (NULL, id2, info);
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
 
 	/* Make sure it's still the same */
 	res = gnome_keyring_item_get_info_sync (KEYRING_NAME, id, &info); 
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
 	if (res == GNOME_KEYRING_RESULT_OK)
-		CuAssert(cu, "Secret has changed", strcmp (gnome_keyring_item_info_get_secret (info), SECRET) == 0);	
+		g_assert_cmpstr (gnome_keyring_item_info_get_secret (info), ==, SECRET);	
 		
 	/* Now delete the item */
 	res = gnome_keyring_item_delete_sync (NULL, id);
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);	
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
 }
 
-void unit_test_find_keyrings (CuTest* cu)
+DEFINE_TEST(find_keyrings)
 {
 	GnomeKeyringResult res;
 	GnomeKeyringAttributeList* attrs;
@@ -216,20 +209,24 @@ void unit_test_find_keyrings (CuTest* cu)
 	/* Create the item */
 	res = gnome_keyring_item_create_sync ("session", GNOME_KEYRING_ITEM_GENERIC_SECRET, 
 	                                      "Barnyard", attrs, SECRET, TRUE, &id);
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
 	
 	/* Now try to find it */
 	res = gnome_keyring_find_items_sync (GNOME_KEYRING_ITEM_GENERIC_SECRET, attrs, &found);
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);
-	CuAssert(cu, "Too many items found", g_list_length (found) == 1);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
+	/* "Too many items found" */
+	g_assert_cmpint (g_list_length (found), ==, 1);
 
 	f = (GnomeKeyringFound*)found->data;	
-	CuAssert(cu, "Wrong item found", f->item_id == id);
-	CuAssert(cu, "Found in wrong keyring", strcmp (f->keyring, "session") == 0);
-	CuAssert(cu, "Wrong secret came back", strcmp (f->secret, SECRET) == 0);
+	/* "Wrong item found" */
+	g_assert (f->item_id == id);
+	/* "Found in wrong keyring" */
+	g_assert_cmpstr (f->keyring, ==, "session");
+	/* "Wrong secret came back" */
+	g_assert_cmpstr (f->secret, ==, SECRET);
 	
 	res = gnome_keyring_item_get_attributes_sync ("session", id, &attrs);
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
 	
 	/* Make sure that dog does in fact woof */
 	attr = NULL;
@@ -240,11 +237,14 @@ void unit_test_find_keyrings (CuTest* cu)
 			break;
 	}
 	
-	CuAssertPtrNotNull (cu, attr);
+	g_assert (attr != NULL);
 	if (attr) {
-		CuAssert (cu, "invalid attribute found", strcmp (attr->name, "dog") == 0);
-		CuAssert (cu, "invalid attribute type", attr->type == GNOME_KEYRING_ATTRIBUTE_TYPE_STRING);
-		CuAssert (cu, "invalid attribute value", strcmp (attr->value.string, "woof") == 0);
+		/* "invalid attribute found" */
+		g_assert_cmpstr (attr->name, ==, "dog");
+		/* "invalid attribute type" */
+		g_assert_cmpint (attr->type, ==, GNOME_KEYRING_ATTRIBUTE_TYPE_STRING);
+		/* "invalid attribute value" */
+		g_assert_cmpstr (attr->value.string, ==, "woof");
 	}
 }
 
@@ -252,7 +252,7 @@ void unit_test_find_keyrings (CuTest* cu)
  * A find that does not match should return 'Not Found':
  * http://bugzilla.gnome.org/show_bug.cgi?id=476682
  */
-void unit_test_find_invalid (CuTest* cu)
+DEFINE_TEST(find_invalid)
 {
 	GnomeKeyringResult res;
 	GnomeKeyringAttributeList* attrs;
@@ -263,54 +263,54 @@ void unit_test_find_invalid (CuTest* cu)
 	
 	/* Now try to find it */
 	res = gnome_keyring_find_items_sync (GNOME_KEYRING_ITEM_GENERIC_SECRET, attrs, &found);
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_NO_MATCH, res);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_NO_MATCH, ==, res);
 }
 
-void unit_test_lock_keyrings (CuTest* cu)
+DEFINE_TEST(lock_keyrings)
 {
 	GnomeKeyringResult res;
 
 	res = gnome_keyring_lock_all_sync ();
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
 	
 	res = gnome_keyring_unlock_sync (KEYRING_NAME, PASSWORD);
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
 
 	/* An unlock when already unlocked is fine */
 	res = gnome_keyring_unlock_sync (KEYRING_NAME, PASSWORD);
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
 
 	res = gnome_keyring_unlock_sync ("boooyaaah", PASSWORD);
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_NO_SUCH_KEYRING, res);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_NO_SUCH_KEYRING, ==, res);
 }
 
-void unit_test_change_password (CuTest* cu)
+DEFINE_TEST(change_password)
 {
 	GnomeKeyringResult res;
 	
 	res = gnome_keyring_change_password_sync (KEYRING_NAME, PASSWORD, "new password"); 
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);	
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
 }
 
-void unit_test_keyring_info (CuTest* cu)
+DEFINE_TEST(keyring_info)
 {
 	GnomeKeyringResult res;
 	GnomeKeyringInfo *info;
 	
 	res = gnome_keyring_get_info_sync (NULL, &info);
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);	
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
 
 	res = gnome_keyring_set_info_sync (NULL, info);
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);	
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
 }
 
-void unit_test_list_keyrings (CuTest* cu)
+DEFINE_TEST(list_keyrings)
 {
 	GnomeKeyringResult res;
 	GList *l;
 	
 	res = gnome_keyring_list_keyring_names_sync (&keyrings);
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
 
 	printf("\t\tkeyrings:\n");
 	for (l = keyrings; l; l = g_list_next (l))
@@ -319,13 +319,14 @@ void unit_test_list_keyrings (CuTest* cu)
 
 static GnomeKeyringResult grant_access_result = GNOME_KEYRING_RESULT_CANCELLED;
 
-static void done_grant_access (GnomeKeyringResult res, gpointer data)
+static void
+done_grant_access (GnomeKeyringResult res, gpointer data)
 {
 	grant_access_result = res;
 	test_mainloop_quit ();
 } 
 
-void unit_test_keyring_grant_access (CuTest *cu)
+DEFINE_TEST(keyring_grant_access)
 {
 	GList *acl, *l;
 	GnomeKeyringResult res;
@@ -336,37 +337,42 @@ void unit_test_keyring_grant_access (CuTest *cu)
 	/* Create teh item */
 	res = gnome_keyring_item_create_sync (NULL, GNOME_KEYRING_ITEM_GENERIC_SECRET, 
 	                                      "Barnyard", NULL, SECRET, FALSE, &id);
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
 	
 	/* Grant strange program access (async) */
 	grant_access_result = GNOME_KEYRING_RESULT_CANCELLED;
 	op = gnome_keyring_item_grant_access_rights (NULL, "Strange Application", 
 	                                             "/usr/bin/strangeness", id, 
 	                                             GNOME_KEYRING_ACCESS_READ, 
-	                                             done_grant_access, NULL, NULL); 
-	CuAssert(cu, "return null op", op != NULL);
-	CuAssert(cu, "callback already called", grant_access_result == GNOME_KEYRING_RESULT_CANCELLED);
+	                                             done_grant_access, NULL, NULL);
+	/* "return null op" */
+	g_assert (op != NULL);
+	/* "callback already called" */
+	g_assert_cmpint (grant_access_result, ==, GNOME_KEYRING_RESULT_CANCELLED);
 		
 	test_mainloop_run (2000);
 	
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, grant_access_result);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, grant_access_result);
 	
 	/* Now list the stuff */
 	res = gnome_keyring_item_get_acl_sync (NULL, id, &acl);
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
 
 	/* Make sure it's in the list */
 	found = FALSE;	
 	for (l = acl; l; l = g_list_next (l)) {
 		GnomeKeyringAccessControl *ac = (GnomeKeyringAccessControl*)l->data;
-		CuAssert(cu, "null access control", ac != NULL);
-		CuAssert(cu, "null access control pathname", gnome_keyring_item_ac_get_path_name (ac) != NULL);
+		/* "null access control" */
+		g_assert (ac != NULL);
+		/* "null access control pathname" */
+		g_assert (gnome_keyring_item_ac_get_path_name (ac) != NULL);
 		
 		if (strcmp (gnome_keyring_item_ac_get_path_name (ac), "/usr/bin/strangeness") == 0)
 			found = TRUE;
 	}
 	
-	CuAssert(cu, "couldn't find acces granted", found == TRUE);
+	/* "couldn't find acces granted" */
+	g_assert (found == TRUE);
 
 	gnome_keyring_acl_free (acl);
 }
@@ -391,7 +397,7 @@ done_store_password (GnomeKeyringResult res, gpointer data)
 	test_mainloop_quit ();
 } 
 
-void unit_test_store_password (CuTest *cu)
+DEFINE_TEST(store_password)
 {
 	GnomeKeyringResult res;
 	gpointer op;
@@ -400,7 +406,7 @@ void unit_test_store_password (CuTest *cu)
 	res = gnome_keyring_store_password_sync (&our_schema, NULL,
 	                                         "Display name", "password", 
 	                                         NULL);
-	CuAssertIntEquals (cu, GNOME_KEYRING_RESULT_BAD_ARGUMENTS, res);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_BAD_ARGUMENTS, ==, res);
 	
 	/* Synchronous, save to default keyring */
 	res = gnome_keyring_store_password_sync (&our_schema, NULL,
@@ -408,7 +414,7 @@ void unit_test_store_password (CuTest *cu)
 	                                         "dog", "woof", 
 	                                         "legs", 4,
 	                                         NULL);
-	CuAssertIntEquals (cu, GNOME_KEYRING_RESULT_OK, res);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
 
 	/* Asynchronous, save to session */
 	res = GNOME_KEYRING_RESULT_CANCELLED;
@@ -418,31 +424,34 @@ void unit_test_store_password (CuTest *cu)
                                            "dog", "woof", 
 	                                   "legs", 4,
 	                                   NULL);
-	CuAssert(cu, "async operation is NULL", op != NULL);
-	CuAssert(cu, "callback already called", res == GNOME_KEYRING_RESULT_CANCELLED);
+	/* "async operation is NULL" */
+	g_assert (op != NULL);
+	/* "callback already called" */
+	g_assert_cmpint (res, ==, GNOME_KEYRING_RESULT_CANCELLED);
 		
 	test_mainloop_run (2000);
 	
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
 }
 
 static GnomeKeyringResult find_password_result;
 
 static void 
-done_find_password (GnomeKeyringResult res, const gchar* password, gpointer data)
+done_find_password (GnomeKeyringResult res, const gchar* password, gpointer unused)
 {
 	find_password_result = res;
 	
 	if(res == GNOME_KEYRING_RESULT_OK) {
-		CuTest *cu = (CuTest*)data;
-		CuAssert(cu, "Null password returned", password != NULL);
-		CuAssert(cu, "Wrong returned from find", strcmp (password, "password") == 0);
+		/* "Null password returned" */
+		g_assert (password != NULL);
+		/* "Wrong returned from find" */
+		g_assert_cmpstr (password, ==, "password");
 	}
 
 	test_mainloop_quit ();
 } 
 
-void unit_test_find_password (CuTest *cu)
+DEFINE_TEST(find_password)
 {
 	GnomeKeyringResult res;
 	gchar *password;
@@ -451,30 +460,34 @@ void unit_test_find_password (CuTest *cu)
 	/* Synchronous, bad arguments */
 	res = gnome_keyring_find_password_sync (&our_schema, &password,
 	                                        NULL);
-	CuAssertIntEquals (cu, GNOME_KEYRING_RESULT_BAD_ARGUMENTS, res);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_BAD_ARGUMENTS, ==, res);
 	
 	/* Synchronous, valid*/
 	res = gnome_keyring_find_password_sync (&our_schema, &password,
 	                                        "dog", "woof", 
 	                                        "legs", 4,
 	                                        NULL);
-	CuAssertIntEquals (cu, GNOME_KEYRING_RESULT_OK, res);
-	CuAssert(cu, "Null password returned", password != NULL);
-	CuAssert(cu, "Wrong returned from find", strcmp (password, "password") == 0);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
+	/* "Null password returned" */
+	g_assert (password != NULL);
+	/* "Wrong returned from find" */
+	g_assert_cmpstr (password, ==, "password");
 	gnome_keyring_free_password (password);
 
 	/* Asynchronous, less arguments */
 	find_password_result = GNOME_KEYRING_RESULT_CANCELLED;
 	op = gnome_keyring_find_password (&our_schema, 
-	                                  done_find_password, cu, NULL,  
+	                                  done_find_password, NULL, NULL,
 	                                  "legs", 4,
 	                                  NULL);
-	CuAssert(cu, "async operation is NULL", op != NULL);
-	CuAssert(cu, "callback already called", find_password_result == GNOME_KEYRING_RESULT_CANCELLED);
+	/* "async operation is NULL" */
+	g_assert (op != NULL);
+	/* "callback already called" */
+	g_assert (find_password_result == GNOME_KEYRING_RESULT_CANCELLED);
 		
 	test_mainloop_run (2000);
 	
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, find_password_result);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, find_password_result);
 }
 
 static void 
@@ -484,21 +497,21 @@ done_delete_password (GnomeKeyringResult res, gpointer data)
 	test_mainloop_quit ();
 } 
 
-void unit_test_delete_password (CuTest *cu)
+DEFINE_TEST(delete_password)
 {
 	GnomeKeyringResult res;
 	gpointer op;
 	
 	/* Synchronous, bad arguments */
 	res = gnome_keyring_delete_password_sync (&our_schema, NULL);
-	CuAssertIntEquals (cu, GNOME_KEYRING_RESULT_BAD_ARGUMENTS, res);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_BAD_ARGUMENTS, ==, res);
 	
 	/* Synchronous, no match */
 	res = gnome_keyring_delete_password_sync (&our_schema, 
 	                                          "dog", "waoof", 
 	                                          "legs", 5,
 	                                          NULL);
-	CuAssertIntEquals (cu, GNOME_KEYRING_RESULT_NO_MATCH, res);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_NO_MATCH, ==, res);
 
 	/* Asynchronous, less arguments */
 	res = GNOME_KEYRING_RESULT_CANCELLED;
@@ -506,19 +519,21 @@ void unit_test_delete_password (CuTest *cu)
 	                                    done_delete_password, &res, NULL,  
 	                                    "legs", 4,
 	                                    NULL);
-	CuAssert(cu, "async operation is NULL", op != NULL);
-	CuAssert(cu, "callback already called", res == GNOME_KEYRING_RESULT_CANCELLED);
+	/* "async operation is NULL" */
+	g_assert (op != NULL);
+	/* "callback already called" */
+	g_assert (res == GNOME_KEYRING_RESULT_CANCELLED);
 		
 	test_mainloop_run (2000);
 	
 	/* Should have already been deleted by the second call above */
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
 }
 
-void unit_test_cleaup (CuTest* cu)
+DEFINE_TEST(cleanup)
 {
 	GnomeKeyringResult res;
 	
 	res = gnome_keyring_delete_sync (KEYRING_NAME);
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);	
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
 }
diff --git a/library/tests/unit-test-login-prompt.c b/library/tests/unit-test-login-prompt.c
index be1f1f0..9f1bc83 100644
--- a/library/tests/unit-test-login-prompt.c
+++ b/library/tests/unit-test-login-prompt.c
@@ -29,19 +29,6 @@
 #include "run-prompt-test.h"
 
 #include "library/gnome-keyring.h"
-
-/* 
- * Each test looks like (on one line):
- *     void unit_test_xxxxx (CuTest* cu)
- * 
- * Each setup looks like (on one line):
- *     void unit_setup_xxxxx (void);
- * 
- * Each teardown looks like (on one line):
- *     void unit_teardown_xxxxx (void);
- * 
- * Tests be run in the order specified here.
- */
  
 static void 
 TELL(const char* what)
@@ -57,61 +44,61 @@ TELL(const char* what)
 #define DISPLAY_NAME "Item Display Name"
 #define SECRET "item-secret"
 
-void unit_test_create_unlock_login (CuTest* cu)
+DEFINE_TEST(create_unlock_login)
 {
 	GnomeKeyringResult res;
 	
 	/* Remove the login keyring */
 	res = gnome_keyring_delete_sync (KEYRING_LOGIN);
 	if (res != GNOME_KEYRING_RESULT_NO_SUCH_KEYRING)
-		CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);
+		g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
 	
 	/* Now create it with our password */
 	res = gnome_keyring_create_sync (KEYRING_LOGIN, THE_PASSWORD);
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
 }
 
-void unit_test_auto_keyring (CuTest* cu)
+DEFINE_TEST(auto_keyring)
 {
 	GnomeKeyringResult res;
 
 	/* Remove the auto unlock keyring */
 	res = gnome_keyring_delete_sync (KEYRING_NAME);
 	if (res != GNOME_KEYRING_RESULT_NO_SUCH_KEYRING)
-		CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);
+		g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
 	
 	res = gnome_keyring_create_sync (KEYRING_NAME, THE_PASSWORD);
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
 	
 	res = gnome_keyring_lock_sync (KEYRING_NAME);
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);	
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
 
 	/* Prompt the user to unlock, and check the option */
 	TELL("type 'test' as the password and check the 'Automatically unlock' option");
 	res = gnome_keyring_unlock_sync (KEYRING_NAME, NULL);
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
 
 	res = gnome_keyring_lock_sync (KEYRING_NAME);
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);	
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
 
 	TELL("No prompt should show up at this point");
 	res = gnome_keyring_unlock_sync (KEYRING_NAME, NULL);
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
 	sleep(2);
 }
 
-void unit_test_auto_keyring_stale (CuTest* cu)
+DEFINE_TEST(auto_keyring_stale)
 {
 	GnomeKeyringResult res;
 	
 	/* Remove the auto unlock keyring */
 	res = gnome_keyring_change_password_sync (KEYRING_NAME, THE_PASSWORD, OTHER_PASSWORD);
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
 
 	res = gnome_keyring_lock_sync (KEYRING_NAME);
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);	
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
 	
 	TELL("Press 'deny' here");	
 	res = gnome_keyring_unlock_sync (KEYRING_NAME, NULL);
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_DENIED, res);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_DENIED, ==, res);
 }
diff --git a/library/tests/unit-test-memory.c b/library/tests/unit-test-memory.c
index 252fd7c..c7dcacb 100644
--- a/library/tests/unit-test-memory.c
+++ b/library/tests/unit-test-memory.c
@@ -29,19 +29,6 @@
 
 #include "library/gnome-keyring-memory.h"
 
-/* 
- * Each test looks like (on one line):
- *     void unit_test_xxxxx (CuTest* cu)
- * 
- * Each setup looks like (on one line):
- *     void unit_setup_xxxxx (void);
- * 
- * Each teardown looks like (on one line):
- *     void unit_teardown_xxxxx (void);
- * 
- * Tests be run in the order specified here.
- */
- 
 #define IS_ZERO ~0
  
 static gsize
@@ -56,86 +43,86 @@ find_non_zero (gpointer mem, gsize len)
 	
 	return IS_ZERO;
 }
- 
-void unit_test_alloc_free (CuTest* cu)
+
+DEFINE_TEST(alloc_free)
 {
 	gpointer p;
 	gboolean ret;
 	
 	p = gnome_keyring_memory_alloc (512);
-	CuAssertPtrNotNull (cu, p);
-	CuAssertIntEquals (cu, IS_ZERO, find_non_zero (p, 512));
+	g_assert (p != NULL);
+	g_assert_cmpint (IS_ZERO, ==, find_non_zero (p, 512));
 	
 	memset (p, 0x67, 512);
 	
 	ret = gnome_keyring_memory_is_secure (p);
-	CuAssertIntEquals (cu, ret, TRUE);
+	g_assert (ret == TRUE);
 	
 	gnome_keyring_memory_free (p);
 }
 
-void unit_test_alloc_two (CuTest* cu)
+DEFINE_TEST(alloc_two)
 {
 	gpointer p, p2;
 	gboolean ret;
 	
 	p2 = gnome_keyring_memory_alloc (4);
-	CuAssertPtrNotNull (cu, p2);
-	CuAssertIntEquals (cu, IS_ZERO, find_non_zero (p2, 4));
+	g_assert(p2 != NULL);
+	g_assert_cmpint (IS_ZERO, ==, find_non_zero (p2, 4));
 	
 	memset (p2, 0x67, 4);
 	
 	p = gnome_keyring_memory_alloc (16200);
-	CuAssertPtrNotNull (cu, p);
-	CuAssertIntEquals (cu, IS_ZERO, find_non_zero (p, 16200));
+	g_assert (p != NULL);
+	g_assert_cmpint (IS_ZERO, ==, find_non_zero (p, 16200));
 
 	memset (p, 0x67, 16200);
 	
 	ret = gnome_keyring_memory_is_secure (p);
-	CuAssertIntEquals (cu, ret, TRUE);
+	g_assert (ret == TRUE);
 	
 	gnome_keyring_memory_free (p2);
 	gnome_keyring_memory_free (p);
 }
 
-void unit_test_realloc (CuTest* cu)
+DEFINE_TEST(realloc)
 {
 	gchar *str = "a test string to see if realloc works properly";
 	gpointer p, p2;
-	int r;
 	gsize len;
 	
 	len = strlen (str) + 1;
 	
 	p = gnome_keyring_memory_realloc (NULL, len);
-	CuAssertPtrNotNull (cu, p);
-	CuAssertIntEquals (cu, IS_ZERO, find_non_zero (p, len));
+	g_assert (p != NULL);
+	g_assert_cmpint (IS_ZERO, ==, find_non_zero (p, len));
 	
 	strcpy ((gchar*)p, str);
 	
 	p2 = gnome_keyring_memory_realloc (p, 512);
-	CuAssertPtrNotNull (cu, p2);
+	g_assert (p2 != NULL);
 	
-	r = strcmp (p2, str);
-	CuAssert (cu, "strings not equal after realloc", r == 0);
+	/* "strings not equal after realloc" */
+	g_assert_cmpstr (p2, ==, str);
 	
 	p = gnome_keyring_memory_realloc (p2, 0);
-	CuAssert (cu, "should have freed memory", p == NULL);
+	/* "should have freed memory" */
+	g_assert (p == NULL);
 }
 
-void unit_test_realloc_across (CuTest *cu)
+DEFINE_TEST(realloc_across)
 {
 	gpointer p, p2;
 	
 	/* Tiny allocation */
 	p = gnome_keyring_memory_realloc (NULL, 1088);
-	CuAssertPtrNotNull (cu, p);
-	CuAssertIntEquals (cu, IS_ZERO, find_non_zero (p, 1088));
+	g_assert (p != NULL);
+	g_assert_cmpint (IS_ZERO, ==, find_non_zero (p, 1088));
 
 	/* Reallocate to a large one, will have to have changed blocks */	
 	p2 = gnome_keyring_memory_realloc (p, 16200);
-	CuAssertPtrNotNull (cu, p2);
-	CuAssertIntEquals (cu, IS_ZERO, find_non_zero (p2, 16200));
+	g_assert (p2 != NULL);
+	g_assert_cmpint (IS_ZERO, ==, find_non_zero (p2, 16200));
 	
 	gnome_keyring_memory_free (p2);
 }
diff --git a/library/tests/unit-test-other.c b/library/tests/unit-test-other.c
index f1e43a2..a61cdd5 100644
--- a/library/tests/unit-test-other.c
+++ b/library/tests/unit-test-other.c
@@ -42,55 +42,64 @@
  * Tests be run in the order specified here.
  */
  
-void unit_test_set_display (CuTest* cu)
+DEFINE_TEST(set_display)
 {
 	GnomeKeyringResult res;
 	
 	res = gnome_keyring_daemon_set_display_sync (":0.0");
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);	
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
 }
 
-void unit_test_setup_environment (CuTest* cu)
+DEFINE_TEST(setup_environment)
 {
 	GnomeKeyringResult res;
 
 	res = gnome_keyring_daemon_prepare_environment_sync ();
-	CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);
+	g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
 }
 
-void unit_test_result_string (CuTest* cu)
+DEFINE_TEST(result_string)
 {
 	const gchar *msg;
 	
-	msg = gnome_keyring_result_to_message (GNOME_KEYRING_RESULT_OK);	
-	CuAssert (cu, "should return an empty string", msg && !msg[0]);
+	msg = gnome_keyring_result_to_message (GNOME_KEYRING_RESULT_OK);
+	/* "should return an empty string" */
+	g_assert (msg && !msg[0]);
 
 	msg = gnome_keyring_result_to_message (GNOME_KEYRING_RESULT_CANCELLED); 	
-	CuAssert (cu, "should return an empty string", msg && !msg[0]);
+	/* "should return an empty string" */
+	g_assert (msg && !msg[0]);
 	
 	msg = gnome_keyring_result_to_message (GNOME_KEYRING_RESULT_DENIED);
-	CuAssert (cu, "should return a valid message", msg && msg[0]);
+	/* "should return an valid message" */
+	g_assert (msg && msg[0]);
 
 	msg = gnome_keyring_result_to_message (GNOME_KEYRING_RESULT_NO_KEYRING_DAEMON); 	
-	CuAssert (cu, "should return a valid message", msg && msg[0]);
+	/* "should return an valid message" */
+	g_assert (msg && msg[0]);
 
 	msg = gnome_keyring_result_to_message (GNOME_KEYRING_RESULT_NO_SUCH_KEYRING);
-	CuAssert (cu, "should return a valid message", msg && msg[0]);
+	/* "should return an valid message" */
+	g_assert (msg && msg[0]);
 
 	msg = gnome_keyring_result_to_message (GNOME_KEYRING_RESULT_BAD_ARGUMENTS); 	
-	CuAssert (cu, "should return a valid message", msg && msg[0]);
+	/* "should return an valid message" */
+	g_assert (msg && msg[0]);
 
 	msg = gnome_keyring_result_to_message (GNOME_KEYRING_RESULT_IO_ERROR);
-	CuAssert (cu, "should return a valid message", msg && msg[0]);
+	/* "should return an valid message" */
+	g_assert (msg && msg[0]);
 
 	msg = gnome_keyring_result_to_message (GNOME_KEYRING_RESULT_KEYRING_ALREADY_EXISTS); 	
-	CuAssert (cu, "should return a valid message", msg && msg[0]);
+	/* "should return an valid message" */
+	g_assert (msg && msg[0]);
 }
 
-void unit_test_is_available (CuTest* cu)
+DEFINE_TEST(is_available)
 {
 	gboolean ret;
 	
 	ret = gnome_keyring_is_available ();
-	CuAssert (cu, "gnome_is_available returned false", ret == TRUE);
+	/* "gnome_keyring_is_available returned false" */
+	g_assert (ret == TRUE);
 }
diff --git a/pam/tests/Makefile.am b/pam/tests/Makefile.am
index 33ec9b0..6c24787 100644
--- a/pam/tests/Makefile.am
+++ b/pam/tests/Makefile.am
@@ -6,8 +6,5 @@ UNIT_PROMPT = unit-test-pam-setup.c \
 
 UNIT_LIBS = \
 	-lpam
-
-UNIT_FLAGS = \
-	-DEXTERNAL_TEST
 	
-include $(top_srcdir)/tests/test.make
+include $(top_srcdir)/tests/gtest.make
diff --git a/pam/tests/unit-test-pam-setup.c b/pam/tests/unit-test-pam-setup.c
index 7beb1fa..4a161fa 100644
--- a/pam/tests/unit-test-pam-setup.c
+++ b/pam/tests/unit-test-pam-setup.c
@@ -32,19 +32,6 @@
 
 #include <security/pam_appl.h>
 
-/* 
- * Each test looks like (on one line):
- *     void unit_test_xxxxx (CuTest* cu)
- * 
- * Each setup looks like (on one line):
- *     void unit_setup_xxxxx (void);
- * 
- * Each teardown looks like (on one line):
- *     void unit_teardown_xxxxx (void);
- * 
- * Tests be run in the order specified here.
- */
-
 /* Used directly by the other tests */
 pam_handle_t *test_pamh = NULL;
   
@@ -92,7 +79,7 @@ conv_func (int n, const struct pam_message **msg,
 
 struct pam_conv conv = { conv_func, NULL };
 
-void unit_setup_pam (void)
+DEFINE_START(setup_pam)
 {
 	char user[1024];
 	int ret;
@@ -122,7 +109,7 @@ void unit_setup_pam (void)
 	g_assert (test_pamh);
 }	
 
-void unit_teardown_pam (void)
+DEFINE_STOP(setup_pam)
 {
 	g_assert (test_pamh);
 	pam_end (test_pamh, PAM_SUCCESS);
diff --git a/pam/tests/unit-test-pam.c b/pam/tests/unit-test-pam.c
index c597c0d..3e2679d 100644
--- a/pam/tests/unit-test-pam.c
+++ b/pam/tests/unit-test-pam.c
@@ -29,23 +29,10 @@
 #include "run-prompt-test.h"
 
 #include <security/pam_appl.h>
-
-/* 
- * Each test looks like (on one line):
- *     void unit_test_xxxxx (CuTest* cu)
- * 
- * Each setup looks like (on one line):
- *     void unit_setup_xxxxx (void);
- * 
- * Each teardown looks like (on one line):
- *     void unit_teardown_xxxxx (void);
- * 
- * Tests be run in the order specified here.
- */
  
 extern pam_handle_t *test_pamh;
 
-void unit_test_pam_open (CuTest* cu)
+DEFINE_TEST(pam_open)
 {
 	char** pam_env;
 
@@ -55,31 +42,32 @@ void unit_test_pam_open (CuTest* cu)
 	int ret = pam_authenticate (test_pamh, 0);
 	if (ret != PAM_SUCCESS)
 		g_printerr ("Bad user/password?\n\n");
-	CuAssertIntEquals (cu, PAM_SUCCESS, ret);
+	g_assert_cmpint (PAM_SUCCESS, ==, ret);
 	
 	pam_env = pam_getenvlist (test_pamh);
 	while (*pam_env)
 		putenv ((char*)*(pam_env++));
 
 	ret = pam_open_session (test_pamh, 0);
-	CuAssertIntEquals (cu, PAM_SUCCESS, ret);
+	g_assert_cmpint (PAM_SUCCESS, ==, ret);
 }
 
-void unit_test_pam_env (CuTest* cu)
+DEFINE_TEST(pam_env)
 {
 	const char *socket;
 
-		
 	socket = g_getenv ("GNOME_KEYRING_SOCKET");
-	CuAssert (cu, "socket should have been setup", socket && socket[0]);
-	CuAssert (cu, "socket should have been created", g_file_test (socket, G_FILE_TEST_EXISTS));
+	/* "socket should have been setup" */
+	g_assert (socket && socket[0]);
+	/* "socket should have been created" */
+	g_assert (g_file_test (socket, G_FILE_TEST_EXISTS));
 
 	g_printerr ("GNOME_KEYRING_SOCKET is: %s\n", g_getenv ("GNOME_KEYRING_SOCKET"));
 	sleep (3);
 }
 
-void unit_test_pam_close (CuTest* cu)
+DEFINE_TEST(pam_close)
 {
 	int ret = pam_close_session (test_pamh, 0);
-	CuAssertIntEquals (cu, PAM_SUCCESS, ret);
+	g_assert_cmpint (PAM_SUCCESS, ==, ret);
 }
diff --git a/pkcs11/rpc-layer/Makefile.am b/pkcs11/rpc-layer/Makefile.am
index 8b8af2f..16a575f 100644
--- a/pkcs11/rpc-layer/Makefile.am
+++ b/pkcs11/rpc-layer/Makefile.am
@@ -63,4 +63,3 @@ gck_rpc_daemon_standalone_LDADD = \
 	-ldl libgck-rpc-layer.la \
 	$(top_builddir)/egg/libegg-buffer.la \
 	$(top_builddir)/egg/libegg-creds.la
-	
diff --git a/pkcs11/ssh-store/tests/.gitignore b/pkcs11/ssh-store/tests/.gitignore
index 2b09315..f931abc 100644
--- a/pkcs11/ssh-store/tests/.gitignore
+++ b/pkcs11/ssh-store/tests/.gitignore
@@ -1,5 +1,8 @@
 /run-auto-test.*
-/.*
+.deps
+.libs
 /Makefile
 /Makefile.in
 /run-auto-test
+run-prompt-test*
+
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 2c35aff..0a8d227 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,14 +1,12 @@
 
 EXTRA_DIST = \
 	ca-example \
-	cu-test \
-	test-helpers.c test-helpers.h \
 	gtest-helpers.c gtest-helpers.h \
-	prep-tests.sh prep-gtest.sh \
+	prep-gtest.sh \
 	run-tests.sh \
-	test.make gtest.make
+	gtest.make
 
-INCLUDES=					\
+INCLUDES=				\
 	-I$(top_srcdir) 		\
 	-I$(top_builddir) 		\
 	$(GTK_CFLAGS) 			\
diff --git a/tests/cu-test/AllTests.c b/tests/cu-test/AllTests.c
deleted file mode 100644
index 5c849ef..0000000
--- a/tests/cu-test/AllTests.c
+++ /dev/null
@@ -1,25 +0,0 @@
-#include <stdio.h>
-
-#include "CuTest.h"
-
-CuSuite* CuGetSuite();
-CuSuite* CuStringGetSuite();
-
-void RunAllTests(void)
-{
-	CuString *output = CuStringNew();
-	CuSuite* suite = CuSuiteNew();
-
-	CuSuiteAddSuite(suite, CuGetSuite());
-	CuSuiteAddSuite(suite, CuStringGetSuite());
-
-	CuSuiteRun(suite);
-	CuSuiteSummary(suite, output);
-	CuSuiteDetails(suite, output);
-	printf("%s\n", output->buffer);
-}
-
-int main(void)
-{
-	RunAllTests();
-}
diff --git a/tests/cu-test/CuTest.c b/tests/cu-test/CuTest.c
deleted file mode 100644
index fb4950d..0000000
--- a/tests/cu-test/CuTest.c
+++ /dev/null
@@ -1,309 +0,0 @@
-#include <assert.h>
-#include <setjmp.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <math.h>
-
-#include "CuTest.h"
-
-/*-------------------------------------------------------------------------*
- * CuStr
- *-------------------------------------------------------------------------*/
-
-char* CuStrAlloc(int size)
-{
-	char* newStr = (char*) malloc( sizeof(char) * (size) );
-	return newStr;
-}
-
-char* CuStrCopy(const char* old)
-{
-	int len = strlen(old);
-	char* newStr = CuStrAlloc(len + 1);
-	strcpy(newStr, old);
-	return newStr;
-}
-
-/*-------------------------------------------------------------------------*
- * CuString
- *-------------------------------------------------------------------------*/
-
-void CuStringInit(CuString* str)
-{
-	str->length = 0;
-	str->size = STRING_MAX;
-	str->buffer = (char*) malloc(sizeof(char) * str->size);
-	str->buffer[0] = '\0';
-}
-
-CuString* CuStringNew(void)
-{
-	CuString* str = (CuString*) malloc(sizeof(CuString));
-	str->length = 0;
-	str->size = STRING_MAX;
-	str->buffer = (char*) malloc(sizeof(char) * str->size);
-	str->buffer[0] = '\0';
-	return str;
-}
-
-void CuStringResize(CuString* str, int newSize)
-{
-	str->buffer = (char*) realloc(str->buffer, sizeof(char) * newSize);
-	str->size = newSize;
-}
-
-void CuStringAppend(CuString* str, const char* text)
-{
-	int length;
-
-	if (text == NULL) {
-		text = "NULL";
-	}
-
-	length = strlen(text);
-	if (str->length + length + 1 >= str->size)
-		CuStringResize(str, str->length + length + 1 + STRING_INC);
-	str->length += length;
-	strcat(str->buffer, text);
-}
-
-void CuStringAppendChar(CuString* str, char ch)
-{
-	char text[2];
-	text[0] = ch;
-	text[1] = '\0';
-	CuStringAppend(str, text);
-}
-
-void CuStringAppendFormat(CuString* str, const char* format, ...)
-{
-	va_list argp;
-	char buf[HUGE_STRING_LEN];
-	va_start(argp, format);
-	vsprintf(buf, format, argp);
-	va_end(argp);
-	CuStringAppend(str, buf);
-}
-
-void CuStringInsert(CuString* str, const char* text, int pos)
-{
-	int length = strlen(text);
-	if (pos > str->length)
-		pos = str->length;
-	if (str->length + length + 1 >= str->size)
-		CuStringResize(str, str->length + length + 1 + STRING_INC);
-	memmove(str->buffer + pos + length, str->buffer + pos, (str->length - pos) + 1);
-	str->length += length;
-	memcpy(str->buffer + pos, text, length);
-}
-
-/*-------------------------------------------------------------------------*
- * CuTest
- *-------------------------------------------------------------------------*/
-
-void CuTestInit(CuTest* t, const char* name, TestFunction function)
-{
-	t->name = CuStrCopy(name);
-	t->failed = 0;
-	t->ran = 0;
-	t->message = NULL;
-	t->function = function;
-	t->jumpBuf = NULL;
-}
-
-CuTest* CuTestNew(const char* name, TestFunction function)
-{
-	CuTest* tc = CU_ALLOC(CuTest);
-	CuTestInit(tc, name, function);
-	return tc;
-}
-
-void CuTestRun(CuTest* tc)
-{
-	jmp_buf buf;
-	tc->jumpBuf = &buf;
-	if (setjmp(buf) == 0)
-	{
-		tc->ran = 1;
-		(tc->function)(tc);
-	}
-	tc->jumpBuf = 0;
-}
-
-static void CuFailInternal(CuTest* tc, const char* file, int line, CuString* string)
-{
-	char buf[HUGE_STRING_LEN];
-
-	sprintf(buf, "%s:%d: ", file, line);
-	CuStringInsert(string, buf, 0);
-
-	tc->failed = 1;
-	tc->message = string->buffer;
-	if (tc->jumpBuf != 0) longjmp(*(tc->jumpBuf), 0);
-}
-
-void CuFail_Line(CuTest* tc, const char* file, int line, const char* message2, const char* message)
-{
-	CuString string;
-
-	CuStringInit(&string);
-	if (message2 != NULL) 
-	{
-		CuStringAppend(&string, message2);
-		CuStringAppend(&string, ": ");
-	}
-	CuStringAppend(&string, message);
-	CuFailInternal(tc, file, line, &string);
-}
-
-void CuAssert_Line(CuTest* tc, const char* file, int line, const char* message, int condition)
-{
-	if (condition) return;
-	CuFail_Line(tc, file, line, NULL, message);
-}
-
-void CuAssertStrEquals_LineMsg(CuTest* tc, const char* file, int line, const char* message, 
-	const char* expected, const char* actual)
-{
-	CuString string;
-	if ((expected == NULL && actual == NULL) ||
-	    (expected != NULL && actual != NULL &&
-	     strcmp(expected, actual) == 0))
-	{
-		return;
-	}
-
-	CuStringInit(&string);
-	if (message != NULL) 
-	{
-		CuStringAppend(&string, message);
-		CuStringAppend(&string, ": ");
-	}
-	CuStringAppend(&string, "expected <");
-	CuStringAppend(&string, expected);
-	CuStringAppend(&string, "> but was <");
-	CuStringAppend(&string, actual);
-	CuStringAppend(&string, ">");
-	CuFailInternal(tc, file, line, &string);
-}
-
-void CuAssertIntEquals_LineMsg(CuTest* tc, const char* file, int line, const char* message, 
-	int expected, int actual)
-{
-	char buf[STRING_MAX];
-	if (expected == actual) return;
-	sprintf(buf, "expected <%d> but was <%d>", expected, actual);
-	CuFail_Line(tc, file, line, message, buf);
-}
-
-void CuAssertDblEquals_LineMsg(CuTest* tc, const char* file, int line, const char* message, 
-	double expected, double actual, double delta)
-{
-	char buf[STRING_MAX];
-	if (fabs(expected - actual) <= delta) return;
-	sprintf(buf, "expected <%lf> but was <%lf>", expected, actual);
-	CuFail_Line(tc, file, line, message, buf);
-}
-
-void CuAssertPtrEquals_LineMsg(CuTest* tc, const char* file, int line, const char* message, 
-	void* expected, void* actual)
-{
-	char buf[STRING_MAX];
-	if (expected == actual) return;
-	sprintf(buf, "expected pointer <0x%p> but was <0x%p>", expected, actual);
-	CuFail_Line(tc, file, line, message, buf);
-}
-
-
-/*-------------------------------------------------------------------------*
- * CuSuite
- *-------------------------------------------------------------------------*/
-
-void CuSuiteInit(CuSuite* testSuite)
-{
-	testSuite->count = 0;
-	testSuite->failCount = 0;
-}
-
-CuSuite* CuSuiteNew(void)
-{
-	CuSuite* testSuite = CU_ALLOC(CuSuite);
-	CuSuiteInit(testSuite);
-	return testSuite;
-}
-
-void CuSuiteAdd(CuSuite* testSuite, CuTest *testCase)
-{
-	assert(testSuite->count < MAX_TEST_CASES);
-	testSuite->list[testSuite->count] = testCase;
-	testSuite->count++;
-}
-
-void CuSuiteAddSuite(CuSuite* testSuite, CuSuite* testSuite2)
-{
-	int i;
-	for (i = 0 ; i < testSuite2->count ; ++i)
-	{
-		CuTest* testCase = testSuite2->list[i];
-		CuSuiteAdd(testSuite, testCase);
-	}
-}
-
-void CuSuiteRun(CuSuite* testSuite)
-{
-	int i;
-	for (i = 0 ; i < testSuite->count ; ++i)
-	{
-		CuTest* testCase = testSuite->list[i];
-		CuTestRun(testCase);
-		if (testCase->failed) { testSuite->failCount += 1; }
-	}
-}
-
-void CuSuiteSummary(CuSuite* testSuite, CuString* summary)
-{
-	int i;
-	for (i = 0 ; i < testSuite->count ; ++i)
-	{
-		CuTest* testCase = testSuite->list[i];
-		CuStringAppend(summary, testCase->failed ? "F" : ".");
-	}
-	CuStringAppend(summary, "\n\n");
-}
-
-void CuSuiteDetails(CuSuite* testSuite, CuString* details)
-{
-	int i;
-	int failCount = 0;
-
-	if (testSuite->failCount == 0)
-	{
-		int passCount = testSuite->count - testSuite->failCount;
-		const char* testWord = passCount == 1 ? "test" : "tests";
-		CuStringAppendFormat(details, "OK (%d %s)\n", passCount, testWord);
-	}
-	else
-	{
-		if (testSuite->failCount == 1)
-			CuStringAppend(details, "There was 1 failure:\n");
-		else
-			CuStringAppendFormat(details, "There were %d failures:\n", testSuite->failCount);
-
-		for (i = 0 ; i < testSuite->count ; ++i)
-		{
-			CuTest* testCase = testSuite->list[i];
-			if (testCase->failed)
-			{
-				failCount++;
-				CuStringAppendFormat(details, "%d) %s: %s\n",
-					failCount, testCase->name, testCase->message);
-			}
-		}
-		CuStringAppend(details, "\n!!!FAILURES!!!\n");
-
-		CuStringAppendFormat(details, "Runs: %d ",   testSuite->count);
-		CuStringAppendFormat(details, "Passes: %d ", testSuite->count - testSuite->failCount);
-		CuStringAppendFormat(details, "Fails: %d\n",  testSuite->failCount);
-	}
-}
diff --git a/tests/cu-test/CuTest.h b/tests/cu-test/CuTest.h
deleted file mode 100644
index 78c4146..0000000
--- a/tests/cu-test/CuTest.h
+++ /dev/null
@@ -1,111 +0,0 @@
-#ifndef CU_TEST_H
-#define CU_TEST_H
-
-#include <setjmp.h>
-#include <stdarg.h>
-
-/* CuString */
-
-char* CuStrAlloc(int size);
-char* CuStrCopy(const char* old);
-
-#define CU_ALLOC(TYPE)		((TYPE*) malloc(sizeof(TYPE)))
-
-#define HUGE_STRING_LEN	8192
-#define STRING_MAX		256
-#define STRING_INC		256
-
-typedef struct
-{
-	int length;
-	int size;
-	char* buffer;
-} CuString;
-
-void CuStringInit(CuString* str);
-CuString* CuStringNew(void);
-void CuStringRead(CuString* str, const char* path);
-void CuStringAppend(CuString* str, const char* text);
-void CuStringAppendChar(CuString* str, char ch);
-void CuStringAppendFormat(CuString* str, const char* format, ...);
-void CuStringInsert(CuString* str, const char* text, int pos);
-void CuStringResize(CuString* str, int newSize);
-
-/* CuTest */
-
-typedef struct CuTest CuTest;
-
-typedef void (*TestFunction)(CuTest *);
-
-struct CuTest
-{
-	const char* name;
-	TestFunction function;
-	int failed;
-	int ran;
-	const char* message;
-	jmp_buf *jumpBuf;
-};
-
-void CuTestInit(CuTest* t, const char* name, TestFunction function);
-CuTest* CuTestNew(const char* name, TestFunction function);
-void CuTestRun(CuTest* tc);
-
-/* Internal versions of assert functions -- use the public versions */
-void CuFail_Line(CuTest* tc, const char* file, int line, const char* message2, const char* message);
-void CuAssert_Line(CuTest* tc, const char* file, int line, const char* message, int condition);
-void CuAssertStrEquals_LineMsg(CuTest* tc, 
-	const char* file, int line, const char* message, 
-	const char* expected, const char* actual);
-void CuAssertIntEquals_LineMsg(CuTest* tc, 
-	const char* file, int line, const char* message, 
-	int expected, int actual);
-void CuAssertDblEquals_LineMsg(CuTest* tc, 
-	const char* file, int line, const char* message, 
-	double expected, double actual, double delta);
-void CuAssertPtrEquals_LineMsg(CuTest* tc, 
-	const char* file, int line, const char* message, 
-	void* expected, void* actual);
-
-/* public assert functions */
-
-#define CuFail(tc, ms)                        CuFail_Line(  (tc), __FILE__, __LINE__, NULL, (ms))
-#define CuAssert(tc, ms, cond)                CuAssert_Line((tc), __FILE__, __LINE__, (ms), (cond))
-#define CuAssertTrue(tc, cond)                CuAssert_Line((tc), __FILE__, __LINE__, "assert failed", (cond))
-
-#define CuAssertStrEquals(tc,ex,ac)           CuAssertStrEquals_LineMsg((tc),__FILE__,__LINE__,NULL,(ex),(ac))
-#define CuAssertStrEquals_Msg(tc,ms,ex,ac)    CuAssertStrEquals_LineMsg((tc),__FILE__,__LINE__,(ms),(ex),(ac))
-#define CuAssertIntEquals(tc,ex,ac)           CuAssertIntEquals_LineMsg((tc),__FILE__,__LINE__,NULL,(ex),(ac))
-#define CuAssertIntEquals_Msg(tc,ms,ex,ac)    CuAssertIntEquals_LineMsg((tc),__FILE__,__LINE__,(ms),(ex),(ac))
-#define CuAssertDblEquals(tc,ex,ac,dl)        CuAssertDblEquals_LineMsg((tc),__FILE__,__LINE__,NULL,(ex),(ac),(dl))
-#define CuAssertDblEquals_Msg(tc,ms,ex,ac,dl) CuAssertDblEquals_LineMsg((tc),__FILE__,__LINE__,(ms),(ex),(ac),(dl))
-#define CuAssertPtrEquals(tc,ex,ac)           CuAssertPtrEquals_LineMsg((tc),__FILE__,__LINE__,NULL,(ex),(ac))
-#define CuAssertPtrEquals_Msg(tc,ms,ex,ac)    CuAssertPtrEquals_LineMsg((tc),__FILE__,__LINE__,(ms),(ex),(ac))
-
-#define CuAssertPtrNotNull(tc,p)        CuAssert_Line((tc),__FILE__,__LINE__,"null pointer unexpected",(p != NULL))
-#define CuAssertPtrNotNullMsg(tc,msg,p) CuAssert_Line((tc),__FILE__,__LINE__,(msg),(p != NULL))
-
-/* CuSuite */
-
-#define MAX_TEST_CASES	1024
-
-#define SUITE_ADD_TEST(SUITE,TEST)	CuSuiteAdd(SUITE, CuTestNew(#TEST, TEST))
-
-typedef struct
-{
-	int count;
-	CuTest* list[MAX_TEST_CASES];
-	int failCount;
-
-} CuSuite;
-
-
-void CuSuiteInit(CuSuite* testSuite);
-CuSuite* CuSuiteNew(void);
-void CuSuiteAdd(CuSuite* testSuite, CuTest *testCase);
-void CuSuiteAddSuite(CuSuite* testSuite, CuSuite* testSuite2);
-void CuSuiteRun(CuSuite* testSuite);
-void CuSuiteSummary(CuSuite* testSuite, CuString* summary);
-void CuSuiteDetails(CuSuite* testSuite, CuString* details);
-
-#endif /* CU_TEST_H */
diff --git a/tests/cu-test/CuTestTest.c b/tests/cu-test/CuTestTest.c
deleted file mode 100644
index 547f119..0000000
--- a/tests/cu-test/CuTestTest.c
+++ /dev/null
@@ -1,709 +0,0 @@
-#include <assert.h>
-#include <setjmp.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#include "CuTest.h"
-
-/*-------------------------------------------------------------------------*
- * Helper functions
- *-------------------------------------------------------------------------*/
-
-#define CompareAsserts(tc, message, expected, actual)  X_CompareAsserts((tc), __FILE__, __LINE__, (message), (expected), (actual))
-
-static void X_CompareAsserts(CuTest* tc, const char *file, int line, const char* message, const char* expected, const char* actual)
-{
-	int mismatch;
-	if (expected == NULL || actual == NULL) {
-		mismatch = (expected != NULL || actual != NULL);
-	} else {
-		const char *front = __FILE__ ":";
-		const size_t frontLen = strlen(front);
-		const size_t expectedLen = strlen(expected);
-
-		const char *matchStr = actual;
-
-		mismatch = (strncmp(matchStr, front, frontLen) != 0);
-		if (!mismatch) {
-			matchStr = strchr(matchStr + frontLen, ':');
-			mismatch |= (matchStr == NULL || strncmp(matchStr, ": ", 2));
-			if (!mismatch) {
-				matchStr += 2;
-				mismatch |= (strncmp(matchStr, expected, expectedLen) != 0);
-			}
-		}
-	}
-
-	CuAssert_Line(tc, file, line, message, !mismatch);
-}
-
-/*-------------------------------------------------------------------------*
- * CuString Test
- *-------------------------------------------------------------------------*/
-
-void TestCuStringNew(CuTest* tc)
-{
-	CuString* str = CuStringNew();
-	CuAssertTrue(tc, 0 == str->length);
-	CuAssertTrue(tc, 0 != str->size);
-	CuAssertStrEquals(tc, "", str->buffer);
-}
-
-
-void TestCuStringAppend(CuTest* tc)
-{
-	CuString* str = CuStringNew();
-	CuStringAppend(str, "hello");
-	CuAssertIntEquals(tc, 5, str->length);
-	CuAssertStrEquals(tc, "hello", str->buffer);
-	CuStringAppend(str, " world");
-	CuAssertIntEquals(tc, 11, str->length);
-	CuAssertStrEquals(tc, "hello world", str->buffer);
-}
-
-
-void TestCuStringAppendNULL(CuTest* tc)
-{
-	CuString* str = CuStringNew();
-	CuStringAppend(str, NULL);
-	CuAssertIntEquals(tc, 4, str->length);
-	CuAssertStrEquals(tc, "NULL", str->buffer);
-}
-
-
-void TestCuStringAppendChar(CuTest* tc)
-{
-	CuString* str = CuStringNew();
-	CuStringAppendChar(str, 'a');
-	CuStringAppendChar(str, 'b');
-	CuStringAppendChar(str, 'c');
-	CuStringAppendChar(str, 'd');
-	CuAssertIntEquals(tc, 4, str->length);
-	CuAssertStrEquals(tc, "abcd", str->buffer);
-}
-
-
-void TestCuStringInserts(CuTest* tc)
-{
-	CuString* str = CuStringNew();
-	CuStringAppend(str, "world");
-	CuAssertIntEquals(tc, 5, str->length);
-	CuAssertStrEquals(tc, "world", str->buffer);
-	CuStringInsert(str, "hell", 0);
-	CuAssertIntEquals(tc, 9, str->length);
-	CuAssertStrEquals(tc, "hellworld", str->buffer);
-	CuStringInsert(str, "o ", 4);
-	CuAssertIntEquals(tc, 11, str->length);
-	CuAssertStrEquals(tc, "hello world", str->buffer);
-	CuStringInsert(str, "!", 11);
-	CuAssertIntEquals(tc, 12, str->length);
-	CuAssertStrEquals(tc, "hello world!", str->buffer);
-}
-
-
-void TestCuStringResizes(CuTest* tc)
-{
-	CuString* str = CuStringNew();
-	int i;
-	for(i = 0 ; i < STRING_MAX ; ++i)
-	{
-		CuStringAppend(str, "aa");
-	}
-	CuAssertTrue(tc, STRING_MAX * 2 == str->length);
-	CuAssertTrue(tc, STRING_MAX * 2 <= str->size);
-}
-
-CuSuite* CuStringGetSuite(void)
-{
-	CuSuite* suite = CuSuiteNew();
-
-	SUITE_ADD_TEST(suite, TestCuStringNew);
-	SUITE_ADD_TEST(suite, TestCuStringAppend);
-	SUITE_ADD_TEST(suite, TestCuStringAppendNULL);
-	SUITE_ADD_TEST(suite, TestCuStringAppendChar);
-	SUITE_ADD_TEST(suite, TestCuStringInserts);
-	SUITE_ADD_TEST(suite, TestCuStringResizes);
-
-	return suite;
-}
-
-/*-------------------------------------------------------------------------*
- * CuTest Test
- *-------------------------------------------------------------------------*/
-
-void TestPasses(CuTest* tc)
-{
-	CuAssert(tc, "test should pass", 1 == 0 + 1);
-}
-
-void zTestFails(CuTest* tc)
-{
-	CuAssert(tc, "test should fail", 1 == 1 + 1);
-}
-
-
-void TestCuTestNew(CuTest* tc)
-{
-	CuTest* tc2 = CuTestNew("MyTest", TestPasses);
-	CuAssertStrEquals(tc, "MyTest", tc2->name);
-	CuAssertTrue(tc, !tc2->failed);
-	CuAssertTrue(tc, tc2->message == NULL);
-	CuAssertTrue(tc, tc2->function == TestPasses);
-	CuAssertTrue(tc, tc2->ran == 0);
-	CuAssertTrue(tc, tc2->jumpBuf == NULL);
-}
-
-
-void TestCuTestInit(CuTest *tc)
-{
-	CuTest tc2;
-	CuTestInit(&tc2, "MyTest", TestPasses);
-	CuAssertStrEquals(tc, "MyTest", tc2.name);
-	CuAssertTrue(tc, !tc2.failed);
-	CuAssertTrue(tc, tc2.message == NULL);
-	CuAssertTrue(tc, tc2.function == TestPasses);
-	CuAssertTrue(tc, tc2.ran == 0);
-	CuAssertTrue(tc, tc2.jumpBuf == NULL);
-}
-
-void TestCuAssert(CuTest* tc)
-{
-	CuTest tc2;
-	CuTestInit(&tc2, "MyTest", TestPasses);
-
-	CuAssert(&tc2, "test 1", 5 == 4 + 1);
-	CuAssertTrue(tc, !tc2.failed);
-	CuAssertTrue(tc, tc2.message == NULL);
-
-	CuAssert(&tc2, "test 2", 0);
-	CuAssertTrue(tc, tc2.failed);
-	CompareAsserts(tc, "CuAssert didn't fail", "test 2", tc2.message);
-
-	CuAssert(&tc2, "test 3", 1);
-	CuAssertTrue(tc, tc2.failed);
-	CompareAsserts(tc, "CuAssert didn't fail", "test 2", tc2.message);
-
-	CuAssert(&tc2, "test 4", 0);
-	CuAssertTrue(tc, tc2.failed);
-	CompareAsserts(tc, "CuAssert didn't fail", "test 4", tc2.message);
-
-}
-
-void TestCuAssertPtrEquals_Success(CuTest* tc)
-{
-	CuTest tc2;
-	int x;
-
-	CuTestInit(&tc2, "MyTest", TestPasses);
-
-	/* test success case */
-	CuAssertPtrEquals(&tc2, &x, &x);
-	CuAssertTrue(tc, ! tc2.failed);
-	CuAssertTrue(tc, NULL == tc2.message);
-}
-
-void TestCuAssertPtrEquals_Failure(CuTest* tc)
-{
-	CuTest tc2;
-	int x;
-	int* nullPtr = NULL;
-	char expected_message[STRING_MAX];
-
-	CuTestInit(&tc2, "MyTest", TestPasses);
-
-	/* test failing case */
-	sprintf(expected_message, "expected pointer <0x%p> but was <0x%p>", nullPtr, &x);
-	CuAssertPtrEquals(&tc2, NULL, &x);
-	CuAssertTrue(tc, tc2.failed);
-	CompareAsserts(tc, "CuAssertPtrEquals failed", expected_message, tc2.message);
-}
-
-void TestCuAssertPtrNotNull_Success(CuTest* tc)
-{
-	CuTest tc2;
-	int x;
-
-	CuTestInit(&tc2, "MyTest", TestPasses);
-
-	/* test success case */
-	CuAssertPtrNotNull(&tc2, &x);
-	CuAssertTrue(tc, ! tc2.failed);
-	CuAssertTrue(tc, NULL == tc2.message);
-}
-
-void TestCuAssertPtrNotNull_Failure(CuTest* tc)
-{
-	CuTest tc2;
-
-	CuTestInit(&tc2, "MyTest", TestPasses);
-
-	/* test failing case */
-	CuAssertPtrNotNull(&tc2, NULL);
-	CuAssertTrue(tc, tc2.failed);
-	CompareAsserts(tc, "CuAssertPtrNotNull failed", "null pointer unexpected", tc2.message);
-}
-
-void TestCuTestRun(CuTest* tc)
-{
-	CuTest tc2;
-	CuTestInit(&tc2, "MyTest", zTestFails);
-	CuTestRun(&tc2);
-
-	CuAssertStrEquals(tc, "MyTest", tc2.name);
-	CuAssertTrue(tc, tc2.failed);
-	CuAssertTrue(tc, tc2.ran);
-	CompareAsserts(tc, "TestRun failed", "test should fail", tc2.message);
-}
-
-/*-------------------------------------------------------------------------*
- * CuSuite Test
- *-------------------------------------------------------------------------*/
-
-void TestCuSuiteInit(CuTest* tc)
-{
-	CuSuite ts;
-	CuSuiteInit(&ts);
-	CuAssertTrue(tc, ts.count == 0);
-	CuAssertTrue(tc, ts.failCount == 0);
-}
-
-void TestCuSuiteNew(CuTest* tc)
-{
-	CuSuite* ts = CuSuiteNew();
-	CuAssertTrue(tc, ts->count == 0);
-	CuAssertTrue(tc, ts->failCount == 0);
-}
-
-void TestCuSuiteAddTest(CuTest* tc)
-{
-	CuSuite ts;
-	CuTest tc2;
-
-	CuSuiteInit(&ts);
-	CuTestInit(&tc2, "MyTest", zTestFails);
-
-	CuSuiteAdd(&ts, &tc2);
-	CuAssertTrue(tc, ts.count == 1);
-
-	CuAssertStrEquals(tc, "MyTest", ts.list[0]->name);
-}
-
-void TestCuSuiteAddSuite(CuTest* tc)
-{
-	CuSuite* ts1 = CuSuiteNew();
-	CuSuite* ts2 = CuSuiteNew();
-
-	CuSuiteAdd(ts1, CuTestNew("TestFails1", zTestFails));
-	CuSuiteAdd(ts1, CuTestNew("TestFails2", zTestFails));
-
-	CuSuiteAdd(ts2, CuTestNew("TestFails3", zTestFails));
-	CuSuiteAdd(ts2, CuTestNew("TestFails4", zTestFails));
-
-	CuSuiteAddSuite(ts1, ts2);
-	CuAssertIntEquals(tc, 4, ts1->count);
-
-	CuAssertStrEquals(tc, "TestFails1", ts1->list[0]->name);
-	CuAssertStrEquals(tc, "TestFails2", ts1->list[1]->name);
-	CuAssertStrEquals(tc, "TestFails3", ts1->list[2]->name);
-	CuAssertStrEquals(tc, "TestFails4", ts1->list[3]->name);
-}
-
-void TestCuSuiteRun(CuTest* tc)
-{
-	CuSuite ts;
-	CuTest tc1, tc2, tc3, tc4;
-
-	CuSuiteInit(&ts);
-	CuTestInit(&tc1, "TestPasses", TestPasses);
-	CuTestInit(&tc2, "TestPasses", TestPasses);
-	CuTestInit(&tc3, "TestFails",  zTestFails);
-	CuTestInit(&tc4, "TestFails",  zTestFails);
-
-	CuSuiteAdd(&ts, &tc1);
-	CuSuiteAdd(&ts, &tc2);
-	CuSuiteAdd(&ts, &tc3);
-	CuSuiteAdd(&ts, &tc4);
-	CuAssertTrue(tc, ts.count == 4);
-
-	CuSuiteRun(&ts);
-	CuAssertTrue(tc, ts.count - ts.failCount == 2);
-	CuAssertTrue(tc, ts.failCount == 2);
-}
-
-void TestCuSuiteSummary(CuTest* tc)
-{
-	CuSuite ts;
-	CuTest tc1, tc2;
-	CuString summary;
-
-	CuSuiteInit(&ts);
-	CuTestInit(&tc1, "TestPasses", TestPasses);
-	CuTestInit(&tc2, "TestFails",  zTestFails);
-	CuStringInit(&summary);
-
-	CuSuiteAdd(&ts, &tc1);
-	CuSuiteAdd(&ts, &tc2);
-	CuSuiteRun(&ts);
-
-	CuSuiteSummary(&ts, &summary);
-
-	CuAssertTrue(tc, ts.count == 2);
-	CuAssertTrue(tc, ts.failCount == 1);
-	CuAssertStrEquals(tc, ".F\n\n", summary.buffer);
-}
-
-
-void TestCuSuiteDetails_SingleFail(CuTest* tc)
-{
-	CuSuite ts;
-	CuTest tc1, tc2;
-	CuString details;
-	const char* front;
-	const char* back;
-
-	CuSuiteInit(&ts);
-	CuTestInit(&tc1, "TestPasses", TestPasses);
-	CuTestInit(&tc2, "TestFails",  zTestFails);
-	CuStringInit(&details);
-
-	CuSuiteAdd(&ts, &tc1);
-	CuSuiteAdd(&ts, &tc2);
-	CuSuiteRun(&ts);
-
-	CuSuiteDetails(&ts, &details);
-
-	CuAssertTrue(tc, ts.count == 2);
-	CuAssertTrue(tc, ts.failCount == 1);
-
-	front = "There was 1 failure:\n"
-		"1) TestFails: ";
-	back =  "test should fail\n"
-		"\n!!!FAILURES!!!\n"
-		"Runs: 2 Passes: 1 Fails: 1\n";
-
-	CuAssertStrEquals(tc, back, details.buffer + strlen(details.buffer) - strlen(back));
-	details.buffer[strlen(front)] = 0;
-	CuAssertStrEquals(tc, front, details.buffer);
-}
-
-
-void TestCuSuiteDetails_SinglePass(CuTest* tc)
-{
-	CuSuite ts;
-	CuTest tc1;
-	CuString details;
-	const char* expected;
-
-	CuSuiteInit(&ts);
-	CuTestInit(&tc1, "TestPasses", TestPasses);
-	CuStringInit(&details);
-
-	CuSuiteAdd(&ts, &tc1);
-	CuSuiteRun(&ts);
-
-	CuSuiteDetails(&ts, &details);
-
-	CuAssertTrue(tc, ts.count == 1);
-	CuAssertTrue(tc, ts.failCount == 0);
-
-	expected =
-		"OK (1 test)\n";
-
-	CuAssertStrEquals(tc, expected, details.buffer);
-}
-
-void TestCuSuiteDetails_MultiplePasses(CuTest* tc)
-{
-	CuSuite ts;
-	CuTest tc1, tc2;
-	CuString details;
-	const char* expected;
-
-	CuSuiteInit(&ts);
-	CuTestInit(&tc1, "TestPasses", TestPasses);
-	CuTestInit(&tc2, "TestPasses", TestPasses);
-	CuStringInit(&details);
-
-	CuSuiteAdd(&ts, &tc1);
-	CuSuiteAdd(&ts, &tc2);
-	CuSuiteRun(&ts);
-
-	CuSuiteDetails(&ts, &details);
-
-	CuAssertTrue(tc, ts.count == 2);
-	CuAssertTrue(tc, ts.failCount == 0);
-
-	expected =
-		"OK (2 tests)\n";
-
-	CuAssertStrEquals(tc, expected, details.buffer);
-}
-
-void TestCuSuiteDetails_MultipleFails(CuTest* tc)
-{
-	CuSuite ts;
-	CuTest tc1, tc2;
-	CuString details;
-	const char* front;
-	const char* mid;
-	const char* back;
-
-	CuSuiteInit(&ts);
-	CuTestInit(&tc1, "TestFails1", zTestFails);
-	CuTestInit(&tc2, "TestFails2", zTestFails);
-	CuStringInit(&details);
-
-	CuSuiteAdd(&ts, &tc1);
-	CuSuiteAdd(&ts, &tc2);
-	CuSuiteRun(&ts);
-
-	CuSuiteDetails(&ts, &details);
-
-	CuAssertTrue(tc, ts.count == 2);
-	CuAssertTrue(tc, ts.failCount == 2);
-
-	front =
-		"There were 2 failures:\n"
-		"1) TestFails1: ";
-	mid =   "test should fail\n"
-		"2) TestFails2: ";
-	back =  "test should fail\n"
-		"\n!!!FAILURES!!!\n"
-		"Runs: 2 Passes: 0 Fails: 2\n";
-
-	CuAssertStrEquals(tc, back, details.buffer + strlen(details.buffer) - strlen(back));
-	CuAssert(tc, "Couldn't find middle", strstr(details.buffer, mid) != NULL);
-	details.buffer[strlen(front)] = 0;
-	CuAssertStrEquals(tc, front, details.buffer);
-}
-
-
-/*-------------------------------------------------------------------------*
- * Misc Test
- *-------------------------------------------------------------------------*/
-
-void TestCuStrCopy(CuTest* tc)
-{
-	const char* old = "hello world";
-	const char* newStr = CuStrCopy(old);
-	CuAssert(tc, "old is new", strcmp(old, newStr) == 0);
-}
-
-
-void TestCuStringAppendFormat(CuTest* tc)
-{
-	int i;
-	char* text = CuStrAlloc(301);		/* long string */
-	CuString* str = CuStringNew();
-	for (i = 0 ; i < 300 ; ++i)
-		text[i] = 'a';
-	text[300] = '\0';
-	CuStringAppendFormat(str, "%s", text);
-
-	/* buffer limit raised to HUGE_STRING_LEN so no overflow */
-
-	CuAssert(tc, "length of str->buffer is 300", 300 == strlen(str->buffer));
-}
-
-void TestFail(CuTest* tc)
-{
-	jmp_buf buf;
-	int pointReached = 0;
-	CuTest* tc2 = CuTestNew("TestFails", zTestFails);
-	tc2->jumpBuf = &buf;
-	if (setjmp(buf) == 0)
-	{
-		CuFail(tc2, "hello world");
-		pointReached = 1;
-	}
-	CuAssert(tc, "point was not reached", pointReached == 0);
-}
-
-void TestAssertStrEquals(CuTest* tc)
-{
-	jmp_buf buf;
-	CuTest *tc2 = CuTestNew("TestAssertStrEquals", zTestFails);
-
-	const char* expected = "expected <hello> but was <world>";
-	const char *expectedMsg = "some text: expected <hello> but was <world>";
-
-	tc2->jumpBuf = &buf;
-	if (setjmp(buf) == 0)
-	{
-		CuAssertStrEquals(tc2, "hello", "world");
-	}
-	CuAssertTrue(tc, tc2->failed);
-	CompareAsserts(tc, "CuAssertStrEquals failed", expected, tc2->message);
-	if (setjmp(buf) == 0)
-	{
-		CuAssertStrEquals_Msg(tc2, "some text", "hello", "world");
-	}
-	CuAssertTrue(tc, tc2->failed);
-	CompareAsserts(tc, "CuAssertStrEquals failed", expectedMsg, tc2->message);
-}
-
-void TestAssertStrEquals_NULL(CuTest* tc)
-{
-	jmp_buf buf;
-	CuTest *tc2 = CuTestNew("TestAssertStrEquals_NULL", zTestFails);
-
-	tc2->jumpBuf = &buf;
-	if (setjmp(buf) == 0)
-	{
-		CuAssertStrEquals(tc2, NULL, NULL);
-	}
-	CuAssertTrue(tc, !tc2->failed);
-	CompareAsserts(tc, "CuAssertStrEquals_NULL failed", NULL, tc2->message);
-	if (setjmp(buf) == 0)
-	{
-		CuAssertStrEquals_Msg(tc2, "some text", NULL, NULL);
-	}
-	CuAssertTrue(tc, !tc2->failed);
-	CompareAsserts(tc, "CuAssertStrEquals_NULL failed", NULL, tc2->message);
-}
-
-void TestAssertStrEquals_FailNULLStr(CuTest* tc)
-{
-	jmp_buf buf;
-	CuTest *tc2 = CuTestNew("TestAssertStrEquals_FailNULLStr", zTestFails);
-
-	const char* expected = "expected <hello> but was <NULL>";
-	const char *expectedMsg = "some text: expected <hello> but was <NULL>";
-
-	tc2->jumpBuf = &buf;
-	if (setjmp(buf) == 0)
-	{
-		CuAssertStrEquals(tc2, "hello", NULL);
-	}
-	CuAssertTrue(tc, tc2->failed);
-	CompareAsserts(tc, "CuAssertStrEquals_FailNULLStr failed", expected, tc2->message);
-	if (setjmp(buf) == 0)
-	{
-		CuAssertStrEquals_Msg(tc2, "some text", "hello", NULL);
-	}
-	CuAssertTrue(tc, tc2->failed);
-	CompareAsserts(tc, "CuAssertStrEquals_FailNULLStr failed", expectedMsg, tc2->message);
-}
-
-void TestAssertStrEquals_FailStrNULL(CuTest* tc)
-{
-	jmp_buf buf;
-	CuTest *tc2 = CuTestNew("TestAssertStrEquals_FailStrNULL", zTestFails);
-
-	const char* expected = "expected <NULL> but was <hello>";
-	const char *expectedMsg = "some text: expected <NULL> but was <hello>";
-
-	tc2->jumpBuf = &buf;
-	if (setjmp(buf) == 0)
-	{
-		CuAssertStrEquals(tc2, NULL, "hello");
-	}
-	CuAssertTrue(tc, tc2->failed);
-	CompareAsserts(tc, "CuAssertStrEquals_FailStrNULL failed", expected, tc2->message);
-	if (setjmp(buf) == 0)
-	{
-		CuAssertStrEquals_Msg(tc2, "some text", NULL, "hello");
-	}
-	CuAssertTrue(tc, tc2->failed);
-	CompareAsserts(tc, "CuAssertStrEquals_FailStrNULL failed", expectedMsg, tc2->message);
-}
-
-void TestAssertIntEquals(CuTest* tc)
-{
-	jmp_buf buf;
-	CuTest *tc2 = CuTestNew("TestAssertIntEquals", zTestFails);
-	const char* expected = "expected <42> but was <32>";
-	const char* expectedMsg = "some text: expected <42> but was <32>";
-	tc2->jumpBuf = &buf;
-	if (setjmp(buf) == 0)
-	{
-		CuAssertIntEquals(tc2, 42, 32);
-	}
-	CuAssertTrue(tc, tc2->failed);
-	CompareAsserts(tc, "CuAssertIntEquals failed", expected, tc2->message);
-	if (setjmp(buf) == 0)
-	{
-		CuAssertIntEquals_Msg(tc2, "some text", 42, 32);
-	}
-	CuAssertTrue(tc, tc2->failed);
-	CompareAsserts(tc, "CuAssertStrEquals failed", expectedMsg, tc2->message);
-}
-
-void TestAssertDblEquals(CuTest* tc)
-{
-	jmp_buf buf;
-	double x = 3.33;
-	double y = 10.0 / 3.0;
-	CuTest *tc2 = CuTestNew("TestAssertDblEquals", zTestFails);
-	char expected[STRING_MAX];
-	char expectedMsg[STRING_MAX];
-	sprintf(expected, "expected <%lf> but was <%lf>", x, y);
-	sprintf(expectedMsg, "some text: expected <%lf> but was <%lf>", x, y);
-
-	CuTestInit(tc2, "TestAssertDblEquals", TestPasses);
-
-	CuAssertDblEquals(tc2, x, x, 0.0);
-	CuAssertTrue(tc, ! tc2->failed);
-	CuAssertTrue(tc, NULL == tc2->message);
-
-	CuAssertDblEquals(tc2, x, y, 0.01);
-	CuAssertTrue(tc, ! tc2->failed);
-	CuAssertTrue(tc, NULL == tc2->message);
-
-	tc2->jumpBuf = &buf;
-	if (setjmp(buf) == 0)
-	{
-		CuAssertDblEquals(tc2, x, y, 0.001);
-	}
-	CuAssertTrue(tc, tc2->failed);
-	CompareAsserts(tc, "CuAssertDblEquals failed", expected, tc2->message);
-	tc2->jumpBuf = &buf;
-	if (setjmp(buf) == 0)
-	{
-		CuAssertDblEquals_Msg(tc2, "some text", x, y, 0.001);
-	}
-	CuAssertTrue(tc, tc2->failed);
-	CompareAsserts(tc, "CuAssertDblEquals failed", expectedMsg, tc2->message);
-}
-
-/*-------------------------------------------------------------------------*
- * main
- *-------------------------------------------------------------------------*/
-
-CuSuite* CuGetSuite(void)
-{
-	CuSuite* suite = CuSuiteNew();
-
-	SUITE_ADD_TEST(suite, TestCuStringAppendFormat);
-	SUITE_ADD_TEST(suite, TestCuStrCopy);
-	SUITE_ADD_TEST(suite, TestFail);
-	SUITE_ADD_TEST(suite, TestAssertStrEquals);
-	SUITE_ADD_TEST(suite, TestAssertStrEquals_NULL);
-	SUITE_ADD_TEST(suite, TestAssertStrEquals_FailStrNULL);
-	SUITE_ADD_TEST(suite, TestAssertStrEquals_FailNULLStr);
-	SUITE_ADD_TEST(suite, TestAssertIntEquals);
-	SUITE_ADD_TEST(suite, TestAssertDblEquals);
-
-	SUITE_ADD_TEST(suite, TestCuTestNew);
-	SUITE_ADD_TEST(suite, TestCuTestInit);
-	SUITE_ADD_TEST(suite, TestCuAssert);
-	SUITE_ADD_TEST(suite, TestCuAssertPtrEquals_Success);
-	SUITE_ADD_TEST(suite, TestCuAssertPtrEquals_Failure);
-	SUITE_ADD_TEST(suite, TestCuAssertPtrNotNull_Success);
-	SUITE_ADD_TEST(suite, TestCuAssertPtrNotNull_Failure);
-	SUITE_ADD_TEST(suite, TestCuTestRun);
-
-	SUITE_ADD_TEST(suite, TestCuSuiteInit);
-	SUITE_ADD_TEST(suite, TestCuSuiteNew);
-	SUITE_ADD_TEST(suite, TestCuSuiteAddTest);
-	SUITE_ADD_TEST(suite, TestCuSuiteAddSuite);
-	SUITE_ADD_TEST(suite, TestCuSuiteRun);
-	SUITE_ADD_TEST(suite, TestCuSuiteSummary);
-	SUITE_ADD_TEST(suite, TestCuSuiteDetails_SingleFail);
-	SUITE_ADD_TEST(suite, TestCuSuiteDetails_SinglePass);
-	SUITE_ADD_TEST(suite, TestCuSuiteDetails_MultiplePasses);
-	SUITE_ADD_TEST(suite, TestCuSuiteDetails_MultipleFails);
-
-	return suite;
-}
diff --git a/tests/cu-test/README b/tests/cu-test/README
deleted file mode 100644
index 425381a..0000000
--- a/tests/cu-test/README
+++ /dev/null
@@ -1,209 +0,0 @@
-HOW TO USE
-
-You can use CuTest to create unit tests to drive your development
-in the style of Extreme Programming. You can also add unit tests to
-existing code to ensure that it works as you suspect.
-
-Your unit tests are an investment. They let you to change your
-code and add new features confidently without worrying about
-accidentally breaking earlier features.
-
-
-LICENSING
-
-For details on licensing see license.txt.
-
-
-GETTING STARTED
-
-To add unit testing to your C code the only files you need are
-CuTest.c and CuTest.h. 
-
-CuTestTest.c and AllTests.c have been included to provide an
-example of how to write unit tests and then how to aggregate them
-into suites and into a single AllTests.c file. Suites allow you
-to put group tests into logical sets. AllTests.c combines all the
-suites and runs them. 
-
-You should not have to look inside CuTest.c. Looking in
-CuTestTest.c and AllTests.c (for example usage) should be
-sufficient. 
-
-After downloading the sources, run your compiler to create an
-executable called AllTests.exe. For example, if you are using
-Windows with the cl.exe compiler you would type: 
-
-    cl.exe AllTests.c CuTest.c CuTestTest.c
-    AllTests.exe
-
-This will run all the unit tests associated with CuTest and print
-the output on the console. You can replace cl.exe with gcc or
-your favorite compiler in the command above.
-
-
-DETAILED EXAMPLE
-
-Here is a more detailed example. We will work through a simple
-test first exercise. The goal is to create a library of string
-utilities. First, lets write a function that converts a
-null-terminated string to all upper case.
-
-Ensure that CuTest.c and CuTest.h are accessible from your C
-project. Next, create a file called StrUtil.c with these
-contents:
-
-    #include "CuTest.h"
-    
-    char* StrToUpper(char* str) {
-        return str;
-    }
-    
-    void TestStrToUpper(CuTest *tc) {
-        char* input = strdup("hello world");
-        char* actual = StrToUpper(input);
-        char* expected = "HELLO WORLD";
-        CuAssertStrEquals(tc, expected, actual);
-    }
-   
-    CuSuite* StrUtilGetSuite() {
-        CuSuite* suite = CuSuiteNew();
-        SUITE_ADD_TEST(suite, TestStrToUpper);
-        return suite;
-    }
-    
-Create another file called AllTests.c with these contents:
-
-    #include "CuTest.h"
-    
-    CuSuite* StrUtilGetSuite();
-    
-    void RunAllTests(void) {
-        CuString *output = CuStringNew();
-        CuSuite* suite = CuSuiteNew();
-        
-        CuSuiteAddSuite(suite, StrUtilGetSuite());
-    
-        CuSuiteRun(suite);
-        CuSuiteSummary(suite, output);
-        CuSuiteDetails(suite, output);
-        printf("%s\n", output->buffer);
-    }
-    
-    int main(void) {
-        RunAllTests();
-    }
-
-Then type this on the command line:
-
-    gcc AllTests.c CuTest.c StrUtil.c
-
-to compile. You can replace gcc with your favorite compiler.
-CuTest should be portable enough to handle all Windows and Unix
-compilers. Then to run the tests type:
-
-    a.out
-
-This will print an error because we haven't implemented the
-StrToUpper function correctly. We are just returning the string
-without changing it to upper case. 
-
-    char* StrToUpper(char* str) {
-        return str;
-    }
-
-Rewrite this as follows:
-
-    char* StrToUpper(char* str) {
-        char* p;
-        for (p = str ; *p ; ++p) *p = toupper(*p);
-        return str;
-    }
-
-Recompile and run the tests again. The test should pass this
-time.
-
-
-WHAT TO DO NEXT
-
-At this point you might want to write more tests for the
-StrToUpper function. Here are some ideas:
-
-TestStrToUpper_EmptyString :  pass in ""
-TestStrToUpper_UpperCase   :  pass in "HELLO WORLD"
-TestStrToUpper_MixedCase   :  pass in "HELLO world"
-TestStrToUpper_Numbers     :  pass in "1234 hello"
-
-As you write each one of these tests add it to StrUtilGetSuite
-function. If you don't the tests won't be run. Later as you write
-other functions and write tests for them be sure to include those
-in StrUtilGetSuite also. The StrUtilGetSuite function should
-include all the tests in StrUtil.c
-
-Over time you will create another file called FunkyStuff.c
-containing other functions unrelated to StrUtil. Follow the same
-pattern. Create a FunkyStuffGetSuite function in FunkyStuff.c.
-And add FunkyStuffGetSuite to AllTests.c.
-
-The framework is designed in the way it is so that it is easy to
-organize a lot of tests.
-
-THE BIG PICTURE
-
-Each individual test corresponds to a CuTest. These are grouped
-to form a CuSuite. CuSuites can hold CuTests or other CuSuites.
-AllTests.c collects all the CuSuites in the program into a single
-CuSuite which it then runs as a single CuSuite.
-
-The project is open source so feel free to take a peek under the
-hood at the CuTest.c file to see how it works. CuTestTest.c
-contains tests for CuTest.c. So CuTest tests itself.
-
-Since AllTests.c has a main() you will need to exclude this when
-you are building your product. Here is a nicer way to do this if
-you want to avoid messing with multiple builds. Remove the main()
-in AllTests.c. Note that it just calls RunAllTests(). Instead
-we'll call this directly from the main program.
-
-Now in the main() of the actual program check to see if the
-command line option "--test" was passed. If it was then I call
-RunAllTests() from AllTests.c. Otherwise run the real program.
-
-Shipping the tests with the code can be useful. If you customers
-complain about a problem you can ask them to run the unit tests
-and send you the output. This can help you to quickly isolate the
-piece of your system that is malfunctioning in the customer's
-environment. 
-
-CuTest offers a rich set of CuAssert functions. Here is a list:
-
-void CuAssert(CuTest* tc, char* message, int condition);
-void CuAssertTrue(CuTest* tc, int condition);
-void CuAssertStrEquals(CuTest* tc, char* expected, char* actual);
-void CuAssertIntEquals(CuTest* tc, int expected, int actual);
-void CuAssertPtrEquals(CuTest* tc, void* expected, void* actual);
-void CuAssertPtrNotNull(CuTest* tc, void* pointer);
-
-The project is open source and so you can add other more powerful
-asserts to make your tests easier to write and more concise.
-Please feel free to send me changes you make so that I can
-incorporate them into future releases.
-
-If you see any errors in this document please contact me at
-asimjalis peakprogramming com 
-
-
-AUTOMATING TEST SUITE GENERATION
-
-make-tests.sh will grep through all the .c files in the current
-directory and generate the code to run all the tests contained in
-them. Using this script you don't have to worry about writing
-AllTests.c or dealing with any of the other suite code.
-
-
-CREDITS
-
-[02.23.2003] Dave Glowacki <dglo hyde ssec wisc edu> has added
-(1) file name and line numbers to the error messages, (2)
-AssertDblEquals for doubles, (3) Assert<X>Equals_Msg version of
-all the Assert<X>Equals to pass in optional message which is
-printed out on assert failure.
diff --git a/tests/cu-test/license.txt b/tests/cu-test/license.txt
deleted file mode 100644
index 5f053ba..0000000
--- a/tests/cu-test/license.txt
+++ /dev/null
@@ -1,38 +0,0 @@
-NOTE
-
-The license is based on the zlib/libpng license. For more details see
-http://www.opensource.org/licenses/zlib-license.html. The intent of the
-license is to: 
-
-- keep the license as simple as possible
-- encourage the use of CuTest in both free and commercial applications
-  and libraries
-- keep the source code together 
-- give credit to the CuTest contributors for their work
-
-If you ship CuTest in source form with your source distribution, the
-following license document must be included with it in unaltered form.
-If you find CuTest useful we would like to hear about it. 
-
-LICENSE
-
-Copyright (c) 2003 Asim Jalis
-
-This software is provided 'as-is', without any express or implied
-warranty. In no event will the authors be held liable for any damages
-arising from the use of this software.
-
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it
-freely, subject to the following restrictions:
-
-1. The origin of this software must not be misrepresented; you must not
-claim that you wrote the original software. If you use this software in
-a product, an acknowledgment in the product documentation would be
-appreciated but is not required.
-
-2. Altered source versions must be plainly marked as such, and must not
-be misrepresented as being the original software.
-
-3. This notice may not be removed or altered from any source
-distribution.
diff --git a/tests/cu-test/make-tests.sh b/tests/cu-test/make-tests.sh
deleted file mode 100755
index c210e30..0000000
--- a/tests/cu-test/make-tests.sh
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/usr/local/bin/bash
-
-# Auto generate single AllTests file for CuTest.
-# Searches through all *.c files in the current directory.
-# Prints to stdout.
-# Author: Asim Jalis
-# Date: 01/08/2003
-
-if test $# -eq 0 ; then FILES=*.c ; else FILES=$* ; fi
-
-echo '
-
-/* This is auto-generated code. Edit at your own peril. */
-
-#include "CuTest.h"
-
-'
-
-cat $FILES | grep '^unit_test_' | 
-    sed -e 's/(.*$//' \
-        -e 's/$/(CuTest*);/' \
-        -e 's/^/extern /'
-
-echo \
-'
-
-void RunAllTests(void) 
-{
-    CuString *output = CuStringNew();
-    CuSuite* suite = CuSuiteNew();
-
-'
-cat $FILES | grep '^void Test' | 
-    sed -e 's/^void //' \
-        -e 's/(.*$//' \
-        -e 's/^/    SUITE_ADD_TEST(suite, /' \
-        -e 's/$/);/'
-
-echo \
-'
-    CuSuiteRun(suite);
-    CuSuiteSummary(suite, output);
-    CuSuiteDetails(suite, output);
-    printf("%s\n", output->buffer);
-}
-
-int main(void)
-{
-    RunAllTests();
-}
-'
diff --git a/tests/gtest-helpers.c b/tests/gtest-helpers.c
index 4bd88ea..4357ae0 100644
--- a/tests/gtest-helpers.c
+++ b/tests/gtest-helpers.c
@@ -129,6 +129,7 @@ int
 main (int argc, char* argv[])
 {
 	GLogLevelFlags fatal_mask;
+	int ret;
 
 	g_thread_init (NULL);
 
@@ -151,5 +152,10 @@ main (int argc, char* argv[])
 	g_log_set_always_fatal (fatal_mask);
 
 	initialize_tests ();
-	return g_test_run ();
-} 
+
+	start_tests ();
+	ret = g_test_run ();
+	stop_tests();
+
+	return ret;
+}
diff --git a/tests/gtest-helpers.h b/tests/gtest-helpers.h
index 2568347..880a7cb 100644
--- a/tests/gtest-helpers.h
+++ b/tests/gtest-helpers.h
@@ -57,6 +57,16 @@ gchar* test_build_filename (const gchar *basename);
 #define DEFINE_TEST(x) \
 	void test_##x(int *__unused G_GNUC_UNUSED, gconstpointer __data G_GNUC_UNUSED)
 
+#define DECLARE_START(x) \
+	void start_##x(void)
+#define DEFINE_START(x) \
+	void start_##x(void)
+
+#define DECLARE_STOP(x) \
+	void stop_##x(void)
+#define DEFINE_STOP(x) \
+	void stop_##x(void)
+
 /* #define DEFINE_ABORT(x) void abort_x(void *__unused G_GNUC_UNUSED, gconstpointer __data G_GNUC_UNUSED)' */
 
 #endif /* GTEST_HELPERS_H_ */
diff --git a/tests/gtest.make b/tests/gtest.make
index 1af0e67..4d887ee 100644
--- a/tests/gtest.make
+++ b/tests/gtest.make
@@ -20,7 +20,8 @@ LIBS = \
 	$(GTHREAD_LIBS) 
 	
 noinst_PROGRAMS= \
-	run-auto-test 
+	run-auto-test \
+	run-prompt-test
 		
 run-auto-test.c: $(UNIT_AUTO) Makefile.am $(top_srcdir)/tests/prep-gtest.sh
 	sh $(top_srcdir)/tests/prep-gtest.sh -b run-auto-test $(UNIT_AUTO)
@@ -36,8 +37,26 @@ run_auto_test_LDADD = \
 run_auto_test_CFLAGS = \
 	$(UNIT_FLAGS)
 
+run-prompt-test.c: $(UNIT_PROMPT) Makefile.am $(top_srcdir)/tests/prep-gtest.sh
+	sh $(top_srcdir)/tests/prep-gtest.sh -b run-prompt-test $(UNIT_PROMPT)
+
+run_prompt_test_SOURCES = \
+	run-prompt-test.c \
+	run-prompt-test.h \
+	$(UNIT_PROMPT)
+
+run_prompt_test_LDADD = \
+	$(UNIT_LIBS) \
+	$(DAEMON_LIBS)
+
+run_prompt_test_CFLAGS = \
+	$(UNIT_FLAGS)
+
 # ------------------------------------------------------------------------------
 # Run the tests
 
 test-auto: $(noinst_PROGRAMS)
 	gtester -k -m=slow ./run-auto-test
+
+test-prompt: $(noinst_PROGRAMS)
+	gtester -k -m=slow ./run-prompt-test
diff --git a/tests/prep-gtest.sh b/tests/prep-gtest.sh
index 389b1f3..90b2a68 100755
--- a/tests/prep-gtest.sh
+++ b/tests/prep-gtest.sh
@@ -17,7 +17,6 @@ usage()
 file_to_name()
 {
 	echo -n $1 | sed -e 's/unit-test-//' -e 's/\.c//'
-	# | tr -c 'a-zA-Z0-9' '_'  
 }
 
 build_header()
@@ -32,7 +31,8 @@ build_header()
 		sed -ne 's/.*DEFINE_SETUP[ 	]*(\([^)]\+\))/DECLARE_SETUP(\1);/p' $_file
 		sed -ne 's/.*DEFINE_TEARDOWN[ 	]*(\([^)]\+\))/DECLARE_TEARDOWN(\1);/p' $_file
 		sed -ne 's/.*DEFINE_TEST[ 	]*(\([^)]\+\))/DECLARE_TEST(\1);/p' $_file
-		# sed -ne 's/.*DEFINE_ABORT[ 	]*(\([^)]\+\))/DECLARE_ABORT(\1);/p' $_file
+		sed -ne 's/.*DEFINE_START[ 	]*(\([^)]\+\))/DECLARE_START(\1);/p' $_file
+		sed -ne 's/.*DEFINE_STOP[ 	]*(\([^)]\+\))/DECLARE_STOP(\1);/p' $_file
 	done
 	echo
 }
@@ -45,26 +45,24 @@ build_source()
 	echo "#include \"tests/gtest-helpers.h\""
 	echo "#include \"$BASE.h\""
 	echo
-	
-	# A  test macro
-	# echo '#define WRAP_ABORT(name) \'
-	# echo '	START_TEST(test_##name) { \'
-	# echo '		if (srunner_fork_status (srunner) == CK_NOFORK) return; \'
-	# echo '		GLogFunc old = g_log_set_default_handler (test_quiet_abort_log_handler, NULL); \'
-	# echo '		name (); \'
-	# echo '		g_log_set_default_handler (old, NULL); \'
-	# echo '	} END_TEST'
+
+	# Startup function
+	echo "static void start_tests (void) {"
+		sed -ne "s/.*DEFINE_START(\([^)]\+\)).*/	start_\1 ();/p" $@
+	echo "}"
+	echo
+
+	# Shutdown function
+	echo "static void stop_tests (void) {"
+		sed -ne "s/.*DEFINE_STOP(\([^)]\+\)).*/	stop_\1 ();/p" $@
+	echo "}"
+	echo
 
 	echo "static void initialize_tests (void) {"
 	# Include each file, and build a test case for it
 	_tcases=""
 	for _file in $@; do
 		_name=`file_to_name $_file`  
-
-		# Wrap each and every test
-		# sed -ne 's/.*DEFINE_TEST(\([^)]\+\)).*/WRAP_TEST (\1);/p' $_file
-		# sed -ne 's/.*DEFINE_ABORT(\([^)]\+\)).*/WRAP_ABORT (\1);/p' $_file
-		echo
 		
 		# Calculate what our setup and teardowns are. 
 		_setup=`sed -ne 's/.*DEFINE_SETUP(\([^)]\+\)).*/setup_\1/p' $_file || echo "NULL"`
@@ -79,7 +77,6 @@ build_source()
 		
 		# Add all tests to the test case 
 		sed -ne "s/.*DEFINE_TEST(\([^)]\+\)).*/	g_test_add(\"\/$_name\/\1\", int, NULL, $_setup, test_\1, $_teardown);/p" $_file
-		# sed -ne 's/.*DEFINE_ABORT(\([^)]\+\)).*/	tcase_add_test_raise_signal (tc, test_\1, 6);/p' $_file
 		
 	done
 	
diff --git a/tests/prep-tests.sh b/tests/prep-tests.sh
deleted file mode 100755
index 858842a..0000000
--- a/tests/prep-tests.sh
+++ /dev/null
@@ -1,115 +0,0 @@
-#!/bin/sh -e
-
-set -e
-
-# --------------------------------------------------------------------
-# FUNCTIONS 
-
-usage()
-{
-	echo "usage: unit-test-prep.sh -b base-name files.c ..." >&2
-	exit 2
-}
-
-# --------------------------------------------------------------------
-# ARGUMENT PARSING
-
-BASE=unit-test
-
-while [ $# -gt 0 ]; do
-	case "$1" in
-	-b)
-		BASE="$2"
-		shift
-		;;	
-	--)
-		shift
-		break
-		;;
-	-*)
-		usage
-		;;
-	*)
-		break
-		;;
-	esac
-	shift
-done
-	
-FILES=$*
-
-# --------------------------------------------------------------------
-# HEADER FILE 
-
-(
-
-# HEADER TOP 
-cat << END
-/* This is auto-generated code. Edit at your own peril. */
-#include "tests/cu-test/CuTest.h"
-#include "tests/test-helpers.h"
-#include <stdio.h>
-#include <gtk/gtk.h>
-
-END
-
-# DECLARATIONS 
-
-	if [ -n "$FILES" ]; then
-		cat $FILES | grep '^void unit_setup_' | sed -e 's/$/;/'
-		cat $FILES | grep '^void unit_test_' | sed -e 's/$/;/'
-		cat $FILES | grep '^void unit_teardown_' | sed -e 's/$/;/'
-	fi
-
-) > $BASE.h
-
-# --------------------------------------------------------------------
-# SOURCE FILE 
-
-(
-# START RUNNER FUNCTION 
-cat << END
-/* This is auto-generated code. Edit at your own peril. */
-#include "$BASE.h"
-
-static int RunAllTests(void) 
-{
-    CuString *output = CuStringNew();
-    CuSuite* suite = CuSuiteNew();
-
-END
-
-	if [ -n "$FILES" ]; then
-		cat $FILES | grep '^void unit_setup_' | \
-			sed -e 's/^void //' -e 's/(.*$//' -e 's/$/();/'
-		cat $FILES | grep '^void unit_test_' | \
-			sed -e 's/^void //' -e 's/(.*$//' \
-        	             -e 's/^/SUITE_ADD_TEST(suite, /' -e 's/$/);/'
-	fi
-
-# MIDDLE RUNNER FUNCTION 
-cat << END
-    CuSuiteRun(suite);
-    CuSuiteSummary(suite, output);
-    CuSuiteDetails(suite, output);
-    printf("%s\\n", output->buffer);
-END
-
-	if [ -n "$FILES" ]; then
-
-		cat $FILES | grep '^void unit_teardown_' | \
-			sed -e 's/^void //' -e 's/(.*$//' -e 's/$/();/'
-
-	fi
-
-# END RUNNER FUNCTION 
-cat << END
-
-	return suite->failCount;
-}
-
-#include "tests/test-helpers.c"
-#include "tests/cu-test/CuTest.c"
-END
-) > $BASE.c
-
diff --git a/tests/test-helpers.c b/tests/test-helpers.c
deleted file mode 100644
index 5b971c3..0000000
--- a/tests/test-helpers.c
+++ /dev/null
@@ -1,122 +0,0 @@
-
-/* This file is included into the main .c file for each unit-test program */
-
-#include <glib.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-
-#include "test-helpers.h"
-
-#include "egg/egg-secure-memory.h"
-
-static GStaticMutex memory_mutex = G_STATIC_MUTEX_INIT;
-void egg_memory_lock (void) 
-{ 
-	g_static_mutex_lock (&memory_mutex); 
-}
-
-void egg_memory_unlock (void) 
-{ 
-	g_static_mutex_unlock (&memory_mutex); 
-}
-
-void* egg_memory_fallback (void *p, size_t sz) 
-{ 
-	return g_realloc (p, sz); 
-}
-
-#ifndef EXTERNAL_TEST
-#include "daemon/util/gkr-daemon-async.h"
-#endif
-
-static GMainLoop *mainloop = NULL;
-
-static gboolean
-quit_loop (gpointer unused)
-{
-	g_main_loop_quit (mainloop);
-	return TRUE;	
-}
-
-void
-test_mainloop_quit (void)
-{
-	g_main_loop_quit (mainloop);
-}
-
-void
-test_mainloop_run (int timeout)
-{
-	guint id = 0;
-	
-	if (timeout)
-		id = g_timeout_add (timeout, quit_loop, NULL);
-	g_main_loop_run (mainloop);
-	if (timeout)
-		g_source_remove (id); 
-} 
-
-GMainLoop* 
-test_mainloop_get (void)
-{
-	if (!mainloop)
-		mainloop = g_main_loop_new (NULL, FALSE);
-	return mainloop;
-}
-
-static void 
-chdir_base_dir (char* argv0)
-{
-	gchar *dir, *base;
-
-	dir = g_path_get_dirname (argv0);
-	if (chdir (dir) < 0)
-		g_warning ("couldn't change directory to: %s: %s", 
-		           dir, g_strerror (errno));
-	
-	base = g_path_get_basename (dir);
-	if (strcmp (base, ".libs") == 0) {
-		if (chdir ("..") < 0)
-			g_warning ("couldn't change directory to ..: %s",
-			           g_strerror (errno));
-	}
-
-	g_free (base);
-	g_free (dir);
-}
-
-int
-main (int argc, char* argv[])
-{
-	GLogLevelFlags fatal_mask;
-	const gchar* envi;
-
-	g_thread_init (NULL);
-
-	envi = getenv ("GNOME_KEYRING_TEST_PATH");
-	if (envi) {
-		setenv ("GNOME_KEYRING_OUTSIDE_TEST", "TRUE", 1);
-	} else {
-		setenv ("GNOME_KEYRING_TEST_PATH", "/tmp/test-gnome-keyring", 1);
-		g_mkdir_with_parents ("/tmp/test-gnome-keyring", 0777);
-	}
-
-	chdir_base_dir (argv[0]);
-	gtk_init(&argc, &argv);
-	mainloop = g_main_loop_new (NULL, FALSE);
-
-#ifndef EXTERNAL_TEST
-
-	gkr_daemon_async_workers_init (mainloop);
-	
-#endif
-
-	fatal_mask = g_log_set_always_fatal (G_LOG_FATAL_MASK);
-	fatal_mask |= G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL;
-	g_log_set_always_fatal (fatal_mask);
-	
-	return RunAllTests();
-} 
diff --git a/tests/test-helpers.h b/tests/test-helpers.h
deleted file mode 100644
index ddc6919..0000000
--- a/tests/test-helpers.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* test-helpers.h: Declarations for common functions called from unit tests
-
-   Copyright (C) 2007 Stefan Walter
-
-   The Gnome Keyring Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
-
-   The Gnome Keyring Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
-
-   You should have received a copy of the GNU Library General Public
-   License along with the Gnome Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.
-
-   Author: Stef Walter <stef memberwebs com>
-*/
-
-#ifndef TEST_HELPERS_H_
-#define TEST_HELPERS_H_
-
-#include <glib.h>
-
-void test_mainloop_quit (void);
-void test_mainloop_run (int timeout);
-GMainLoop* test_mainloop_get (void);
-
-#endif /*TEST_HELPERS_H_*/
diff --git a/tests/test.make b/tests/test.make
deleted file mode 100644
index c10927c..0000000
--- a/tests/test.make
+++ /dev/null
@@ -1,62 +0,0 @@
-
-# The following need to be declared before this file is included:
-#   UNIT_AUTO     A list of C files with tests
-#   UNIT_PROMPT   A list of C files with prompting tests
-#   UNIT_LIBS     Libraries to link the tests to
-
-# ------------------------------------------------------------------------------
-
-INCLUDES=				\
-	-I$(top_srcdir) 		\
-	-I$(top_srcdir)/daemon 		\
-	-I$(top_builddir) 		\
-	$(GTK_CFLAGS)			\
-	$(GLIB_CFLAGS) 
-	
-LIBS = \
-	$(GTK_LIBS) \
-	$(GLIB_LIBS) \
-	$(GTHREAD_LIBS)
-	
-noinst_PROGRAMS= \
-	run-auto-test \
-	run-prompt-test
-	
-run-auto-test.c: $(UNIT_AUTO) Makefile.am
-	sh $(top_srcdir)/tests/prep-tests.sh -b run-auto-test $(UNIT_AUTO)
-
-run_auto_test_SOURCES = \
-	run-auto-test.c \
-	run-auto-test.h \
-	$(UNIT_AUTO)
-	
-run_auto_test_LDADD = \
-	$(UNIT_LIBS) \
-	$(DAEMON_LIBS)
-	
-run_auto_test_CFLAGS = \
-	$(UNIT_FLAGS)
-
-run-prompt-test.c: $(UNIT_PROMPT) Makefile.am
-	sh $(top_srcdir)/tests/prep-tests.sh -b run-prompt-test $(UNIT_PROMPT)
-
-run_prompt_test_SOURCES = \
-	run-prompt-test.c \
-	run-prompt-test.h \
-	$(UNIT_PROMPT)
-	
-run_prompt_test_LDADD = \
-	$(UNIT_LIBS) \
-	$(DAEMON_LIBS)
-
-run_prompt_test_CFLAGS = \
-	$(UNIT_FLAGS)
-
-# ------------------------------------------------------------------------------
-# Run the tests
-
-test-auto: $(noinst_PROGRAMS)
-	./run-auto-test
-
-test-prompt: $(noinst_PROGRAMS)
-	./run-prompt-test



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]