Tue, 06 Aug 2019 17:40:37 -0400
Rename *Iface to more standard names.
Just a simple sed of `s/Iface/Interface/g`.
|
37605
599b01f2f5a7
This should do it for the jabber tests
Gary Kramlich <grim@reaperworld.com>
parents:
31394
diff
changeset
|
1 | #include <glib.h> |
|
599b01f2f5a7
This should do it for the jabber tests
Gary Kramlich <grim@reaperworld.com>
parents:
31394
diff
changeset
|
2 | |
|
599b01f2f5a7
This should do it for the jabber tests
Gary Kramlich <grim@reaperworld.com>
parents:
31394
diff
changeset
|
3 | #include "util.h" |
|
599b01f2f5a7
This should do it for the jabber tests
Gary Kramlich <grim@reaperworld.com>
parents:
31394
diff
changeset
|
4 | #include "protocols/jabber/auth_digest_md5.h" |
|
599b01f2f5a7
This should do it for the jabber tests
Gary Kramlich <grim@reaperworld.com>
parents:
31394
diff
changeset
|
5 | #include "protocols/jabber/jutil.h" |
|
31394
dd9b4ed08d0a
jabber: Test harness for DIGEST-MD5 parsing function.
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
6 | |
|
37605
599b01f2f5a7
This should do it for the jabber tests
Gary Kramlich <grim@reaperworld.com>
parents:
31394
diff
changeset
|
7 | static void |
|
599b01f2f5a7
This should do it for the jabber tests
Gary Kramlich <grim@reaperworld.com>
parents:
31394
diff
changeset
|
8 | test_jabber_digest_md5_parsing(void) { |
|
599b01f2f5a7
This should do it for the jabber tests
Gary Kramlich <grim@reaperworld.com>
parents:
31394
diff
changeset
|
9 | GHashTable *table; |
|
599b01f2f5a7
This should do it for the jabber tests
Gary Kramlich <grim@reaperworld.com>
parents:
31394
diff
changeset
|
10 | const gchar *value = NULL; |
|
31394
dd9b4ed08d0a
jabber: Test harness for DIGEST-MD5 parsing function.
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
11 | |
|
37605
599b01f2f5a7
This should do it for the jabber tests
Gary Kramlich <grim@reaperworld.com>
parents:
31394
diff
changeset
|
12 | #define check_value(name, expected) G_STMT_START {\ |
|
599b01f2f5a7
This should do it for the jabber tests
Gary Kramlich <grim@reaperworld.com>
parents:
31394
diff
changeset
|
13 | value = g_hash_table_lookup(table, (name)); \ |
|
599b01f2f5a7
This should do it for the jabber tests
Gary Kramlich <grim@reaperworld.com>
parents:
31394
diff
changeset
|
14 | g_assert_nonnull(value); \ |
|
599b01f2f5a7
This should do it for the jabber tests
Gary Kramlich <grim@reaperworld.com>
parents:
31394
diff
changeset
|
15 | g_assert_cmpstr((expected), ==, value); \ |
|
599b01f2f5a7
This should do it for the jabber tests
Gary Kramlich <grim@reaperworld.com>
parents:
31394
diff
changeset
|
16 | } G_STMT_END |
|
31394
dd9b4ed08d0a
jabber: Test harness for DIGEST-MD5 parsing function.
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
17 | |
|
dd9b4ed08d0a
jabber: Test harness for DIGEST-MD5 parsing function.
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
18 | table = jabber_auth_digest_md5_parse("r=\"realm\",token= \" asdf\""); |
|
37605
599b01f2f5a7
This should do it for the jabber tests
Gary Kramlich <grim@reaperworld.com>
parents:
31394
diff
changeset
|
19 | check_value("r", "realm"); |
|
599b01f2f5a7
This should do it for the jabber tests
Gary Kramlich <grim@reaperworld.com>
parents:
31394
diff
changeset
|
20 | check_value("token", "asdf"); |
|
31394
dd9b4ed08d0a
jabber: Test harness for DIGEST-MD5 parsing function.
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
21 | g_hash_table_destroy(table); |
|
dd9b4ed08d0a
jabber: Test harness for DIGEST-MD5 parsing function.
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
22 | |
|
dd9b4ed08d0a
jabber: Test harness for DIGEST-MD5 parsing function.
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
23 | table = jabber_auth_digest_md5_parse("r=\"a\", token= \" asdf\""); |
|
37605
599b01f2f5a7
This should do it for the jabber tests
Gary Kramlich <grim@reaperworld.com>
parents:
31394
diff
changeset
|
24 | check_value("r", "a"); |
|
599b01f2f5a7
This should do it for the jabber tests
Gary Kramlich <grim@reaperworld.com>
parents:
31394
diff
changeset
|
25 | check_value("token", "asdf"); |
|
31394
dd9b4ed08d0a
jabber: Test harness for DIGEST-MD5 parsing function.
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
26 | g_hash_table_destroy(table); |
|
dd9b4ed08d0a
jabber: Test harness for DIGEST-MD5 parsing function.
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
27 | |
|
dd9b4ed08d0a
jabber: Test harness for DIGEST-MD5 parsing function.
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
28 | table = jabber_auth_digest_md5_parse("r=\"\", token= \" asdf\""); |
|
37605
599b01f2f5a7
This should do it for the jabber tests
Gary Kramlich <grim@reaperworld.com>
parents:
31394
diff
changeset
|
29 | check_value("r", ""); |
|
599b01f2f5a7
This should do it for the jabber tests
Gary Kramlich <grim@reaperworld.com>
parents:
31394
diff
changeset
|
30 | check_value("token", "asdf"); |
|
31394
dd9b4ed08d0a
jabber: Test harness for DIGEST-MD5 parsing function.
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
31 | g_hash_table_destroy(table); |
|
dd9b4ed08d0a
jabber: Test harness for DIGEST-MD5 parsing function.
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
32 | |
|
dd9b4ed08d0a
jabber: Test harness for DIGEST-MD5 parsing function.
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
33 | table = jabber_auth_digest_md5_parse("realm=\"somerealm\",nonce=\"OA6MG9tEQGm2hh\",qop=\"auth\",charset=utf-8,algorithm=md5-sess"); |
|
37605
599b01f2f5a7
This should do it for the jabber tests
Gary Kramlich <grim@reaperworld.com>
parents:
31394
diff
changeset
|
34 | check_value("realm", "somerealm"); |
|
599b01f2f5a7
This should do it for the jabber tests
Gary Kramlich <grim@reaperworld.com>
parents:
31394
diff
changeset
|
35 | check_value("nonce", "OA6MG9tEQGm2hh"); |
|
599b01f2f5a7
This should do it for the jabber tests
Gary Kramlich <grim@reaperworld.com>
parents:
31394
diff
changeset
|
36 | check_value("qop", "auth"); |
|
599b01f2f5a7
This should do it for the jabber tests
Gary Kramlich <grim@reaperworld.com>
parents:
31394
diff
changeset
|
37 | check_value("charset", "utf-8"); |
|
599b01f2f5a7
This should do it for the jabber tests
Gary Kramlich <grim@reaperworld.com>
parents:
31394
diff
changeset
|
38 | check_value("algorithm", "md5-sess"); |
|
31394
dd9b4ed08d0a
jabber: Test harness for DIGEST-MD5 parsing function.
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
39 | g_hash_table_destroy(table); |
|
37605
599b01f2f5a7
This should do it for the jabber tests
Gary Kramlich <grim@reaperworld.com>
parents:
31394
diff
changeset
|
40 | } |
|
31394
dd9b4ed08d0a
jabber: Test harness for DIGEST-MD5 parsing function.
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
41 | |
|
37605
599b01f2f5a7
This should do it for the jabber tests
Gary Kramlich <grim@reaperworld.com>
parents:
31394
diff
changeset
|
42 | gint |
|
599b01f2f5a7
This should do it for the jabber tests
Gary Kramlich <grim@reaperworld.com>
parents:
31394
diff
changeset
|
43 | main(gint argc, gchar **argv) { |
|
599b01f2f5a7
This should do it for the jabber tests
Gary Kramlich <grim@reaperworld.com>
parents:
31394
diff
changeset
|
44 | g_test_init(&argc, &argv, NULL); |
|
31394
dd9b4ed08d0a
jabber: Test harness for DIGEST-MD5 parsing function.
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
45 | |
|
37605
599b01f2f5a7
This should do it for the jabber tests
Gary Kramlich <grim@reaperworld.com>
parents:
31394
diff
changeset
|
46 | g_test_add_func("/jabber/digest/md5/parsing", |
|
599b01f2f5a7
This should do it for the jabber tests
Gary Kramlich <grim@reaperworld.com>
parents:
31394
diff
changeset
|
47 | test_jabber_digest_md5_parsing); |
|
31394
dd9b4ed08d0a
jabber: Test harness for DIGEST-MD5 parsing function.
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
48 | |
|
37605
599b01f2f5a7
This should do it for the jabber tests
Gary Kramlich <grim@reaperworld.com>
parents:
31394
diff
changeset
|
49 | return g_test_run(); |
|
31394
dd9b4ed08d0a
jabber: Test harness for DIGEST-MD5 parsing function.
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
50 | } |