OSSP CVS Repository

ossp - Difference in ossp-pkg/sa/sa_test.c versions 1.13 and 1.14
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/sa/sa_test.c 1.13 -> 1.14

--- sa_test.c    2002/01/02 12:43:50     1.13
+++ sa_test.c    2002/01/30 16:43:00     1.14
@@ -28,6 +28,10 @@
 **  sa_test.c: socket abstraction library test suite
 */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdarg.h>
@@ -145,6 +149,32 @@
     /* FIXME */
 }
 
+/* test: exception handling */
+#ifdef WITH_EX
+#include "ex.h"
+TS_TEST(test_sa_ex)
+{
+    sa_addr_t *saa;
+    ex_t ex;
+    int caught;
+
+    ts_test_check(TS_CTX, "exception handling");
+    caught = 0;
+    ex_try {
+        sa_addr_create(&saa);
+        sa_addr_u2a(saa, "inet:DUMMY");
+        sa_addr_destroy(saa);
+    }
+    ex_catch (ex) {
+        if ((sa_rc_t)ex.ex_value != SA_ERR_ARG)
+            ts_test_fail(TS_CTX, "unexpected exception: %d\n", (sa_rc_t)ex.ex_value);
+        caught = 1;
+    }
+    if (!caught)
+        ts_test_fail(TS_CTX, "expected exception not caught\n");
+}
+#endif
+
 int main(int argc, char *argv[])
 {
     ts_suite_t *ts;
@@ -155,6 +185,9 @@
     ts_suite_test(ts, test_saa_match,   "socket address abstraction matching");
     ts_suite_test(ts, test_sa_stream,   "socket abstraction stream communication");
     ts_suite_test(ts, test_sa_datagram, "socket abstraction datagram communication");
+#ifdef WITH_EX
+    ts_suite_test(ts, test_sa_ex,       "exception handling");
+#endif
     n = ts_suite_run(ts);
     ts_suite_free(ts);
     return n;

CVSTrac 2.0.1