summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2007-03-01 18:52:39 +0000
committerBenny Prijono <bennylp@teluu.com>2007-03-01 18:52:39 +0000
commite4a0cf0e1d20888824896efaa3b0d58116a0adfc (patch)
tree76b62785d3fa617f945064964ee2f1540005f9c4
parent033e10d739df26a65b673f04e2ff20821e544c96 (diff)
Related to ticket #148: added test in pjlib-test to capture the error
git-svn-id: http://svn.pjsip.org/repos/pjproject/branches/pjproject-0.5-stable@1028 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r--pjlib/src/pjlib-test/sock.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/pjlib/src/pjlib-test/sock.c b/pjlib/src/pjlib-test/sock.c
index 2eee2c5e..a3df9b63 100644
--- a/pjlib/src/pjlib-test/sock.c
+++ b/pjlib/src/pjlib-test/sock.c
@@ -51,6 +51,7 @@
* - pj_sock_connect()
* - pj_sock_listen()
* - pj_sock_accept()
+ * - pj_gethostbyname()
*
*
* This file is <b>pjlib-test/sock.c</b>
@@ -441,6 +442,23 @@ static int ioctl_test(void)
return 0;
}
+static int gethostbyname_test(void)
+{
+ pj_str_t host;
+ pj_hostent he;
+ pj_status_t status;
+
+ /* Testing pj_gethostbyname() with invalid host */
+ host = pj_str("an-invalid-host-name");
+ status = pj_gethostbyname(&host, &he);
+
+ /* Must return failure! */
+ if (status == PJ_SUCCESS)
+ return -20100;
+ else
+ return 0;
+}
+
int sock_test()
{
int rc;
@@ -451,6 +469,10 @@ int sock_test()
if (rc != 0)
return rc;
+ rc = gethostbyname_test();
+ if (rc != 0)
+ return rc;
+
rc = simple_sock_test();
if (rc != 0)
return rc;