Commit 294573a5 authored by Alistair Leslie-Hughes's avatar Alistair Leslie-Hughes Committed by Alexandre Julliard

snmpapi: Correct snmpapi tests under win98.

parent b483b680
...@@ -92,10 +92,14 @@ static void test_SnmpUtilOidToA(void) ...@@ -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"; "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"; static const char expect4[] = "-1";
ret = SnmpUtilOidToA(NULL); /* This crashes under win98 */
ok(ret != NULL, "SnmpUtilOidToA failed\n"); if(0)
ok(!strcmp(ret, expect0), "SnmpUtilOidToA failed got \n%s\n expected \n%s\n", {
ret, expect1); 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); ret = SnmpUtilOidToA(&oid0);
ok(ret != NULL, "SnmpUtilOidToA failed\n"); ok(ret != NULL, "SnmpUtilOidToA failed\n");
...@@ -195,17 +199,43 @@ static void test_SnmpUtilOidCpyFree(void) ...@@ -195,17 +199,43 @@ static void test_SnmpUtilOidCpyFree(void)
static UINT ids[] = { 1, 3, 6, 1, 4, 1, 311 }; static UINT ids[] = { 1, 3, 6, 1, 4, 1, 311 };
static AsnObjectIdentifier dst, src = { sizeof(ids) / sizeof(ids[0]), ids }; static AsnObjectIdentifier dst, src = { sizeof(ids) / sizeof(ids[0]), ids };
ret = SnmpUtilOidCpy(NULL, NULL); /* These crashes under win98 */
ok(!ret, "SnmpUtilOidCpy succeeded\n"); 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, 1, sizeof(AsnObjectIdentifier)); memset(&dst, 0, sizeof(AsnObjectIdentifier));
ret = SnmpUtilOidCpy(&dst, NULL); ret = SnmpUtilOidCpy(&dst, &src);
ok(ret, "SnmpUtilOidCpy failed\n"); ok(ret, "SnmpUtilOidCpy failed\n");
ok(dst.idLength == 0, "SnmpUtilOidCpy failed\n"); ok(src.idLength == dst.idLength, "SnmpUtilOidCpy failed\n");
ok(dst.ids == NULL, "SnmpUtilOidCpy failed\n"); ok(!memcmp(src.ids, dst.ids, dst.idLength * sizeof(UINT)), "SnmpUtilOidCpy failed\n");
ret = SnmpUtilOidCpy(NULL, &src); /* These crashes under win98 */
ok(!ret, "SnmpUtilOidCpy succeeded\n"); 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)); memset(&dst, 0, sizeof(AsnObjectIdentifier));
ret = SnmpUtilOidCpy(&dst, &src); ret = SnmpUtilOidCpy(&dst, &src);
...@@ -213,7 +243,11 @@ static void test_SnmpUtilOidCpyFree(void) ...@@ -213,7 +243,11 @@ static void test_SnmpUtilOidCpyFree(void)
ok(src.idLength == dst.idLength, "SnmpUtilOidCpy failed\n"); ok(src.idLength == dst.idLength, "SnmpUtilOidCpy failed\n");
ok(!memcmp(src.ids, dst.ids, dst.idLength * sizeof(UINT)), "SnmpUtilOidCpy failed\n"); ok(!memcmp(src.ids, dst.ids, dst.idLength * sizeof(UINT)), "SnmpUtilOidCpy failed\n");
SnmpUtilOidFree(NULL); /* This crashes under win98 */
if(0)
{
SnmpUtilOidFree(NULL);
}
SnmpUtilOidFree(&dst); SnmpUtilOidFree(&dst);
ok(dst.idLength == 0, "SnmpUtilOidFree failed\n"); ok(dst.idLength == 0, "SnmpUtilOidFree failed\n");
ok(dst.ids == NULL, "SnmpUtilOidFree failed\n"); ok(dst.ids == NULL, "SnmpUtilOidFree failed\n");
...@@ -292,23 +326,27 @@ static void test_SnmpUtilOidNCmp(void) ...@@ -292,23 +326,27 @@ static void test_SnmpUtilOidNCmp(void)
static AsnObjectIdentifier oid1 = { 4, ids1 }; static AsnObjectIdentifier oid1 = { 4, ids1 };
static AsnObjectIdentifier oid2 = { 4, ids2 }; static AsnObjectIdentifier oid2 = { 4, ids2 };
ret = SnmpUtilOidNCmp(NULL, NULL, 0); /* This crashes under win98 */
ok(!ret, "SnmpUtilOidNCmp succeeded\n"); if(0)
{
ret = SnmpUtilOidNCmp(NULL, NULL, 0);
ok(!ret, "SnmpUtilOidNCmp succeeded\n");
ret = SnmpUtilOidNCmp(NULL, NULL, 1); ret = SnmpUtilOidNCmp(NULL, NULL, 1);
ok(!ret, "SnmpUtilOidNCmp succeeded\n"); ok(!ret, "SnmpUtilOidNCmp succeeded\n");
ret = SnmpUtilOidNCmp(&oid1, NULL, 0); ret = SnmpUtilOidNCmp(&oid1, NULL, 0);
ok(!ret, "SnmpUtilOidNCmp succeeded\n"); ok(!ret, "SnmpUtilOidNCmp succeeded\n");
ret = SnmpUtilOidNCmp(&oid1, NULL, 1); ret = SnmpUtilOidNCmp(&oid1, NULL, 1);
ok(!ret, "SnmpUtilOidNCmp succeeded\n"); ok(!ret, "SnmpUtilOidNCmp succeeded\n");
ret = SnmpUtilOidNCmp(NULL, &oid2, 0); ret = SnmpUtilOidNCmp(NULL, &oid2, 0);
ok(!ret, "SnmpUtilOidNCmp succeeded\n"); ok(!ret, "SnmpUtilOidNCmp succeeded\n");
ret = SnmpUtilOidNCmp(NULL, &oid2, 1); ret = SnmpUtilOidNCmp(NULL, &oid2, 1);
ok(!ret, "SnmpUtilOidNCmp succeeded\n"); ok(!ret, "SnmpUtilOidNCmp succeeded\n");
}
ret = SnmpUtilOidNCmp(&oid1, &oid1, 0); ret = SnmpUtilOidNCmp(&oid1, &oid1, 0);
ok(!ret, "SnmpUtilOidNCmp failed\n"); ok(!ret, "SnmpUtilOidNCmp failed\n");
...@@ -379,14 +417,18 @@ static void test_SnmpUtilOidAppend(void) ...@@ -379,14 +417,18 @@ static void test_SnmpUtilOidAppend(void)
oid1.idLength = 3; oid1.idLength = 3;
oid1.ids = ids1; oid1.ids = ids1;
ret = SnmpUtilOidAppend(NULL, NULL); /* This crashes under win98 */
ok(!ret, "SnmpUtilOidAppend succeeded\n"); if(0)
{
ret = SnmpUtilOidAppend(NULL, NULL);
ok(!ret, "SnmpUtilOidAppend succeeded\n");
ret = SnmpUtilOidAppend(&oid1, NULL); ret = SnmpUtilOidAppend(&oid1, NULL);
ok(ret, "SnmpUtilOidAppend failed\n"); ok(ret, "SnmpUtilOidAppend failed\n");
ret = SnmpUtilOidAppend(NULL, &oid2); ret = SnmpUtilOidAppend(NULL, &oid2);
ok(!ret, "SnmpUtilOidAppend succeeded\n"); ok(!ret, "SnmpUtilOidAppend succeeded\n");
}
ret = SnmpUtilOidAppend(&oid1, &oid2); ret = SnmpUtilOidAppend(&oid1, &oid2);
ok(ret, "SnmpUtilOidAppend failed\n"); ok(ret, "SnmpUtilOidAppend failed\n");
...@@ -403,19 +445,23 @@ static void test_SnmpUtilVarBindCpyFree(void) ...@@ -403,19 +445,23 @@ static void test_SnmpUtilVarBindCpyFree(void)
static UINT ids[] = { 1, 3, 6, 1, 4, 1, 311 }; static UINT ids[] = { 1, 3, 6, 1, 4, 1, 311 };
static SnmpVarBind dst, src = { { 7, ids }, { ASN_INTEGER, { 1 } } }; static SnmpVarBind dst, src = { { 7, ids }, { ASN_INTEGER, { 1 } } };
ret = SnmpUtilVarBindCpy(NULL, NULL); /* This crashes under win98 */
ok(!ret, "SnmpUtilVarBindCpy succeeded\n"); if(0)
{
memset(&dst, 0, sizeof(SnmpVarBind)); ret = SnmpUtilVarBindCpy(NULL, NULL);
ret = SnmpUtilVarBindCpy(&dst, NULL); ok(!ret, "SnmpUtilVarBindCpy succeeded\n");
ok(ret, "SnmpUtilVarBindCpy failed\n");
ok(dst.name.idLength == 0, "SnmpUtilVarBindCpy failed\n"); memset(&dst, 0, sizeof(SnmpVarBind));
ok(dst.name.ids == NULL, "SnmpUtilVarBindCpy failed\n"); ret = SnmpUtilVarBindCpy(&dst, NULL);
ok(dst.value.asnType == ASN_NULL, "SnmpUtilVarBindCpy failed\n"); ok(ret, "SnmpUtilVarBindCpy failed\n");
ok(dst.value.asnValue.number == 0, "SnmpUtilVarBindCpy failed\n"); ok(dst.name.idLength == 0, "SnmpUtilVarBindCpy failed\n");
ok(dst.name.ids == NULL, "SnmpUtilVarBindCpy failed\n");
ret = SnmpUtilVarBindCpy(NULL, &src); ok(dst.value.asnType == ASN_NULL, "SnmpUtilVarBindCpy failed\n");
ok(!ret, "SnmpUtilVarBindCpy succeeded\n"); ok(dst.value.asnValue.number == 0, "SnmpUtilVarBindCpy failed\n");
ret = SnmpUtilVarBindCpy(NULL, &src);
ok(!ret, "SnmpUtilVarBindCpy succeeded\n");
}
memset(&dst, 0, sizeof(SnmpVarBind)); memset(&dst, 0, sizeof(SnmpVarBind));
ret = SnmpUtilVarBindCpy(&dst, &src); ret = SnmpUtilVarBindCpy(&dst, &src);
...@@ -426,7 +472,11 @@ static void test_SnmpUtilVarBindCpyFree(void) ...@@ -426,7 +472,11 @@ static void test_SnmpUtilVarBindCpyFree(void)
ok(!memcmp(&src.value, &dst.value, sizeof(AsnObjectSyntax)), ok(!memcmp(&src.value, &dst.value, sizeof(AsnObjectSyntax)),
"SnmpUtilVarBindCpy failed\n"); "SnmpUtilVarBindCpy failed\n");
SnmpUtilVarBindFree(NULL); /* This crashes under win98 */
if(0)
{
SnmpUtilVarBindFree(NULL);
}
SnmpUtilVarBindFree(&dst); SnmpUtilVarBindFree(&dst);
ok(dst.name.idLength == 0, "SnmpUtilVarBindFree failed\n"); ok(dst.name.idLength == 0, "SnmpUtilVarBindFree failed\n");
ok(dst.name.ids == NULL, "SnmpUtilVarBindFree failed\n"); ok(dst.name.ids == NULL, "SnmpUtilVarBindFree failed\n");
...@@ -449,11 +499,15 @@ static void test_SnmpUtilVarBindListCpyFree(void) ...@@ -449,11 +499,15 @@ static void test_SnmpUtilVarBindListCpyFree(void)
ok(!ret, "SnmpUtilVarBindListCpy succeeded\n"); ok(!ret, "SnmpUtilVarBindListCpy succeeded\n");
} }
memset(&dst_list, 0xff, sizeof(SnmpVarBindList)); /* This crashes under win98 */
ret = SnmpUtilVarBindListCpy(&dst_list, NULL); if(0)
ok(ret, "SnmpUtilVarBindListCpy failed\n"); {
ok(dst_list.list == NULL, "SnmpUtilVarBindListCpy failed\n"); memset(&dst_list, 0xff, sizeof(SnmpVarBindList));
ok(dst_list.len == 0, "SnmpUtilVarBindListCpy failed\n"); 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); ret = SnmpUtilVarBindListCpy(&dst_list, &src_list);
ok(ret, "SnmpUtilVarBindListCpy failed\n"); ok(ret, "SnmpUtilVarBindListCpy failed\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment