Example #1
0
CTEST2(bloom, hash_collisions)
{
	bloom_add_str(data->x1, "abc", 3);
	ASSERT_EQUAL_U(3, bloom_count(data->x1));

	bloom_add_str(data->x2, "abc", 3);
	ASSERT_EQUAL_U(3, bloom_count(data->x2));
}
Example #2
0
CTEST2(bloom, clear)
{
	data->b1->a[0] = 0xCA;
	data->b1->a[data->b1->size -1] = 0xFE;
	bloom_clear(data->b1);
	ASSERT_EQUAL_U(0, bloom_count(data->b1));
}
Example #3
0
const int _salad_stats_(const config_t* const c)
{
	FILE* const fFilter = fopen(c->bloom, "rb");
	if (fFilter == NULL)
	{
		error("Unable to open bloom filter.");
		return EXIT_FAILURE;
	}

	DELIM(delim) = {0};
	int useWGrams = 0;

	size_t ngramLength = 0;
	BLOOM* bloom = NULL;

	int ret = fread_model(fFilter, &bloom, &ngramLength, delim, &useWGrams);
	fclose(fFilter);
	if (ret != 0)
	{
		error("Corrupt bloom filter file.");
		return EXIT_FAILURE;
	}

	const size_t set = bloom_count(bloom);
	status("Saturation: %.3f%%", (((double)set)/ ((double)bloom->bitsize))*100);
	return EXIT_SUCCESS;
}
Example #4
0
CTEST2(bloom, count)
{
	data->b1->a[0] = 0x03;
	data->b1->a[data->b1->size -1] = 0x80;
	ASSERT_EQUAL_U(3, bloom_count(data->b1));
}