ossp-pkg/xds/regression-tests/xdr-int32.c 1.1 -> 1.2
--- xdr-int32.c 2001/07/18 11:29:46 1.1
+++ xdr-int32.c 2001/07/18 18:26:33 1.2
@@ -102,6 +102,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, "int", &xdr_decode_int32, 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(int32_t); ++i)
+ {
+ int32_t tmp;
+ if (xds_decode(xds, "int", &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;
|
|