summaryrefslogtreecommitdiff
path: root/test/name-test/test-ids.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/name-test/test-ids.c')
-rw-r--r--test/name-test/test-ids.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/test/name-test/test-ids.c b/test/name-test/test-ids.c
index 8f63d044..f73a505f 100644
--- a/test/name-test/test-ids.c
+++ b/test/name-test/test-ids.c
@@ -11,10 +11,13 @@
static void
die (const char *message)
{
- fprintf (stderr, "*** test-ids: %s", message);
+ printf ("Bail out! test-ids: %s\n", message);
exit (1);
}
+static int test_num = 0;
+
+/* This test outputs TAP syntax: http://testanything.org/ */
int
main (int argc,
char **argv)
@@ -23,7 +26,7 @@ main (int argc,
DBusConnection *connection;
char *id;
char *server_id;
-
+
dbus_error_init (&error);
connection = dbus_bus_get (DBUS_BUS_SESSION, &error);
if (connection == NULL)
@@ -33,24 +36,35 @@ main (int argc,
dbus_error_free (&error);
return 1;
}
+ printf ("ok %d - connected to session bus\n", ++test_num);
server_id = dbus_connection_get_server_id (connection);
+
if (server_id == NULL)
die ("No bus server ID retrieved\n");
- /* printf("'%s'\n", server_id); */
+
+ printf ("ok %d - session bus server ID is %s\n", ++test_num, server_id);
+
if (strlen (server_id) != 32)
die ("Bus server id should have length 32\n");
+
+ printf ("ok %d - session bus server ID length is 32\n", ++test_num);
+
dbus_free (server_id);
id = dbus_bus_get_id (connection, NULL);
if (id == NULL)
die ("No bus ID retrieved\n");
- /* printf("'%s'\n", id); */
+
+ printf ("ok %d - session bus ID is %s\n", ++test_num, id);
+
if (strlen (id) != 32)
die ("Bus ID should have length 32\n");
+
+ printf ("ok %d - session bus ID length is 32\n", ++test_num);
+
dbus_free (id);
-
- _dbus_verbose ("*** Test IDs exiting\n");
-
+
+ printf ("1..%d\n", test_num);
return 0;
}