ht_test.c revision 0c27b3fe77ac1d5094ba3521e8142d9e7973133f
/*
* Copyright (C) 2016 Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/* ! \file */
#include <config.h>
#include <atf-c.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
static void *
if (size == 0U)
size = 1;
}
static void
}
isc_int64_t i;
for (i = 1; i < count; i++) {
/*
* Note that the string we're snprintfing is always > 16 bytes
* so we are always filling the key.
*/
unsigned char key[16];
}
for (i = 1; i < count; i++) {
unsigned char key[16];
void *f = NULL;
ATF_REQUIRE_EQ(i, (isc_int64_t) f);
}
for (i = 1; i < count; i++) {
unsigned char key[16];
}
for (i = 1; i < count; i++) {
char key[64];
}
for (i = 1; i < count; i++) {
unsigned char key[16];
void *f = NULL;
ATF_REQUIRE_EQ(f, NULL);
}
for (i = 1; i < count; i++) {
char key[64];
void *f = NULL;
ATF_REQUIRE_EQ(f, (void *) i);
}
for (i = 1; i < count; i++) {
unsigned char key[16];
void *f = NULL;
ATF_REQUIRE_EQ(f, NULL);
}
for (i = 1; i < count; i++) {
unsigned char key[16];
}
for (i = 1; i < count; i++) {
char key[64];
void *f = NULL;
ATF_REQUIRE_EQ(f, NULL);
}
for (i = 1; i < count; i++) {
unsigned char key[16];
void *f = NULL;
ATF_REQUIRE_EQ(i, (isc_int64_t) f);
}
for (i = 1; i < count; i++) {
unsigned char key[16];
void *f = NULL;
ATF_REQUIRE_EQ(f, NULL);
}
isc_ht_destroy(&ht);
}
static void test_ht_iterator() {
isc_int64_t i;
isc_int64_t v;
unsigned char key[16];
unsigned char *tkey;
for (i = 1; i <= count; i++) {
/*
* Note that the string we're snprintfing is always > 16 bytes
* so we are always filling the key.
*/
}
walked = 0;
result == ISC_R_SUCCESS;
{
isc_ht_iter_current(iter, (void**) &v);
walked++;
}
/* erase odd */
walked = 0;
while (result == ISC_R_SUCCESS) {
isc_ht_iter_current(iter, (void**) &v);
if (v % 2 == 0) {
} else {
}
walked++;
}
/* erase even */
walked = 0;
while (result == ISC_R_SUCCESS) {
isc_ht_iter_current(iter, (void**) &v);
if (v % 2 == 1) {
} else {
}
walked++;
}
walked = 0;
result == ISC_R_SUCCESS;
{
walked++;
}
ATF_REQUIRE_EQ(walked, 0);
isc_ht_destroy(&ht);
}
}
}
}
}
}
}
/* xxxwpk we should limit the size of hashtable, 32bit doesn't make sense */
#if 0
}
}
#endif
}
}
/*
* Main
*/
ATF_TP_ADD_TCS(tp) {
/* ATF_TP_ADD_TC(tp, isc_ht_32); */
return (atf_no_error());
}