summaryrefslogtreecommitdiff
path: root/klm/util/probing_hash_table_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'klm/util/probing_hash_table_test.cc')
-rw-r--r--klm/util/probing_hash_table_test.cc12
1 files changed, 7 insertions, 5 deletions
diff --git a/klm/util/probing_hash_table_test.cc b/klm/util/probing_hash_table_test.cc
index ef68e5f2..37ffeb53 100644
--- a/klm/util/probing_hash_table_test.cc
+++ b/klm/util/probing_hash_table_test.cc
@@ -1,11 +1,12 @@
#include "util/probing_hash_table.hh"
-#include <stdint.h>
-
#define BOOST_TEST_MODULE ProbingHashTableTest
#include <boost/test/unit_test.hpp>
+#include <boost/scoped_array.hpp>
#include <boost/functional/hash.hpp>
+#include <stdint.h>
+
namespace util {
namespace {
@@ -27,10 +28,11 @@ struct Entry {
typedef ProbingHashTable<Entry, boost::hash<unsigned char> > Table;
BOOST_AUTO_TEST_CASE(simple) {
- char mem[Table::Size(10, 1.2)];
- memset(mem, 0, sizeof(mem));
+ size_t size = Table::Size(10, 1.2);
+ boost::scoped_array<char> mem(new char[size]);
+ memset(mem.get(), 0, size);
- Table table(mem, sizeof(mem));
+ Table table(mem.get(), size);
const Entry *i = NULL;
BOOST_CHECK(!table.Find(2, i));
Entry to_ins;