From e0ef743090038ee02d656cee11debd2246624ba0 Mon Sep 17 00:00:00 2001 From: redpony Date: Mon, 18 Oct 2010 23:24:01 +0000 Subject: kenneth's LM preliminary integration git-svn-id: https://ws10smt.googlecode.com/svn/trunk@681 ec762483-ff6d-05da-a07a-a48fb63a330f --- klm/util/probing_hash_table_test.cc | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 klm/util/probing_hash_table_test.cc (limited to 'klm/util/probing_hash_table_test.cc') diff --git a/klm/util/probing_hash_table_test.cc b/klm/util/probing_hash_table_test.cc new file mode 100644 index 00000000..ff2f5af3 --- /dev/null +++ b/klm/util/probing_hash_table_test.cc @@ -0,0 +1,30 @@ +#include "util/probing_hash_table.hh" + +#include "util/key_value_packing.hh" + +#define BOOST_TEST_MODULE ProbingHashTableTest +#include +#include + +namespace util { +namespace { + +typedef AlignedPacking Packing; +typedef ProbingHashTable > Table; + +BOOST_AUTO_TEST_CASE(simple) { + char mem[Table::Size(10, 1.2)]; + memset(mem, 0, sizeof(mem)); + + Table table(mem, sizeof(mem)); + Packing::ConstIterator i = Packing::ConstIterator(); + BOOST_CHECK(!table.Find(2, i)); + table.Insert(Packing::Make(3, 328920)); + BOOST_REQUIRE(table.Find(3, i)); + BOOST_CHECK_EQUAL(3, i->GetKey()); + BOOST_CHECK_EQUAL(static_cast(328920), i->GetValue()); + BOOST_CHECK(!table.Find(2, i)); +} + +} // namespace +} // namespace util -- cgit v1.2.3