From 1c26bb24f73e277073ca3dc266c78a19fc954e21 Mon Sep 17 00:00:00 2001 From: Brian Aker Date: Fri, 1 Apr 2011 12:38:02 -0700 Subject: [PATCH] Fixes all current issues with hashkit tests. --- libhashkit/algorithm.c | 2 +- libhashkit/behavior.c | 2 +- libhashkit/common.h | 4 +- libhashkit/crc32.c | 2 +- libhashkit/digest.c | 2 +- libhashkit/fnv.c | 2 +- libhashkit/function.c | 2 +- libhashkit/hashkit.c | 2 +- libhashkit/hashkit.h | 32 +++++++++------- libhashkit/hsieh.c | 2 +- libhashkit/include.am | 4 +- libhashkit/jenkins.c | 2 +- libhashkit/ketama.c | 2 +- libhashkit/md5.c | 2 +- libhashkit/murmur.c | 2 +- libhashkit/one_at_a_time.c | 2 +- libhashkit/str_algorithm.c | 57 +++++++++++++++++++++++++++++ libhashkit/str_algorithm.h | 48 ++++++++++++++++++++++++ libhashkit/strerror.c | 2 +- libhashkit/types.h | 41 ++++++++++++++++++--- libmemcached/hash.c | 17 +-------- libmemcached/memcached.h | 30 --------------- tests/hash_plus.cc | 37 +++++++++++-------- tests/include.am | 28 +++----------- tests/mem_plus.cc | 75 -------------------------------------- 25 files changed, 206 insertions(+), 195 deletions(-) create mode 100644 libhashkit/str_algorithm.c create mode 100644 libhashkit/str_algorithm.h delete mode 100644 tests/mem_plus.cc diff --git a/libhashkit/algorithm.c b/libhashkit/algorithm.c index 0f0f9f01..de00081d 100644 --- a/libhashkit/algorithm.c +++ b/libhashkit/algorithm.c @@ -6,7 +6,7 @@ * the COPYING file in the parent directory for full text. */ -#include "common.h" +#include uint32_t libhashkit_one_at_a_time(const char *key, size_t key_length) { diff --git a/libhashkit/behavior.c b/libhashkit/behavior.c index 683798ea..ee0efcf3 100644 --- a/libhashkit/behavior.c +++ b/libhashkit/behavior.c @@ -6,4 +6,4 @@ * the COPYING file in the parent directory for full text. */ -#include "common.h" +#include diff --git a/libhashkit/common.h b/libhashkit/common.h index dff3ab0b..73b198f5 100644 --- a/libhashkit/common.h +++ b/libhashkit/common.h @@ -9,7 +9,7 @@ #ifndef HASHKIT_COMMON_H #define HASHKIT_COMMON_H -#include "config.h" +#include #include #include @@ -17,7 +17,7 @@ #include #include -#include "hashkit.h" +#include #ifdef __cplusplus extern "C" { diff --git a/libhashkit/crc32.c b/libhashkit/crc32.c index b4ad8ec3..f07958ca 100644 --- a/libhashkit/crc32.c +++ b/libhashkit/crc32.c @@ -4,7 +4,7 @@ * src/usr.bin/cksum/crc32.c. */ -#include "common.h" +#include static const uint32_t crc32tab[256] = { 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, diff --git a/libhashkit/digest.c b/libhashkit/digest.c index 4ff6de29..e1559819 100644 --- a/libhashkit/digest.c +++ b/libhashkit/digest.c @@ -6,7 +6,7 @@ * the COPYING file in the parent directory for full text. */ -#include "common.h" +#include uint32_t hashkit_digest(const hashkit_st *self, const char *key, size_t key_length) { diff --git a/libhashkit/fnv.c b/libhashkit/fnv.c index 41243813..fffb94a4 100644 --- a/libhashkit/fnv.c +++ b/libhashkit/fnv.c @@ -6,7 +6,7 @@ * the COPYING file in the parent directory for full text. */ -#include "common.h" +#include /* FNV hash'es lifted from Dustin Sallings work */ static uint64_t FNV_64_INIT= UINT64_C(0xcbf29ce484222325); diff --git a/libhashkit/function.c b/libhashkit/function.c index a779bb63..3560abd7 100644 --- a/libhashkit/function.c +++ b/libhashkit/function.c @@ -6,7 +6,7 @@ * the COPYING file in the parent directory for full text. */ -#include "common.h" +#include static hashkit_return_t _set_function(struct hashkit_function_st *self, hashkit_hash_algorithm_t hash_algorithm) { diff --git a/libhashkit/hashkit.c b/libhashkit/hashkit.c index 47c9e580..7214c144 100644 --- a/libhashkit/hashkit.c +++ b/libhashkit/hashkit.c @@ -6,7 +6,7 @@ * the COPYING file in the parent directory for full text. */ -#include "common.h" +#include static const hashkit_st global_default_hash= { .base_hash= { diff --git a/libhashkit/hashkit.h b/libhashkit/hashkit.h index 45133307..2d8ad3a2 100644 --- a/libhashkit/hashkit.h +++ b/libhashkit/hashkit.h @@ -22,12 +22,10 @@ #include #include #include +#include #include #ifdef __cplusplus - -#include - extern "C" { #endif @@ -67,57 +65,63 @@ struct hashkit_st }; #ifdef __cplusplus -class Hashkit : private hashkit_st { + +#include + +class Hashkit { public: Hashkit() { - hashkit_create(this); + hashkit_create(&self); } Hashkit(const Hashkit& source) { - hashkit_clone(this, &source); + hashkit_clone(&self, &source.self); } Hashkit& operator=(const Hashkit& source) { - hashkit_free(this); - hashkit_clone(this, &source); + hashkit_free(&self); + hashkit_clone(&self, &source.self); return *this; } friend bool operator==(const Hashkit &left, const Hashkit &right) { - return hashkit_compare(&left, &right); + return hashkit_compare(&left.self, &right.self); } uint32_t digest(std::string& str) { - return hashkit_digest(this, str.c_str(), str.length()); + return hashkit_digest(&self, str.c_str(), str.length()); } uint32_t digest(const char *key, size_t key_length) { - return hashkit_digest(this, key, key_length); + return hashkit_digest(&self, key, key_length); } hashkit_return_t set_function(hashkit_hash_algorithm_t hash_algorithm) { - return hashkit_set_function(this, hash_algorithm); + return hashkit_set_function(&self, hash_algorithm); } hashkit_return_t set_distribution_function(hashkit_hash_algorithm_t hash_algorithm) { - return hashkit_set_function(this, hash_algorithm); + return hashkit_set_function(&self, hash_algorithm); } ~Hashkit() { - hashkit_free(this); + hashkit_free(&self); } +private: + + hashkit_st self; }; #endif diff --git a/libhashkit/hsieh.c b/libhashkit/hsieh.c index ba46ed2c..35a2e209 100644 --- a/libhashkit/hsieh.c +++ b/libhashkit/hsieh.c @@ -5,7 +5,7 @@ * http://www.azillionmonkeys.com/qed/hash.html */ -#include "common.h" +#include #undef get16bits #if (defined(__GNUC__) && defined(__i386__)) diff --git a/libhashkit/include.am b/libhashkit/include.am index f0adcdc9..12575dfb 100644 --- a/libhashkit/include.am +++ b/libhashkit/include.am @@ -23,6 +23,7 @@ nobase_include_HEADERS+= \ libhashkit/function.h \ libhashkit/hashkit.h \ libhashkit/strerror.h \ + libhashkit/str_algorithm.h \ libhashkit/types.h \ libhashkit/visibility.h @@ -33,14 +34,15 @@ libhashkit_libhashkit_la_SOURCES= \ libhashkit/algorithm.c \ libhashkit/behavior.c \ libhashkit/crc32.c \ - libhashkit/fnv.c \ libhashkit/digest.c \ + libhashkit/fnv.c \ libhashkit/function.c \ libhashkit/hashkit.c \ libhashkit/jenkins.c \ libhashkit/ketama.c \ libhashkit/md5.c \ libhashkit/one_at_a_time.c \ + libhashkit/str_algorithm.c \ libhashkit/strerror.c if INCLUDE_HSIEH_SRC diff --git a/libhashkit/jenkins.c b/libhashkit/jenkins.c index 53e35a82..c2001cb5 100644 --- a/libhashkit/jenkins.c +++ b/libhashkit/jenkins.c @@ -11,7 +11,7 @@ * Add big endian support */ -#include "common.h" +#include #define hashsize(n) ((uint32_t)1<<(n)) #define hashmask(n) (hashsize(n)-1) diff --git a/libhashkit/ketama.c b/libhashkit/ketama.c index a510e57a..45052c22 100644 --- a/libhashkit/ketama.c +++ b/libhashkit/ketama.c @@ -6,7 +6,7 @@ * the COPYING file in the parent directory for full text. */ -#include "common.h" +#include #include #if 0 diff --git a/libhashkit/md5.c b/libhashkit/md5.c index 025c6662..1af5e6c0 100644 --- a/libhashkit/md5.c +++ b/libhashkit/md5.c @@ -29,7 +29,7 @@ These notices must be retained in any copies of any part of this documentation and/or software. */ -#include "common.h" +#include #include #include diff --git a/libhashkit/murmur.c b/libhashkit/murmur.c index 78d7f193..a40b11b7 100644 --- a/libhashkit/murmur.c +++ b/libhashkit/murmur.c @@ -15,7 +15,7 @@ Updated to murmur2 hash - BP */ -#include "common.h" +#include uint32_t hashkit_murmur(const char *key, size_t length, void *context) { diff --git a/libhashkit/one_at_a_time.c b/libhashkit/one_at_a_time.c index 0c9ec31a..aeb11b12 100644 --- a/libhashkit/one_at_a_time.c +++ b/libhashkit/one_at_a_time.c @@ -11,7 +11,7 @@ http://en.wikipedia.org/wiki/Jenkins_hash_function */ -#include "common.h" +#include uint32_t hashkit_one_at_a_time(const char *key, size_t key_length, void *context) { diff --git a/libhashkit/str_algorithm.c b/libhashkit/str_algorithm.c new file mode 100644 index 00000000..0a0613bc --- /dev/null +++ b/libhashkit/str_algorithm.c @@ -0,0 +1,57 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * HashKit + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +const char * libhashkit_string_hash(hashkit_hash_algorithm_t type) +{ + switch(type) + { + case HASHKIT_HASH_DEFAULT: return "DEFAULT"; + case HASHKIT_HASH_MD5: return "MD5"; + case HASHKIT_HASH_CRC: return "CRC"; + case HASHKIT_HASH_FNV1_64: return "FNV1_64"; + case HASHKIT_HASH_FNV1A_64: return "FNV1A_64"; + case HASHKIT_HASH_FNV1_32: return "FNV1_32"; + case HASHKIT_HASH_FNV1A_32: return "FNV1A_32"; + case HASHKIT_HASH_HSIEH: return "HSIEH"; + case HASHKIT_HASH_MURMUR: return "MURMUR"; + case HASHKIT_HASH_JENKINS: return "JENKINS"; + case HASHKIT_HASH_CUSTOM: return "CUSTOM"; + default: + case HASHKIT_HASH_MAX: return "INVALID"; + } +} diff --git a/libhashkit/str_algorithm.h b/libhashkit/str_algorithm.h new file mode 100644 index 00000000..bb05eb51 --- /dev/null +++ b/libhashkit/str_algorithm.h @@ -0,0 +1,48 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * HashKit + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +HASHKIT_API +const char *libhashkit_string_hash(hashkit_hash_algorithm_t type); + +#ifdef __cplusplus +} +#endif diff --git a/libhashkit/strerror.c b/libhashkit/strerror.c index 50532e1d..8d7246c6 100644 --- a/libhashkit/strerror.c +++ b/libhashkit/strerror.c @@ -6,7 +6,7 @@ * the COPYING file in the parent directory for full text. */ -#include "common.h" +#include const char *hashkit_strerror(hashkit_st *ptr, hashkit_return_t rc) { diff --git a/libhashkit/types.h b/libhashkit/types.h index 255620b8..23bd9d5c 100644 --- a/libhashkit/types.h +++ b/libhashkit/types.h @@ -1,12 +1,41 @@ - -/* HashKit - * Copyright (C) 2009 Brian Aker - * All rights reserved. +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * HashKit + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2009 Brian Aker All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. */ + #ifndef HASHKIT_TYPES_H #define HASHKIT_TYPES_H diff --git a/libmemcached/hash.c b/libmemcached/hash.c index bf946423..e5f87a75 100644 --- a/libmemcached/hash.c +++ b/libmemcached/hash.c @@ -172,20 +172,5 @@ memcached_return_t memcached_set_hashkit(memcached_st *self, hashkit_st *hashk) const char * libmemcached_string_hash(memcached_hash_t type) { - switch (type) - { - case MEMCACHED_HASH_DEFAULT: return "MEMCACHED_HASH_DEFAULT"; - case MEMCACHED_HASH_MD5: return "MEMCACHED_HASH_MD5"; - case MEMCACHED_HASH_CRC: return "MEMCACHED_HASH_CRC"; - case MEMCACHED_HASH_FNV1_64: return "MEMCACHED_HASH_FNV1_64"; - case MEMCACHED_HASH_FNV1A_64: return "MEMCACHED_HASH_FNV1A_64"; - case MEMCACHED_HASH_FNV1_32: return "MEMCACHED_HASH_FNV1_32"; - case MEMCACHED_HASH_FNV1A_32: return "MEMCACHED_HASH_FNV1A_32"; - case MEMCACHED_HASH_HSIEH: return "MEMCACHED_HASH_HSIEH"; - case MEMCACHED_HASH_MURMUR: return "MEMCACHED_HASH_MURMUR"; - case MEMCACHED_HASH_JENKINS: return "MEMCACHED_HASH_JENKINS"; - case MEMCACHED_HASH_CUSTOM: return "MEMCACHED_HASH_CUSTOM"; - default: - case MEMCACHED_HASH_MAX: return "INVALID memcached_hash_t"; - } + return libhashkit_string_hash((hashkit_hash_algorithm_t)type); } diff --git a/libmemcached/memcached.h b/libmemcached/memcached.h index 311d5f26..10ff26df 100644 --- a/libmemcached/memcached.h +++ b/libmemcached/memcached.h @@ -212,35 +212,5 @@ uint32_t memcached_server_count(const memcached_st *); } // extern "C" #endif - -#ifdef __cplusplus -class Memcached : private memcached_st { -public: - - Memcached() - { - memcached_create(this); - } - - ~Memcached() - { - memcached_free(this); - } - - Memcached(const Memcached& source) - { - memcached_clone(this, &source); - } - - Memcached& operator=(const Memcached& source) - { - memcached_free(this); - memcached_clone(this, &source); - - return *this; - } -}; -#endif - #endif /* __LIBMEMCACHED_MEMCACHED_H__ */ diff --git a/tests/hash_plus.cc b/tests/hash_plus.cc index c148d3ef..140d28fc 100644 --- a/tests/hash_plus.cc +++ b/tests/hash_plus.cc @@ -3,9 +3,9 @@ */ #include -#include -#include -#include +#include +#include +#include #include @@ -69,7 +69,7 @@ static test_return_t digest_test(void *obj) return TEST_SUCCESS; } -static test_return_t set_function_test(void *obj) +static test_return_t set_function_test(void *) { Hashkit hashk; hashkit_hash_algorithm_t algo_list[]= { @@ -84,21 +84,15 @@ static test_return_t set_function_test(void *obj) HASHKIT_HASH_JENKINS, HASHKIT_HASH_MAX }; - hashkit_hash_algorithm_t *algo; - (void)obj; - for (algo= algo_list; *algo != HASHKIT_HASH_MAX; algo++) + for (hashkit_hash_algorithm_t *algo= algo_list; *algo != HASHKIT_HASH_MAX; algo++) { - hashkit_return_t rc; - uint32_t x; - const char **ptr; - uint32_t *list; - - rc= hashk.set_function(*algo); + hashkit_return_t rc= hashk.set_function(*algo); test_true(rc == HASHKIT_SUCCESS); + uint32_t *list; switch (*algo) { case HASHKIT_HASH_DEFAULT: @@ -123,9 +117,18 @@ static test_return_t set_function_test(void *obj) list= fnv1a_32_values; break; case HASHKIT_HASH_HSIEH: +#ifndef HAVE_HSIEH_HASH + continue; +#endif list= hsieh_values; break; case HASHKIT_HASH_MURMUR: +#ifdef WORDS_BIGENDIAN + continue; +#endif +#ifndef HAVE_MURMUR_HASH + continue; +#endif list= murmur_values; break; case HASHKIT_HASH_JENKINS: @@ -139,12 +142,16 @@ static test_return_t set_function_test(void *obj) } // Now we make sure we did set the hash correctly. + uint32_t x; + const char **ptr; for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++) { uint32_t hash_val; hash_val= hashk.digest(*ptr, strlen(*ptr)); - test_true(list[x] == hash_val); + char buffer[1024]; + snprintf(buffer, sizeof(buffer), "%lu %lus %s", (unsigned long)list[x], (unsigned long)hash_val, libhashkit_string_hash(*algo)); + test_true_got(list[x] == hash_val, buffer); } } @@ -158,7 +165,7 @@ static test_return_t set_distribution_function_test(void *obj) (void)obj; rc= hashk.set_distribution_function(HASHKIT_HASH_CUSTOM); - test_true(rc == HASHKIT_FAILURE); + test_true_got(rc == HASHKIT_FAILURE or rc == HASHKIT_INVALID_ARGUMENT, hashkit_strerror(NULL, rc)); rc= hashk.set_distribution_function(HASHKIT_HASH_JENKINS); test_true(rc == HASHKIT_SUCCESS); diff --git a/tests/include.am b/tests/include.am index 490ed023..7451efd3 100644 --- a/tests/include.am +++ b/tests/include.am @@ -43,8 +43,7 @@ noinst_HEADERS+= \ noinst_PROGRAMS+= \ tests/atomsmasher \ - tests/hashplus \ - tests/memplus \ + tests/hash_plus \ tests/startservers \ tests/testapp \ tests/testhashkit \ @@ -100,15 +99,11 @@ tests_testhashkit_SOURCES = tests/hashkit_functions.c tests_testhashkit_DEPENDENCIES = libtest/libtest.la libhashkit/libhashkit.la tests_testhashkit_LDADD = $(tests_testhashkit_DEPENDENCIES) $(LIBSASL) -tests_hashplus_SOURCES = tests/hash_plus.cc -tests_hashplus_CXXFLAGS = $(AM_CXXFLAGS) $(NO_EFF_CXX) -tests_hashplus_DEPENDENCIES = $(tests_testhashkit_DEPENDENCIES) -tests_hashplus_LDADD = $(tests_testhashkit_DEPENDENCIES) $(LIBSASL) - -tests_memplus_SOURCES = tests/mem_plus.cc -tests_memplus_CXXFLAGS = $(AM_CXXFLAGS) $(NO_EFF_CXX) -tests_memplus_DEPENDENCIES = $(TESTS_LDADDS) -tests_memplus_LDADD = $(tests_memplus_DEPENDENCIES) $(LIBSASL) +tests_hash_plus_SOURCES = tests/hash_plus.cc +tests_hash_plus_CXXFLAGS = $(AM_CXXFLAGS) $(NO_EFF_CXX) +tests_hash_plus_DEPENDENCIES = $(tests_testhashkit_DEPENDENCIES) +tests_hash_plus_LDADD = $(tests_testhashkit_DEPENDENCIES) $(LIBSASL) +check_PROGRAMS+= tests/hash_plus test: check @@ -238,8 +233,6 @@ MEM_COMMAND= tests/testapp $(COLLECTION) $(SUITE) TESTPLUS_COMMAND= tests/testplus $(COLLECTION) $(SUITE) -MEMPLUS_COMMAND= tests/memplus $(COLLECTION) $(SUITE) - HASHPLUS_COMMAND= tests/hashplus $(COLLECTION) $(SUITE) ATOM_COMMAND= tests/atomsmasher $(COLLECTION) $(SUITE) @@ -266,9 +259,6 @@ test-hash: tests/testhashkit test-hashplus: tests/hashplus $(HASHPLUS_COMMAND) -test-memplus: tests/memplus - $(MEMPLUS_COMMAND) - pahole-mem: tests/testapp $(PAHOLE_COMMAND) $(MEM_COMMAND) @@ -290,9 +280,6 @@ gdb-hash: tests/testhashkit gdb-hashplus: tests/hashplus $(DEBUG_COMMAND) $(HASHPLUS_COMMAND) -gdb-memplus: tests/memplus - $(DEBUG_COMMAND) $(MEMPLUS_COMMAND) - gdb-memslap: clients/memslap $(DEBUG_COMMAND) $(MEMSLAP_COMMAND) @@ -314,9 +301,6 @@ valgrind-hash: tests/testhashkit valgrind-hashplus: tests/hashplus $(VALGRIND_COMMAND) $(HASHPLUS_COMMAND) -valgrind-memplus: tests/memplus - $(VALGRIND_COMMAND) $(MEMPLUS_COMMAND) - valgrind-memslap: clients/memslap $(VALGRIND_COMMAND) $(MEMSLAP_COMMAND) diff --git a/tests/mem_plus.cc b/tests/mem_plus.cc deleted file mode 100644 index d9a76afb..00000000 --- a/tests/mem_plus.cc +++ /dev/null @@ -1,75 +0,0 @@ -/* - C++ to libmemcit -*/ -#include - -#include -#include -#include - -#include - -static test_return_t exists_test(void *obj) -{ - Memcached memc; - (void)obj; - (void)memc; - - return TEST_SUCCESS; -} - -static test_return_t new_test(void *obj) -{ - Memcached *memc= new Memcached; - (void)obj; - - (void)memc; - - delete memc; - - return TEST_SUCCESS; -} - -static test_return_t copy_test(void *obj) -{ - Memcached *memc= new Memcached; - Memcached *copy(memc); - (void)obj; - - (void)copy; - - delete memc; - - return TEST_SUCCESS; -} - -static test_return_t assign_test(void *obj) -{ - Memcached memc; - Memcached copy; - (void)obj; - - copy= memc; - - (void)copy; - - return TEST_SUCCESS; -} - -test_st basic[] ={ - { "exists", 0, reinterpret_cast(exists_test) }, - { "new", 0, reinterpret_cast(new_test) }, - { "copy", 0, reinterpret_cast(copy_test) }, - { "assign", 0, reinterpret_cast(assign_test) }, - { 0, 0, 0} -}; - -collection_st collection[] ={ - {"basic", 0, 0, basic}, - {0, 0, 0, 0} -}; - -void get_world(world_st *world) -{ - world->collections= collection; -} -- 2.30.2