snmpapi: Correct snmpapi tests under win98.

This commit is contained in:
Alistair Leslie-Hughes 2008-06-03 20:08:02 +10:00 committed by Alexandre Julliard
parent b483b68013
commit 294573a594
1 changed files with 103 additions and 49 deletions

View File

@ -92,10 +92,14 @@ static void test_SnmpUtilOidToA(void)
"1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1";
static const char expect4[] = "-1";
ret = SnmpUtilOidToA(NULL);
ok(ret != NULL, "SnmpUtilOidToA failed\n");
ok(!strcmp(ret, expect0), "SnmpUtilOidToA failed got \n%s\n expected \n%s\n",
ret, expect1);
/* This crashes under win98 */
if(0)
{
ret = SnmpUtilOidToA(NULL);
ok(ret != NULL, "SnmpUtilOidToA failed\n");
ok(!strcmp(ret, expect0), "SnmpUtilOidToA failed got \n%s\n expected \n%s\n",
ret, expect1);
}
ret = SnmpUtilOidToA(&oid0);
ok(ret != NULL, "SnmpUtilOidToA failed\n");
@ -195,17 +199,21 @@ static void test_SnmpUtilOidCpyFree(void)
static UINT ids[] = { 1, 3, 6, 1, 4, 1, 311 };
static AsnObjectIdentifier dst, src = { sizeof(ids) / sizeof(ids[0]), ids };
ret = SnmpUtilOidCpy(NULL, NULL);
ok(!ret, "SnmpUtilOidCpy succeeded\n");
/* These crashes under win98 */
if(0)
{
ret = SnmpUtilOidCpy(NULL, NULL);
ok(!ret, "SnmpUtilOidCpy succeeded\n");
memset(&dst, 1, sizeof(AsnObjectIdentifier));
ret = SnmpUtilOidCpy(&dst, NULL);
ok(ret, "SnmpUtilOidCpy failed\n");
ok(dst.idLength == 0, "SnmpUtilOidCpy failed\n");
ok(dst.ids == NULL, "SnmpUtilOidCpy failed\n");
memset(&dst, 1, sizeof(AsnObjectIdentifier));
ret = SnmpUtilOidCpy(&dst, NULL);
ok(ret, "SnmpUtilOidCpy failed\n");
ok(dst.idLength == 0, "SnmpUtilOidCpy failed\n");
ok(dst.ids == NULL, "SnmpUtilOidCpy failed\n");
ret = SnmpUtilOidCpy(NULL, &src);
ok(!ret, "SnmpUtilOidCpy succeeded\n");
ret = SnmpUtilOidCpy(NULL, &src);
ok(!ret, "SnmpUtilOidCpy succeeded\n");
}
memset(&dst, 0, sizeof(AsnObjectIdentifier));
ret = SnmpUtilOidCpy(&dst, &src);
@ -213,7 +221,33 @@ static void test_SnmpUtilOidCpyFree(void)
ok(src.idLength == dst.idLength, "SnmpUtilOidCpy failed\n");
ok(!memcmp(src.ids, dst.ids, dst.idLength * sizeof(UINT)), "SnmpUtilOidCpy failed\n");
SnmpUtilOidFree(NULL);
/* These crashes under win98 */
if(0)
{
ret = SnmpUtilOidCpy(NULL, NULL);
ok(!ret, "SnmpUtilOidCpy succeeded\n");
memset(&dst, 1, sizeof(AsnObjectIdentifier));
ret = SnmpUtilOidCpy(&dst, NULL);
ok(ret, "SnmpUtilOidCpy failed\n");
ok(dst.idLength == 0, "SnmpUtilOidCpy failed\n");
ok(dst.ids == NULL, "SnmpUtilOidCpy failed\n");
ret = SnmpUtilOidCpy(NULL, &src);
ok(!ret, "SnmpUtilOidCpy succeeded\n");
}
memset(&dst, 0, sizeof(AsnObjectIdentifier));
ret = SnmpUtilOidCpy(&dst, &src);
ok(ret, "SnmpUtilOidCpy failed\n");
ok(src.idLength == dst.idLength, "SnmpUtilOidCpy failed\n");
ok(!memcmp(src.ids, dst.ids, dst.idLength * sizeof(UINT)), "SnmpUtilOidCpy failed\n");
/* This crashes under win98 */
if(0)
{
SnmpUtilOidFree(NULL);
}
SnmpUtilOidFree(&dst);
ok(dst.idLength == 0, "SnmpUtilOidFree failed\n");
ok(dst.ids == NULL, "SnmpUtilOidFree failed\n");
@ -292,23 +326,27 @@ static void test_SnmpUtilOidNCmp(void)
static AsnObjectIdentifier oid1 = { 4, ids1 };
static AsnObjectIdentifier oid2 = { 4, ids2 };
ret = SnmpUtilOidNCmp(NULL, NULL, 0);
ok(!ret, "SnmpUtilOidNCmp succeeded\n");
/* This crashes under win98 */
if(0)
{
ret = SnmpUtilOidNCmp(NULL, NULL, 0);
ok(!ret, "SnmpUtilOidNCmp succeeded\n");
ret = SnmpUtilOidNCmp(NULL, NULL, 1);
ok(!ret, "SnmpUtilOidNCmp succeeded\n");
ret = SnmpUtilOidNCmp(NULL, NULL, 1);
ok(!ret, "SnmpUtilOidNCmp succeeded\n");
ret = SnmpUtilOidNCmp(&oid1, NULL, 0);
ok(!ret, "SnmpUtilOidNCmp succeeded\n");
ret = SnmpUtilOidNCmp(&oid1, NULL, 0);
ok(!ret, "SnmpUtilOidNCmp succeeded\n");
ret = SnmpUtilOidNCmp(&oid1, NULL, 1);
ok(!ret, "SnmpUtilOidNCmp succeeded\n");
ret = SnmpUtilOidNCmp(&oid1, NULL, 1);
ok(!ret, "SnmpUtilOidNCmp succeeded\n");
ret = SnmpUtilOidNCmp(NULL, &oid2, 0);
ok(!ret, "SnmpUtilOidNCmp succeeded\n");
ret = SnmpUtilOidNCmp(NULL, &oid2, 0);
ok(!ret, "SnmpUtilOidNCmp succeeded\n");
ret = SnmpUtilOidNCmp(NULL, &oid2, 1);
ok(!ret, "SnmpUtilOidNCmp succeeded\n");
ret = SnmpUtilOidNCmp(NULL, &oid2, 1);
ok(!ret, "SnmpUtilOidNCmp succeeded\n");
}
ret = SnmpUtilOidNCmp(&oid1, &oid1, 0);
ok(!ret, "SnmpUtilOidNCmp failed\n");
@ -379,14 +417,18 @@ static void test_SnmpUtilOidAppend(void)
oid1.idLength = 3;
oid1.ids = ids1;
ret = SnmpUtilOidAppend(NULL, NULL);
ok(!ret, "SnmpUtilOidAppend succeeded\n");
/* This crashes under win98 */
if(0)
{
ret = SnmpUtilOidAppend(NULL, NULL);
ok(!ret, "SnmpUtilOidAppend succeeded\n");
ret = SnmpUtilOidAppend(&oid1, NULL);
ok(ret, "SnmpUtilOidAppend failed\n");
ret = SnmpUtilOidAppend(&oid1, NULL);
ok(ret, "SnmpUtilOidAppend failed\n");
ret = SnmpUtilOidAppend(NULL, &oid2);
ok(!ret, "SnmpUtilOidAppend succeeded\n");
ret = SnmpUtilOidAppend(NULL, &oid2);
ok(!ret, "SnmpUtilOidAppend succeeded\n");
}
ret = SnmpUtilOidAppend(&oid1, &oid2);
ok(ret, "SnmpUtilOidAppend failed\n");
@ -403,19 +445,23 @@ static void test_SnmpUtilVarBindCpyFree(void)
static UINT ids[] = { 1, 3, 6, 1, 4, 1, 311 };
static SnmpVarBind dst, src = { { 7, ids }, { ASN_INTEGER, { 1 } } };
ret = SnmpUtilVarBindCpy(NULL, NULL);
ok(!ret, "SnmpUtilVarBindCpy succeeded\n");
/* This crashes under win98 */
if(0)
{
ret = SnmpUtilVarBindCpy(NULL, NULL);
ok(!ret, "SnmpUtilVarBindCpy succeeded\n");
memset(&dst, 0, sizeof(SnmpVarBind));
ret = SnmpUtilVarBindCpy(&dst, NULL);
ok(ret, "SnmpUtilVarBindCpy failed\n");
ok(dst.name.idLength == 0, "SnmpUtilVarBindCpy failed\n");
ok(dst.name.ids == NULL, "SnmpUtilVarBindCpy failed\n");
ok(dst.value.asnType == ASN_NULL, "SnmpUtilVarBindCpy failed\n");
ok(dst.value.asnValue.number == 0, "SnmpUtilVarBindCpy failed\n");
memset(&dst, 0, sizeof(SnmpVarBind));
ret = SnmpUtilVarBindCpy(&dst, NULL);
ok(ret, "SnmpUtilVarBindCpy failed\n");
ok(dst.name.idLength == 0, "SnmpUtilVarBindCpy failed\n");
ok(dst.name.ids == NULL, "SnmpUtilVarBindCpy failed\n");
ok(dst.value.asnType == ASN_NULL, "SnmpUtilVarBindCpy failed\n");
ok(dst.value.asnValue.number == 0, "SnmpUtilVarBindCpy failed\n");
ret = SnmpUtilVarBindCpy(NULL, &src);
ok(!ret, "SnmpUtilVarBindCpy succeeded\n");
ret = SnmpUtilVarBindCpy(NULL, &src);
ok(!ret, "SnmpUtilVarBindCpy succeeded\n");
}
memset(&dst, 0, sizeof(SnmpVarBind));
ret = SnmpUtilVarBindCpy(&dst, &src);
@ -426,7 +472,11 @@ static void test_SnmpUtilVarBindCpyFree(void)
ok(!memcmp(&src.value, &dst.value, sizeof(AsnObjectSyntax)),
"SnmpUtilVarBindCpy failed\n");
SnmpUtilVarBindFree(NULL);
/* This crashes under win98 */
if(0)
{
SnmpUtilVarBindFree(NULL);
}
SnmpUtilVarBindFree(&dst);
ok(dst.name.idLength == 0, "SnmpUtilVarBindFree failed\n");
ok(dst.name.ids == NULL, "SnmpUtilVarBindFree failed\n");
@ -449,11 +499,15 @@ static void test_SnmpUtilVarBindListCpyFree(void)
ok(!ret, "SnmpUtilVarBindListCpy succeeded\n");
}
memset(&dst_list, 0xff, sizeof(SnmpVarBindList));
ret = SnmpUtilVarBindListCpy(&dst_list, NULL);
ok(ret, "SnmpUtilVarBindListCpy failed\n");
ok(dst_list.list == NULL, "SnmpUtilVarBindListCpy failed\n");
ok(dst_list.len == 0, "SnmpUtilVarBindListCpy failed\n");
/* This crashes under win98 */
if(0)
{
memset(&dst_list, 0xff, sizeof(SnmpVarBindList));
ret = SnmpUtilVarBindListCpy(&dst_list, NULL);
ok(ret, "SnmpUtilVarBindListCpy failed\n");
ok(dst_list.list == NULL, "SnmpUtilVarBindListCpy failed\n");
ok(dst_list.len == 0, "SnmpUtilVarBindListCpy failed\n");
}
ret = SnmpUtilVarBindListCpy(&dst_list, &src_list);
ok(ret, "SnmpUtilVarBindListCpy failed\n");