rename session_filter to session_dabloom
This commit is contained in:
@@ -11,8 +11,8 @@ target_link_libraries(gtest_session_table session_manager gtest)
|
||||
add_executable(gtest_session_timer gtest_session_timer.cpp)
|
||||
target_link_libraries(gtest_session_timer session_manager gtest)
|
||||
|
||||
add_executable(gtest_session_filter gtest_session_filter.cpp)
|
||||
target_link_libraries(gtest_session_filter session_manager gtest)
|
||||
add_executable(gtest_session_dabloom gtest_session_dabloom.cpp)
|
||||
target_link_libraries(gtest_session_dabloom session_manager gtest)
|
||||
|
||||
###############################################################################
|
||||
# gtest state machine (TCP)
|
||||
@@ -123,7 +123,7 @@ include(GoogleTest)
|
||||
gtest_discover_tests(gtest_session_pool)
|
||||
gtest_discover_tests(gtest_session_table)
|
||||
gtest_discover_tests(gtest_session_timer)
|
||||
gtest_discover_tests(gtest_session_filter)
|
||||
gtest_discover_tests(gtest_session_dabloom)
|
||||
|
||||
gtest_discover_tests(gtest_state_tcp_init_to_opening)
|
||||
gtest_discover_tests(gtest_state_tcp_opening_to_active)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "test_utils.h"
|
||||
|
||||
TEST(SESSION_FILTER, TEST)
|
||||
TEST(SESSION_DABLOOM, TEST)
|
||||
{
|
||||
struct tuple6 c2s_key;
|
||||
struct tuple6 s2c_key;
|
||||
@@ -27,20 +27,20 @@ TEST(SESSION_FILTER, TEST)
|
||||
s2c_key.ip_proto = 0x05;
|
||||
s2c_key.domain = 0x0606060606060606;
|
||||
|
||||
struct session_filter *filter = session_filter_new(capacity, timeout, error_rate, 1);
|
||||
struct session_dabloom *filter = session_dabloom_new(capacity, timeout, error_rate, 1);
|
||||
EXPECT_TRUE(filter != nullptr);
|
||||
|
||||
EXPECT_TRUE(session_filter_lookup(filter, &c2s_key, 1) == 0); // no found
|
||||
EXPECT_TRUE(session_filter_lookup(filter, &s2c_key, 1) == 0); // no found
|
||||
session_filter_add(filter, &c2s_key, 1); // add
|
||||
EXPECT_TRUE(session_filter_lookup(filter, &c2s_key, 1) == 1); // found
|
||||
EXPECT_TRUE(session_filter_lookup(filter, &s2c_key, 1) == 1); // found
|
||||
EXPECT_TRUE(session_filter_lookup(filter, &c2s_key, 2) == 1); // found
|
||||
EXPECT_TRUE(session_filter_lookup(filter, &s2c_key, 2) == 1); // found
|
||||
EXPECT_TRUE(session_filter_lookup(filter, &c2s_key, 3) == 0); // not found
|
||||
EXPECT_TRUE(session_filter_lookup(filter, &s2c_key, 3) == 0); // not found
|
||||
EXPECT_TRUE(session_dabloom_lookup(filter, &c2s_key, 1) == 0); // no found
|
||||
EXPECT_TRUE(session_dabloom_lookup(filter, &s2c_key, 1) == 0); // no found
|
||||
session_dabloom_add(filter, &c2s_key, 1); // add
|
||||
EXPECT_TRUE(session_dabloom_lookup(filter, &c2s_key, 1) == 1); // found
|
||||
EXPECT_TRUE(session_dabloom_lookup(filter, &s2c_key, 1) == 1); // found
|
||||
EXPECT_TRUE(session_dabloom_lookup(filter, &c2s_key, 2) == 1); // found
|
||||
EXPECT_TRUE(session_dabloom_lookup(filter, &s2c_key, 2) == 1); // found
|
||||
EXPECT_TRUE(session_dabloom_lookup(filter, &c2s_key, 3) == 0); // not found
|
||||
EXPECT_TRUE(session_dabloom_lookup(filter, &s2c_key, 3) == 0); // not found
|
||||
|
||||
session_filter_free(filter);
|
||||
session_dabloom_free(filter);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
@@ -15,7 +15,7 @@ extern "C"
|
||||
#include "session_pool.h"
|
||||
#include "session_timer.h"
|
||||
#include "session_table.h"
|
||||
#include "session_filter.h"
|
||||
#include "session_dabloom.h"
|
||||
#include "session_internal.h"
|
||||
#include "session_transition.h"
|
||||
#include "session_manager_cfg.h"
|
||||
|
||||
Reference in New Issue
Block a user