OSSP CVS Repository

ossp - Difference in ossp-pkg/xds/regression-tests/xdr-uint32.c versions 1.1 and 1.2
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/xds/regression-tests/xdr-uint32.c 1.1 -> 1.2

--- xdr-uint32.c 2001/07/18 11:29:46     1.1
+++ xdr-uint32.c 2001/07/18 18:26:33     1.2
@@ -101,6 +101,42 @@
         return 1;
         }
 
+    /* Now we decode the values again using the XDS implementation and
+       compare them to our original values. Obviously, they should not
+       differ. */
+
+    xds = xds_init(XDS_DECODE);
+    if (xds == NULL)
+        {
+        printf("Failed to initialize XDS context.\n");
+        return 1;
+        }
+    if (xds_register(xds, "uint", &xdr_decode_uint32, NULL) != XDS_OK)
+        {
+        printf("Failed to register my decoding engines.\n");
+        return 1;
+        }
+    if (xds_setbuffer(xds, XDS_GIFT, xds_buf, xds_buf_size) != XDS_OK)
+        {
+        printf("setbuffer() failed.\n");
+        return 1;
+        }
+    for (i = 0; i < sizeof(values)/sizeof(u_int32_t); ++i)
+        {
+        u_int32_t tmp;
+        if (xds_decode(xds, "uint", &tmp) != XDS_OK)
+            {
+            printf("xds_encode() failed for the %d value!", i);
+            return 1;
+            }
+        if (values[i] != tmp)
+            {
+            printf("The %dth value has not been decoded correctly!", i);
+            return 1;
+            }
+        }
+    xds_destroy(xds);
+
     /* Everything went fine. */
 
     return 0;

CVSTrac 2.0.1