3 #include "libmoonshot.h"
5 /* FIXME: Using XDG_HOME_DIR and a test runner, we could give
6 * moonshot-ui a set of test identities and assert that they
7 * are returned correctly
10 gpointer test_func (gpointer data)
12 MoonshotError **error = data;
17 *server_certificate_hash,
19 *subject_name_constraint,
20 *subject_alt_name_constraint;
22 success = moonshot_get_default_identity (&nai,
24 &server_certificate_hash,
26 &subject_name_constraint,
27 &subject_alt_name_constraint,
31 g_print ("Got id: %s %s\n", nai, password);*/
33 return GINT_TO_POINTER (success);
39 MoonshotError *error = NULL;
42 success = GPOINTER_TO_INT (test_func (&error));
47 g_print ("FAIL: %s\n", error->message);
48 g_assert_not_reached ();
51 void test_multithread ()
56 MoonshotError *error[N];
59 GError *g_error = NULL;
64 thread[i] = g_thread_create (test_func,
68 g_assert_no_error (g_error);
72 success[i] = GPOINTER_TO_INT (g_thread_join (thread[i]));
76 g_print ("FAIL[%i]: %s\n", i, error[i]->message);
77 g_assert_not_reached ();
82 /* More stuff to test:
83 * - server not available (dbus fail)
84 * - no identities available (moonshot fail)
89 int main (int argc, char *argv[])
92 g_test_init (&argc, &argv, NULL);
94 g_test_add_func ("/basic/connect", test_connect);
95 g_test_add_func ("/basic/multithread", test_multithread);