4 #include "protocols/jabber/auth_digest_md5.h"
5 #include "protocols/jabber/jutil.h"
8 test_jabber_digest_md5_parsing(void) {
10 const gchar
*value
= NULL
;
12 #define check_value(name, expected) G_STMT_START {\
13 value = g_hash_table_lookup(table, (name)); \
14 g_assert_nonnull(value); \
15 g_assert_cmpstr((expected), ==, value); \
18 table
= jabber_auth_digest_md5_parse("r=\"realm\",token= \" asdf\"");
19 check_value("r", "realm");
20 check_value("token", "asdf");
21 g_hash_table_destroy(table
);
23 table
= jabber_auth_digest_md5_parse("r=\"a\", token= \" asdf\"");
24 check_value("r", "a");
25 check_value("token", "asdf");
26 g_hash_table_destroy(table
);
28 table
= jabber_auth_digest_md5_parse("r=\"\", token= \" asdf\"");
30 check_value("token", "asdf");
31 g_hash_table_destroy(table
);
33 table
= jabber_auth_digest_md5_parse("realm=\"somerealm\",nonce=\"OA6MG9tEQGm2hh\",qop=\"auth\",charset=utf-8,algorithm=md5-sess");
34 check_value("realm", "somerealm");
35 check_value("nonce", "OA6MG9tEQGm2hh");
36 check_value("qop", "auth");
37 check_value("charset", "utf-8");
38 check_value("algorithm", "md5-sess");
39 g_hash_table_destroy(table
);
43 main(gint argc
, gchar
**argv
) {
44 g_test_init(&argc
, &argv
, NULL
);
46 g_test_add_func("/jabber/digest/md5/parsing",
47 test_jabber_digest_md5_parsing
);