ossp-pkg/xds/regression-tests/xdr-int64.c 1.1 -> 1.2
--- xdr-int64.c 2001/07/18 16:59:28 1.1
+++ xdr-int64.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_int64, 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(int64_t); ++i)
+ {
+ int64_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;
|
|