snmpapi: Relax tests to fix some failures.
The tests were overly restrictive. The functions are supposed to return values less than 0, 0, or greater than 0, whereas the tests restricted the return values to -1, 0, or 1. Using less than 0/greater than 0 comparisons rather than == -1 or == 1 should fix a few failing tests, and match the API descriptions better.
This commit is contained in:
parent
5d16361f88
commit
dd75176d34
|
@ -330,7 +330,7 @@ static void test_SnmpUtilOctetsCmp(void)
|
||||||
ok(ret == 1, "SnmpUtilOctetsCmp failed\n");
|
ok(ret == 1, "SnmpUtilOctetsCmp failed\n");
|
||||||
|
|
||||||
ret = pSnmpUtilOctetsCmp(&octets1, &octets2);
|
ret = pSnmpUtilOctetsCmp(&octets1, &octets2);
|
||||||
ok(ret == -1, "SnmpUtilOctetsCmp failed\n");
|
ok(ret < 0, "SnmpUtilOctetsCmp failed\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_SnmpUtilOidNCmp(void)
|
static void test_SnmpUtilOidNCmp(void)
|
||||||
|
@ -370,19 +370,19 @@ static void test_SnmpUtilOidNCmp(void)
|
||||||
ok(!ret, "SnmpUtilOidNCmp failed\n");
|
ok(!ret, "SnmpUtilOidNCmp failed\n");
|
||||||
|
|
||||||
ret = SnmpUtilOidNCmp(&oid1, &oid2, 4);
|
ret = SnmpUtilOidNCmp(&oid1, &oid2, 4);
|
||||||
ok(ret == -1, "SnmpUtilOidNCmp failed: %d\n", ret);
|
ok(ret < 0, "SnmpUtilOidNCmp failed: %d\n", ret);
|
||||||
|
|
||||||
ret = SnmpUtilOidNCmp(&oid2, &oid1, 4);
|
ret = SnmpUtilOidNCmp(&oid2, &oid1, 4);
|
||||||
ok(ret == 1, "SnmpUtilOidNCmp failed: %d\n", ret);
|
ok(ret > 0, "SnmpUtilOidNCmp failed: %d\n", ret);
|
||||||
|
|
||||||
oid1.idLength = 3;
|
oid1.idLength = 3;
|
||||||
memcpy(oid1.ids, oid2.ids, sizeof(UINT) * 4);
|
memcpy(oid1.ids, oid2.ids, sizeof(UINT) * 4);
|
||||||
ret = SnmpUtilOidNCmp(&oid1, &oid1, 4);
|
ret = SnmpUtilOidNCmp(&oid1, &oid1, 4);
|
||||||
ok(!ret, "SnmpUtilOidNCmp failed: %d\n", ret);
|
ok(!ret, "SnmpUtilOidNCmp failed: %d\n", ret);
|
||||||
ret = SnmpUtilOidNCmp(&oid2, &oid1, 4);
|
ret = SnmpUtilOidNCmp(&oid2, &oid1, 4);
|
||||||
ok(ret == 1, "SnmpUtilOidNCmp failed: %d\n", ret);
|
ok(ret > 0, "SnmpUtilOidNCmp failed: %d\n", ret);
|
||||||
ret = SnmpUtilOidNCmp(&oid1, &oid2, 4);
|
ret = SnmpUtilOidNCmp(&oid1, &oid2, 4);
|
||||||
ok(ret == -1, "SnmpUtilOidNCmp failed: %d\n", ret);
|
ok(ret < 0, "SnmpUtilOidNCmp failed: %d\n", ret);
|
||||||
|
|
||||||
ret = SnmpUtilOidNCmp(&oid1, &oid2, 2);
|
ret = SnmpUtilOidNCmp(&oid1, &oid2, 2);
|
||||||
ok(!ret, "SnmpUtilOidNCmp failed: %d\n", ret);
|
ok(!ret, "SnmpUtilOidNCmp failed: %d\n", ret);
|
||||||
|
@ -410,10 +410,10 @@ static void test_SnmpUtilOidCmp(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = SnmpUtilOidCmp(&oid2, &oid1);
|
ret = SnmpUtilOidCmp(&oid2, &oid1);
|
||||||
ok(ret == 1, "SnmpUtilOidCmp failed\n");
|
ok(ret > 0, "SnmpUtilOidCmp failed\n");
|
||||||
|
|
||||||
ret = SnmpUtilOidCmp(&oid1, &oid2);
|
ret = SnmpUtilOidCmp(&oid1, &oid2);
|
||||||
ok(ret == -1, "SnmpUtilOidCmp failed\n");
|
ok(ret < 0, "SnmpUtilOidCmp failed\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_SnmpUtilOidAppend(void)
|
static void test_SnmpUtilOidAppend(void)
|
||||||
|
|
Loading…
Reference in New Issue