Skip to content

Commit

Permalink
Refactor: move function_chain_test.cc next to function_chain
Browse files Browse the repository at this point in the history
And link it into memcached_unit_tests to avoid having to link
and start a new program just for 4 small tests

Change-Id: I3371f7b83a57c6eb8c28db1ec80b74db01558ac3
Reviewed-on: http://review.couchbase.org/c/kv_engine/+/135604
Tested-by: Trond Norbye <[email protected]>
Reviewed-by: Dave Rigby <[email protected]>
  • Loading branch information
trondn authored and daverigby committed Sep 4, 2020
1 parent 47a5eaf commit 56c501a
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 11 deletions.
1 change: 1 addition & 0 deletions daemon/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ if (COUCHBASE_KV_BUILD_UNIT_TESTS)

add_executable(memcached_unit_tests
connection_unit_tests.cc
function_chain_test.cc
mc_time_test.cc)
add_sanitizers(memcached_unit_tests)
target_link_libraries(memcached_unit_tests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

#include <daemon/function_chain.h>
#include "function_chain.h"
#include <folly/portability/GTest.h>

static int doubleInput(int input) {
Expand Down Expand Up @@ -67,7 +67,7 @@ TEST(FunctionChainTest, SingleChain) {
chain.push_unique(makeFunction<int, getSuccessValue, int>(doubleInput));
// check return val is double input
int input = 102;
ASSERT_EQ(input*2, chain.invoke(input));
ASSERT_EQ(input * 2, chain.invoke(input));
}

/*
Expand All @@ -76,12 +76,12 @@ TEST(FunctionChainTest, SingleChain) {
TEST(FunctionChainTest, Uniqueness) {
FunctionChain<int, getSuccessValue> chain;

for(int ii = 0; ii < 6; ii++) {
for (int ii = 0; ii < 6; ii++) {
chain.push_unique(makeFunction<int, getSuccessValue>(iCountMyCalls));
}

ASSERT_EQ(1, iCountMyCalls()); // manually invoke returns 1
ASSERT_EQ(2, chain.invoke()); // should now be 2
ASSERT_EQ(2, chain.invoke()); // should now be 2
ASSERT_EQ(3, iCountMyCalls()); // manually invoke now returns 3
}

Expand Down
1 change: 0 additions & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ ADD_SUBDIRECTORY(dockey)
ADD_SUBDIRECTORY(engine_error)
ADD_SUBDIRECTORY(error_map_sanity_check)
ADD_SUBDIRECTORY(executor)
ADD_SUBDIRECTORY(function_chain)
ADD_SUBDIRECTORY(histograms)
ADD_SUBDIRECTORY(mcbp)
ADD_SUBDIRECTORY(memory_tracking_test)
Expand Down
6 changes: 0 additions & 6 deletions tests/function_chain/CMakeLists.txt

This file was deleted.

0 comments on commit 56c501a

Please sign in to comment.