|
|
|
|
@ -188,104 +188,79 @@ int IPPairBitIsnotset(IPPair *h, uint32_t idx, SCTime_t ts)
|
|
|
|
|
#ifdef UNITTESTS
|
|
|
|
|
static int IPPairBitTest01 (void)
|
|
|
|
|
{
|
|
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
|
|
StorageCleanup();
|
|
|
|
|
StorageInit();
|
|
|
|
|
IPPairBitInitCtx();
|
|
|
|
|
StorageFinalize();
|
|
|
|
|
IPPairInitConfig(true);
|
|
|
|
|
IPPair *h = IPPairAlloc();
|
|
|
|
|
if (h == NULL)
|
|
|
|
|
goto end;
|
|
|
|
|
FAIL_IF_NULL(h);
|
|
|
|
|
|
|
|
|
|
IPPairBitAdd(h, 0, SCTIME_FROM_SECS(0));
|
|
|
|
|
|
|
|
|
|
XBit *fb = IPPairBitGet(h,0);
|
|
|
|
|
if (fb != NULL)
|
|
|
|
|
ret = 1;
|
|
|
|
|
FAIL_IF_NULL(fb);
|
|
|
|
|
|
|
|
|
|
IPPairFree(h);
|
|
|
|
|
end:
|
|
|
|
|
IPPairShutdown();
|
|
|
|
|
StorageCleanup();
|
|
|
|
|
return ret;
|
|
|
|
|
PASS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int IPPairBitTest02 (void)
|
|
|
|
|
{
|
|
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
|
|
StorageCleanup();
|
|
|
|
|
StorageInit();
|
|
|
|
|
IPPairBitInitCtx();
|
|
|
|
|
StorageFinalize();
|
|
|
|
|
IPPairInitConfig(true);
|
|
|
|
|
IPPair *h = IPPairAlloc();
|
|
|
|
|
if (h == NULL)
|
|
|
|
|
goto end;
|
|
|
|
|
FAIL_IF_NULL(h);
|
|
|
|
|
|
|
|
|
|
XBit *fb = IPPairBitGet(h,0);
|
|
|
|
|
if (fb == NULL)
|
|
|
|
|
ret = 1;
|
|
|
|
|
FAIL_IF_NOT_NULL(fb);
|
|
|
|
|
|
|
|
|
|
IPPairFree(h);
|
|
|
|
|
end:
|
|
|
|
|
IPPairShutdown();
|
|
|
|
|
StorageCleanup();
|
|
|
|
|
return ret;
|
|
|
|
|
PASS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int IPPairBitTest03 (void)
|
|
|
|
|
{
|
|
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
|
|
StorageCleanup();
|
|
|
|
|
StorageInit();
|
|
|
|
|
IPPairBitInitCtx();
|
|
|
|
|
StorageFinalize();
|
|
|
|
|
IPPairInitConfig(true);
|
|
|
|
|
IPPair *h = IPPairAlloc();
|
|
|
|
|
if (h == NULL)
|
|
|
|
|
goto end;
|
|
|
|
|
FAIL_IF_NULL(h);
|
|
|
|
|
|
|
|
|
|
IPPairBitAdd(h, 0, SCTIME_FROM_SECS(30));
|
|
|
|
|
|
|
|
|
|
XBit *fb = IPPairBitGet(h,0);
|
|
|
|
|
if (fb == NULL) {
|
|
|
|
|
printf("fb == NULL although it was just added: ");
|
|
|
|
|
goto end;
|
|
|
|
|
}
|
|
|
|
|
FAIL_IF_NULL(fb);
|
|
|
|
|
|
|
|
|
|
IPPairBitRemove(h, 0);
|
|
|
|
|
|
|
|
|
|
fb = IPPairBitGet(h,0);
|
|
|
|
|
if (fb != NULL) {
|
|
|
|
|
printf("fb != NULL although it was just removed: ");
|
|
|
|
|
goto end;
|
|
|
|
|
} else {
|
|
|
|
|
ret = 1;
|
|
|
|
|
}
|
|
|
|
|
FAIL_IF_NOT_NULL(fb);
|
|
|
|
|
|
|
|
|
|
IPPairFree(h);
|
|
|
|
|
end:
|
|
|
|
|
IPPairShutdown();
|
|
|
|
|
StorageCleanup();
|
|
|
|
|
return ret;
|
|
|
|
|
PASS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int IPPairBitTest04 (void)
|
|
|
|
|
{
|
|
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
|
|
StorageCleanup();
|
|
|
|
|
StorageInit();
|
|
|
|
|
IPPairBitInitCtx();
|
|
|
|
|
StorageFinalize();
|
|
|
|
|
IPPairInitConfig(true);
|
|
|
|
|
IPPair *h = IPPairAlloc();
|
|
|
|
|
if (h == NULL)
|
|
|
|
|
goto end;
|
|
|
|
|
FAIL_IF_NULL(h);
|
|
|
|
|
|
|
|
|
|
IPPairBitAdd(h, 0, SCTIME_FROM_SECS(30));
|
|
|
|
|
IPPairBitAdd(h, 1, SCTIME_FROM_SECS(30));
|
|
|
|
|
@ -293,28 +268,23 @@ static int IPPairBitTest04 (void)
|
|
|
|
|
IPPairBitAdd(h, 3, SCTIME_FROM_SECS(30));
|
|
|
|
|
|
|
|
|
|
XBit *fb = IPPairBitGet(h,0);
|
|
|
|
|
if (fb != NULL)
|
|
|
|
|
ret = 1;
|
|
|
|
|
FAIL_IF_NULL(fb);
|
|
|
|
|
|
|
|
|
|
IPPairFree(h);
|
|
|
|
|
end:
|
|
|
|
|
IPPairShutdown();
|
|
|
|
|
StorageCleanup();
|
|
|
|
|
return ret;
|
|
|
|
|
PASS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int IPPairBitTest05 (void)
|
|
|
|
|
{
|
|
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
|
|
StorageCleanup();
|
|
|
|
|
StorageInit();
|
|
|
|
|
IPPairBitInitCtx();
|
|
|
|
|
StorageFinalize();
|
|
|
|
|
IPPairInitConfig(true);
|
|
|
|
|
IPPair *h = IPPairAlloc();
|
|
|
|
|
if (h == NULL)
|
|
|
|
|
goto end;
|
|
|
|
|
FAIL_IF_NULL(h);
|
|
|
|
|
|
|
|
|
|
IPPairBitAdd(h, 0, SCTIME_FROM_SECS(90));
|
|
|
|
|
IPPairBitAdd(h, 1, SCTIME_FROM_SECS(90));
|
|
|
|
|
@ -322,28 +292,23 @@ static int IPPairBitTest05 (void)
|
|
|
|
|
IPPairBitAdd(h, 3, SCTIME_FROM_SECS(90));
|
|
|
|
|
|
|
|
|
|
XBit *fb = IPPairBitGet(h,1);
|
|
|
|
|
if (fb != NULL)
|
|
|
|
|
ret = 1;
|
|
|
|
|
FAIL_IF_NULL(fb);
|
|
|
|
|
|
|
|
|
|
IPPairFree(h);
|
|
|
|
|
end:
|
|
|
|
|
IPPairShutdown();
|
|
|
|
|
StorageCleanup();
|
|
|
|
|
return ret;
|
|
|
|
|
PASS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int IPPairBitTest06 (void)
|
|
|
|
|
{
|
|
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
|
|
StorageCleanup();
|
|
|
|
|
StorageInit();
|
|
|
|
|
IPPairBitInitCtx();
|
|
|
|
|
StorageFinalize();
|
|
|
|
|
IPPairInitConfig(true);
|
|
|
|
|
IPPair *h = IPPairAlloc();
|
|
|
|
|
if (h == NULL)
|
|
|
|
|
goto end;
|
|
|
|
|
FAIL_IF_NULL(h);
|
|
|
|
|
|
|
|
|
|
IPPairBitAdd(h, 0, SCTIME_FROM_SECS(90));
|
|
|
|
|
IPPairBitAdd(h, 1, SCTIME_FROM_SECS(90));
|
|
|
|
|
@ -351,28 +316,23 @@ static int IPPairBitTest06 (void)
|
|
|
|
|
IPPairBitAdd(h, 3, SCTIME_FROM_SECS(90));
|
|
|
|
|
|
|
|
|
|
XBit *fb = IPPairBitGet(h,2);
|
|
|
|
|
if (fb != NULL)
|
|
|
|
|
ret = 1;
|
|
|
|
|
FAIL_IF_NULL(fb);
|
|
|
|
|
|
|
|
|
|
IPPairFree(h);
|
|
|
|
|
end:
|
|
|
|
|
IPPairShutdown();
|
|
|
|
|
StorageCleanup();
|
|
|
|
|
return ret;
|
|
|
|
|
PASS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int IPPairBitTest07 (void)
|
|
|
|
|
{
|
|
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
|
|
StorageCleanup();
|
|
|
|
|
StorageInit();
|
|
|
|
|
IPPairBitInitCtx();
|
|
|
|
|
StorageFinalize();
|
|
|
|
|
IPPairInitConfig(true);
|
|
|
|
|
IPPair *h = IPPairAlloc();
|
|
|
|
|
if (h == NULL)
|
|
|
|
|
goto end;
|
|
|
|
|
FAIL_IF_NULL(h);
|
|
|
|
|
|
|
|
|
|
IPPairBitAdd(h, 0, SCTIME_FROM_SECS(90));
|
|
|
|
|
IPPairBitAdd(h, 1, SCTIME_FROM_SECS(90));
|
|
|
|
|
@ -380,28 +340,23 @@ static int IPPairBitTest07 (void)
|
|
|
|
|
IPPairBitAdd(h, 3, SCTIME_FROM_SECS(90));
|
|
|
|
|
|
|
|
|
|
XBit *fb = IPPairBitGet(h,3);
|
|
|
|
|
if (fb != NULL)
|
|
|
|
|
ret = 1;
|
|
|
|
|
FAIL_IF_NULL(fb);
|
|
|
|
|
|
|
|
|
|
IPPairFree(h);
|
|
|
|
|
end:
|
|
|
|
|
IPPairShutdown();
|
|
|
|
|
StorageCleanup();
|
|
|
|
|
return ret;
|
|
|
|
|
PASS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int IPPairBitTest08 (void)
|
|
|
|
|
{
|
|
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
|
|
StorageCleanup();
|
|
|
|
|
StorageInit();
|
|
|
|
|
IPPairBitInitCtx();
|
|
|
|
|
StorageFinalize();
|
|
|
|
|
IPPairInitConfig(true);
|
|
|
|
|
IPPair *h = IPPairAlloc();
|
|
|
|
|
if (h == NULL)
|
|
|
|
|
goto end;
|
|
|
|
|
FAIL_IF_NULL(h);
|
|
|
|
|
|
|
|
|
|
IPPairBitAdd(h, 0, SCTIME_FROM_SECS(90));
|
|
|
|
|
IPPairBitAdd(h, 1, SCTIME_FROM_SECS(90));
|
|
|
|
|
@ -409,37 +364,28 @@ static int IPPairBitTest08 (void)
|
|
|
|
|
IPPairBitAdd(h, 3, SCTIME_FROM_SECS(90));
|
|
|
|
|
|
|
|
|
|
XBit *fb = IPPairBitGet(h,0);
|
|
|
|
|
if (fb == NULL)
|
|
|
|
|
goto end;
|
|
|
|
|
FAIL_IF_NULL(fb);
|
|
|
|
|
|
|
|
|
|
IPPairBitRemove(h,0);
|
|
|
|
|
|
|
|
|
|
fb = IPPairBitGet(h,0);
|
|
|
|
|
if (fb != NULL) {
|
|
|
|
|
printf("fb != NULL even though it was removed: ");
|
|
|
|
|
goto end;
|
|
|
|
|
}
|
|
|
|
|
FAIL_IF_NOT_NULL(fb);
|
|
|
|
|
|
|
|
|
|
ret = 1;
|
|
|
|
|
IPPairFree(h);
|
|
|
|
|
end:
|
|
|
|
|
IPPairShutdown();
|
|
|
|
|
StorageCleanup();
|
|
|
|
|
return ret;
|
|
|
|
|
PASS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int IPPairBitTest09 (void)
|
|
|
|
|
{
|
|
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
|
|
StorageCleanup();
|
|
|
|
|
StorageInit();
|
|
|
|
|
IPPairBitInitCtx();
|
|
|
|
|
StorageFinalize();
|
|
|
|
|
IPPairInitConfig(true);
|
|
|
|
|
IPPair *h = IPPairAlloc();
|
|
|
|
|
if (h == NULL)
|
|
|
|
|
goto end;
|
|
|
|
|
FAIL_IF_NULL(h);
|
|
|
|
|
|
|
|
|
|
IPPairBitAdd(h, 0, SCTIME_FROM_SECS(90));
|
|
|
|
|
IPPairBitAdd(h, 1, SCTIME_FROM_SECS(90));
|
|
|
|
|
@ -447,37 +393,28 @@ static int IPPairBitTest09 (void)
|
|
|
|
|
IPPairBitAdd(h, 3, SCTIME_FROM_SECS(90));
|
|
|
|
|
|
|
|
|
|
XBit *fb = IPPairBitGet(h,1);
|
|
|
|
|
if (fb == NULL)
|
|
|
|
|
goto end;
|
|
|
|
|
FAIL_IF_NULL(fb);
|
|
|
|
|
|
|
|
|
|
IPPairBitRemove(h,1);
|
|
|
|
|
|
|
|
|
|
fb = IPPairBitGet(h,1);
|
|
|
|
|
if (fb != NULL) {
|
|
|
|
|
printf("fb != NULL even though it was removed: ");
|
|
|
|
|
goto end;
|
|
|
|
|
}
|
|
|
|
|
FAIL_IF_NOT_NULL(fb);
|
|
|
|
|
|
|
|
|
|
ret = 1;
|
|
|
|
|
IPPairFree(h);
|
|
|
|
|
end:
|
|
|
|
|
IPPairShutdown();
|
|
|
|
|
StorageCleanup();
|
|
|
|
|
return ret;
|
|
|
|
|
PASS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int IPPairBitTest10 (void)
|
|
|
|
|
{
|
|
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
|
|
StorageCleanup();
|
|
|
|
|
StorageInit();
|
|
|
|
|
IPPairBitInitCtx();
|
|
|
|
|
StorageFinalize();
|
|
|
|
|
IPPairInitConfig(true);
|
|
|
|
|
IPPair *h = IPPairAlloc();
|
|
|
|
|
if (h == NULL)
|
|
|
|
|
goto end;
|
|
|
|
|
FAIL_IF_NULL(h);
|
|
|
|
|
|
|
|
|
|
IPPairBitAdd(h, 0, SCTIME_FROM_SECS(90));
|
|
|
|
|
IPPairBitAdd(h, 1, SCTIME_FROM_SECS(90));
|
|
|
|
|
@ -485,37 +422,28 @@ static int IPPairBitTest10 (void)
|
|
|
|
|
IPPairBitAdd(h, 3, SCTIME_FROM_SECS(90));
|
|
|
|
|
|
|
|
|
|
XBit *fb = IPPairBitGet(h,2);
|
|
|
|
|
if (fb == NULL)
|
|
|
|
|
goto end;
|
|
|
|
|
FAIL_IF_NULL(fb);
|
|
|
|
|
|
|
|
|
|
IPPairBitRemove(h,2);
|
|
|
|
|
|
|
|
|
|
fb = IPPairBitGet(h,2);
|
|
|
|
|
if (fb != NULL) {
|
|
|
|
|
printf("fb != NULL even though it was removed: ");
|
|
|
|
|
goto end;
|
|
|
|
|
}
|
|
|
|
|
FAIL_IF_NOT_NULL(fb);
|
|
|
|
|
|
|
|
|
|
ret = 1;
|
|
|
|
|
IPPairFree(h);
|
|
|
|
|
end:
|
|
|
|
|
IPPairShutdown();
|
|
|
|
|
StorageCleanup();
|
|
|
|
|
return ret;
|
|
|
|
|
PASS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int IPPairBitTest11 (void)
|
|
|
|
|
{
|
|
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
|
|
StorageCleanup();
|
|
|
|
|
StorageInit();
|
|
|
|
|
IPPairBitInitCtx();
|
|
|
|
|
StorageFinalize();
|
|
|
|
|
IPPairInitConfig(true);
|
|
|
|
|
IPPair *h = IPPairAlloc();
|
|
|
|
|
if (h == NULL)
|
|
|
|
|
goto end;
|
|
|
|
|
FAIL_IF_NULL(h);
|
|
|
|
|
|
|
|
|
|
IPPairBitAdd(h, 0, SCTIME_FROM_SECS(90));
|
|
|
|
|
IPPairBitAdd(h, 1, SCTIME_FROM_SECS(90));
|
|
|
|
|
@ -523,23 +451,17 @@ static int IPPairBitTest11 (void)
|
|
|
|
|
IPPairBitAdd(h, 3, SCTIME_FROM_SECS(90));
|
|
|
|
|
|
|
|
|
|
XBit *fb = IPPairBitGet(h,3);
|
|
|
|
|
if (fb == NULL)
|
|
|
|
|
goto end;
|
|
|
|
|
FAIL_IF_NULL(fb);
|
|
|
|
|
|
|
|
|
|
IPPairBitRemove(h,3);
|
|
|
|
|
|
|
|
|
|
fb = IPPairBitGet(h,3);
|
|
|
|
|
if (fb != NULL) {
|
|
|
|
|
printf("fb != NULL even though it was removed: ");
|
|
|
|
|
goto end;
|
|
|
|
|
}
|
|
|
|
|
FAIL_IF_NOT_NULL(fb);
|
|
|
|
|
|
|
|
|
|
ret = 1;
|
|
|
|
|
IPPairFree(h);
|
|
|
|
|
end:
|
|
|
|
|
IPPairShutdown();
|
|
|
|
|
StorageCleanup();
|
|
|
|
|
return ret;
|
|
|
|
|
PASS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif /* UNITTESTS */
|
|
|
|
|
|