Problem: code doesn't follow libzmq naming conventions

Solution: rename types/variables that are inconsistent
This commit is contained in:
Shubham Lagwankar
2019-06-28 11:57:45 -04:00
parent 4a855fba8c
commit 1186e9868a
5 changed files with 225 additions and 223 deletions

View File

@@ -35,41 +35,41 @@ void tearDown ()
{
}
bool tree_add (zmq::radix_tree &tree, const std::string &key)
bool tree_add (zmq::radix_tree_t &tree_, const std::string &key_)
{
return tree.add (reinterpret_cast<const unsigned char *> (key.data ()),
key.size ());
return tree_.add (reinterpret_cast<const unsigned char *> (key_.data ()),
key_.size ());
}
bool tree_rm (zmq::radix_tree &tree, const std::string &key)
bool tree_rm (zmq::radix_tree_t &tree_, const std::string &key_)
{
return tree.rm (reinterpret_cast<const unsigned char *> (key.data ()),
key.size ());
return tree_.rm (reinterpret_cast<const unsigned char *> (key_.data ()),
key_.size ());
}
bool tree_check (zmq::radix_tree &tree, const std::string &key)
bool tree_check (zmq::radix_tree_t &tree_, const std::string &key_)
{
return tree.check (reinterpret_cast<const unsigned char *> (key.data ()),
key.size ());
return tree_.check (reinterpret_cast<const unsigned char *> (key_.data ()),
key_.size ());
}
void test_empty ()
{
zmq::radix_tree tree;
zmq::radix_tree_t tree;
TEST_ASSERT_TRUE (tree.size () == 0);
}
void test_add_single_entry ()
{
zmq::radix_tree tree;
zmq::radix_tree_t tree;
TEST_ASSERT_TRUE (tree_add (tree, "foo"));
}
void test_add_same_entry_twice ()
{
zmq::radix_tree tree;
zmq::radix_tree_t tree;
TEST_ASSERT_TRUE (tree_add (tree, "test"));
TEST_ASSERT_FALSE (tree_add (tree, "test"));
@@ -77,14 +77,14 @@ void test_add_same_entry_twice ()
void test_rm_when_empty ()
{
zmq::radix_tree tree;
zmq::radix_tree_t tree;
TEST_ASSERT_FALSE (tree_rm (tree, "test"));
}
void test_rm_single_entry ()
{
zmq::radix_tree tree;
zmq::radix_tree_t tree;
tree_add (tree, "temporary");
TEST_ASSERT_TRUE (tree_rm (tree, "temporary"));
@@ -92,7 +92,7 @@ void test_rm_single_entry ()
void test_rm_unique_entry_twice ()
{
zmq::radix_tree tree;
zmq::radix_tree_t tree;
tree_add (tree, "test");
TEST_ASSERT_TRUE (tree_rm (tree, "test"));
@@ -101,7 +101,7 @@ void test_rm_unique_entry_twice ()
void test_rm_duplicate_entry ()
{
zmq::radix_tree tree;
zmq::radix_tree_t tree;
tree_add (tree, "test");
tree_add (tree, "test");
@@ -111,7 +111,7 @@ void test_rm_duplicate_entry ()
void test_rm_common_prefix ()
{
zmq::radix_tree tree;
zmq::radix_tree_t tree;
tree_add (tree, "checkpoint");
tree_add (tree, "checklist");
@@ -120,7 +120,7 @@ void test_rm_common_prefix ()
void test_rm_common_prefix_entry ()
{
zmq::radix_tree tree;
zmq::radix_tree_t tree;
tree_add (tree, "checkpoint");
tree_add (tree, "checklist");
@@ -130,7 +130,7 @@ void test_rm_common_prefix_entry ()
void test_rm_null_entry ()
{
zmq::radix_tree tree;
zmq::radix_tree_t tree;
tree_add (tree, "");
TEST_ASSERT_TRUE (tree_rm (tree, ""));
@@ -138,14 +138,14 @@ void test_rm_null_entry ()
void test_check_empty ()
{
zmq::radix_tree tree;
zmq::radix_tree_t tree;
TEST_ASSERT_FALSE (tree_check (tree, "foo"));
}
void test_check_added_entry ()
{
zmq::radix_tree tree;
zmq::radix_tree_t tree;
tree_add (tree, "entry");
TEST_ASSERT_TRUE (tree_check (tree, "entry"));
@@ -153,7 +153,7 @@ void test_check_added_entry ()
void test_check_common_prefix ()
{
zmq::radix_tree tree;
zmq::radix_tree_t tree;
tree_add (tree, "introduce");
tree_add (tree, "introspect");
@@ -162,7 +162,7 @@ void test_check_common_prefix ()
void test_check_prefix ()
{
zmq::radix_tree tree;
zmq::radix_tree_t tree;
tree_add (tree, "toasted");
TEST_ASSERT_FALSE (tree_check (tree, "toast"));
@@ -172,7 +172,7 @@ void test_check_prefix ()
void test_check_nonexistent_entry ()
{
zmq::radix_tree tree;
zmq::radix_tree_t tree;
tree_add (tree, "red");
TEST_ASSERT_FALSE (tree_check (tree, "blue"));
@@ -180,7 +180,7 @@ void test_check_nonexistent_entry ()
void test_check_query_longer_than_entry ()
{
zmq::radix_tree tree;
zmq::radix_tree_t tree;
tree_add (tree, "foo");
TEST_ASSERT_TRUE (tree_check (tree, "foobar"));
@@ -188,7 +188,7 @@ void test_check_query_longer_than_entry ()
void test_check_null_entry_added ()
{
zmq::radix_tree tree;
zmq::radix_tree_t tree;
tree_add (tree, "");
TEST_ASSERT_TRUE (tree_check (tree, "all queries return true"));
@@ -196,7 +196,7 @@ void test_check_null_entry_added ()
void test_size ()
{
zmq::radix_tree tree;
zmq::radix_tree_t tree;
// Adapted from the example on wikipedia.
std::vector<std::string> keys;
@@ -234,7 +234,7 @@ void return_key (unsigned char *data, size_t size, void *arg)
void test_apply ()
{
zmq::radix_tree tree;
zmq::radix_tree_t tree;
std::set<std::string> keys;
keys.insert ("tester");