This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch] Add two tests of hash function quality


This patch adds two very different tests to verify that we have a good
hash function. This is a very large and well studied area, and in principle
we could have many more tests of this sort, but?a least these ones are
a start.

One test is very simple to describe: it hashes a set of strings to a set
of buckets, and uses chi^2 to verify that the distribution is uniform.
The other is slightly more complicated, but essentially it verifies that
every bit of the input string affects every bit of the output hash code.

                                     --Matt


2010-09-24  Matt Austern  <austern@google.com>

	* testsuite/20_util/hash/chi2_quality.cc: New, verifies that
	hash function gives a good distribution over buckets.
	* testsuite/20_util/hash/quality.cc: New, verifies that all bits
	are used in hash function input and output.

Attachment: hash-quality-patch.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]