X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=test%2Ftstodr.c;h=1106c90806488f082322c8ad34d0aececa08e59e;hb=be1157fee3451c37508c9ec3b4b4b8603a646c0b;hp=9561e11c16087f586d3fd03d9cd40b4fbb01cfe1;hpb=c6e47cbbff56f39f6d81b079ebaeac41d793d4d9;p=yaz-moved-to-github.git diff --git a/test/tstodr.c b/test/tstodr.c index 9561e11..1106c90 100644 --- a/test/tstodr.c +++ b/test/tstodr.c @@ -1,14 +1,18 @@ /* - * Copyright (c) 1995-2003, Index Data + * Copyright (C) 1995-2005, Index Data ApS * See the file LICENSE for details. * - * $Id: tstodr.c,v 1.1 2003-10-27 12:21:38 adam Exp $ + * $Id: tstodr.c,v 1.7 2005-08-22 20:34:23 adam Exp $ * */ +#include #include #include +#include #include "tstodrcodec.h" +#define MYOID "1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19" + void tst_MySequence1(ODR encode, ODR decode) { char *ber_buf; @@ -18,12 +22,14 @@ void tst_MySequence1(ODR encode, ODR decode) s->first = odr_intdup(encode, 12345); s->second = odr_malloc(encode, sizeof(*s->second)); - s->second->buf = "hello"; + s->second->buf = (unsigned char *) "hello"; s->second->len = 5; s->second->size = 0; s->third = odr_intdup(encode, 1); s->fourth = odr_nullval(); s->fifth = odr_intdup(encode, YC_MySequence_enum1); + + s->myoid = odr_getoidbystr(decode, MYOID); if (!yc_MySequence(encode, &s, 0, 0)) exit(1); @@ -46,23 +52,32 @@ void tst_MySequence1(ODR encode, ODR decode) exit(7); if (!t->fifth || *t->fifth != YC_MySequence_enum1) exit(8); + if (!t->myoid) + exit(9); + else + { + int *myoid = odr_getoidbystr(decode, MYOID); + struct oident *oident; + + if (oid_oidcmp(myoid, t->myoid)) + exit(10); + oident = oid_getentbyoid(t->myoid); + } } void tst_MySequence2(ODR encode, ODR decode) { - char *ber_buf; - int ber_len; Yc_MySequence *s = odr_malloc(encode, sizeof(*s)); - Yc_MySequence *t; s->first = 0; /* deliberately miss this .. */ s->second = odr_malloc(encode, sizeof(*s->second)); - s->second->buf = "hello"; + s->second->buf = (unsigned char *) "hello"; s->second->len = 5; s->second->size = 0; s->third = odr_intdup(encode, 1); s->fourth = odr_nullval(); s->fifth = odr_intdup(encode, YC_MySequence_enum1); + s->myoid = odr_getoidbystr(encode, MYOID); if (yc_MySequence(encode, &s, 0, 0)) /* should fail */ exit(9); @@ -113,3 +128,11 @@ int main(int argc, char **argv) odr_destroy(odr_decode); exit(0); } +/* + * Local variables: + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + * vim: shiftwidth=4 tabstop=8 expandtab + */ +