15 typedef const char *
STR;
20 CS_INT fromtype,
void *fromdata,
size_t fromlen,
40 memset(&destfmt, 0,
sizeof(destfmt));
44 memset(&srcfmt, 0,
sizeof(srcfmt));
64 if (tores != retcode) {
70 if (reslen != tolen) {
71 err =
"result length";
76 if (todata && memcmp(todata,
buffer, tolen) != 0) {
78 for (
n = 0;
n < tolen; ++
n)
79 printf(
"%02x ", ((
unsigned char*)todata)[
n]);
81 for (
n = 0;
n < tolen; ++
n)
82 printf(
"%02x ", ((
unsigned char*)
buffer)[
n]);
101 fprintf(stderr,
"Test %s failed (ret=%d len=%d)\n", err, (
int) retcode, (
int) reslen);
102 fprintf(stderr,
"line: %d\n DO_TEST(%s,\n"
105 "\t %s,%s,%s);\n", line, sdecl, sfromtype, sfromdata, sfromlen, stotype, stomaxlen, stores, stodata, stolen);
110 #define DO_TEST(decl,fromtype,fromdata,fromlen,totype,tomaxlen,tores,todata,tolen) { \
112 DoTest(fromtype,fromdata,fromlen,totype,tomaxlen,tores,todata,tolen,\
113 #decl,#fromtype,#fromdata,#fromlen,#totype,#tomaxlen,#tores,#todata,#tolen,\
121 #ifdef tds_sysdep_int64_type
126 fprintf(stdout,
"%s: Testing conversion\n", __FILE__);
130 fprintf(stderr,
"Init failed\n");
247 #ifdef tds_sysdep_int64_type
250 test2.mnyhigh = ((one * 1234678) * 10000) >> 32;
255 test2.mnyhigh = ((one * -8765) * 10000) >> 32;
265 memset(
test2.str+5, 23, 251);
307 fprintf(stderr,
"Drop failed\n");
312 fprintf(stdout,
"Test succeded\n");
CS_RETCODE cs_ctx_alloc(CS_INT version, CS_CONTEXT **ctx)
CS_RETCODE cs_ctx_drop(CS_CONTEXT *ctx)
CS_RETCODE cs_convert(CS_CONTEXT *ctx, CS_DATAFMT *srcfmt, CS_VOID *srcdata, CS_DATAFMT *destfmt, CS_VOID *destdata, CS_INT *resultlen)
int main(int argc, char **argv)
static int DoTest(CS_INT fromtype, void *fromdata, size_t fromlen, CS_INT totype, CS_INT tomaxlen, CS_RETCODE tores, void *todata, CS_INT tolen, STR sdecl, STR sfromtype, STR sfromdata, STR sfromlen, STR stotype, STR stomaxlen, STR stores, STR stodata, STR stolen, int line)
#define DO_TEST(decl, fromtype, fromdata, fromlen, totype, tomaxlen, tores, todata, tolen)
static pcre_uint8 * buffer
int test(int srctype, const void *srcdata, int srclen, int dsttype, int dstlen)
#define test2(s, m, d, r)
#define tds_sysdep_int64_type