Commit 590a71c3 authored by Dafydd Harries's avatar Dafydd Harries

address/: add tests for IPv6 support

darcs-hash:20070212130517-c9803-579e83785de0df147df7a6f461c50d4f63054a99.gz
parent f1df61dc
...@@ -53,6 +53,9 @@ nice_address_equal (NiceAddress *a, NiceAddress *b); ...@@ -53,6 +53,9 @@ nice_address_equal (NiceAddress *a, NiceAddress *b);
gchar * gchar *
nice_address_to_string (NiceAddress *addr); nice_address_to_string (NiceAddress *addr);
gboolean
nice_address_is_private (NiceAddress *a);
G_END_DECLS G_END_DECLS
#endif /* _ADDRESS_H */ #endif /* _ADDRESS_H */
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
#include "address.h" #include "address.h"
int static void
main (void) test_ipv4 (void)
{ {
NiceAddress addr = {0,}; NiceAddress addr = {0,};
NiceAddress other = {0,}; NiceAddress other = {0,};
...@@ -29,7 +29,31 @@ main (void) ...@@ -29,7 +29,31 @@ main (void)
nice_address_set_ipv4 (&other, 0x01020304); nice_address_set_ipv4 (&other, 0x01020304);
addr.port = 1; addr.port = 1;
g_assert (FALSE == nice_address_equal (&addr, &other)); g_assert (FALSE == nice_address_equal (&addr, &other));
}
static void
test_ipv6 (void)
{
NiceAddress addr = {0,};
gchar *str;
nice_address_set_ipv6 (&addr,
"\x00\x11\x22\x33"
"\x44\x55\x66\x77"
"\x88\x99\xaa\xbb"
"\xcc\xdd\xee\xff");
g_assert (addr.type == NICE_ADDRESS_TYPE_IPV6);
str = nice_address_to_string (&addr);
g_assert (0 == strcmp (str, "11:2233:4455:6677:8899:aabb:ccdd:eeff"));
g_free (str);
}
int
main (void)
{
test_ipv4 ();
test_ipv6 ();
return 0; return 0;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment