Skip to content

Commit

Permalink
Fix - signed/unsigned mismatch
Browse files Browse the repository at this point in the history
Signed-off-by: tempate <danieldiaz@eprosima.com>
  • Loading branch information
Tempate committed Jul 11, 2024
1 parent d82da58 commit 568668d
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions test/unittest/utils/TreeNodeTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ struct TreeNodeTestType
*/
TEST(TreeNodeTests, one_shallow_branch)
{
constexpr auto DEPTH = 1;
constexpr auto NODE_COUNT = 2;
constexpr auto BRANCH_COUNT = 1;

std::vector<TreeNodeTestType> nodes;
std::vector<utilities::collections::TreeNode<TreeNodeTestType>> trees;
Expand All @@ -63,15 +65,15 @@ TEST(TreeNodeTests, one_shallow_branch)

// Verify the depth
const auto tree_depth = root.depth();
ASSERT_EQ(tree_depth, 1);
ASSERT_EQ(tree_depth, DEPTH);

// Verify the nodes are correct
const auto tree_nodes = root.all_nodes();
ASSERT_EQ(tree_nodes.size(), NODE_COUNT - 1);

// Verify the branch count
const auto tree_branches = root.branches();
ASSERT_EQ(tree_branches.size(), 1);
ASSERT_EQ(tree_branches.size(), BRANCH_COUNT);

// Verify that the branch is a leaf
ASSERT_TRUE(tree_branches.front().leaf());
Expand Down Expand Up @@ -99,7 +101,9 @@ TEST(TreeNodeTests, one_shallow_branch)
*/
TEST(TreeNodeTests, one_deep_branch)
{
constexpr auto DEPTH = 5;
constexpr auto NODE_COUNT = 6;
constexpr auto BRANCH_COUNT = 1;

std::vector<TreeNodeTestType> nodes;
std::vector<utilities::collections::TreeNode<TreeNodeTestType>> trees;
Expand All @@ -121,15 +125,15 @@ TEST(TreeNodeTests, one_deep_branch)

// Verify the depth
const auto tree_depth = root.depth();
ASSERT_EQ(tree_depth, NODE_COUNT - 1);
ASSERT_EQ(tree_depth, DEPTH);

// Verify the nodes are correct
const auto tree_nodes = root.all_nodes();
ASSERT_EQ(tree_nodes.size(), NODE_COUNT - 1);

// Verify the branch count
const auto tree_branches = root.branches();
ASSERT_EQ(tree_branches.size(), 1);
ASSERT_EQ(tree_branches.size(), BRANCH_COUNT);

// Verify that the branch is not a leaf
ASSERT_FALSE(tree_branches.front().leaf());
Expand All @@ -145,7 +149,9 @@ TEST(TreeNodeTests, one_deep_branch)
*/
TEST(TreeNodeTests, many_shallow_branches)
{
constexpr auto DEPTH = 1;
constexpr auto NODE_COUNT = 6;
constexpr auto BRANCH_COUNT = 5;

std::vector<TreeNodeTestType> nodes;
std::vector<utilities::collections::TreeNode<TreeNodeTestType>> trees;
Expand All @@ -167,7 +173,7 @@ TEST(TreeNodeTests, many_shallow_branches)

// Verify the depth
const auto tree_depth = root.depth();
ASSERT_EQ(tree_depth, 1);
ASSERT_EQ(tree_depth, DEPTH);

// Verify the node count
const auto tree_nodes = root.all_nodes();
Expand All @@ -185,7 +191,7 @@ TEST(TreeNodeTests, many_shallow_branches)

// Verify the branch count
const auto tree_branches = root.branches();
ASSERT_EQ(tree_branches.size(), NODE_COUNT - 1);
ASSERT_EQ(tree_branches.size(), BRANCH_COUNT);

// Verify the branch order
i = 0;
Expand Down Expand Up @@ -216,7 +222,9 @@ TEST(TreeNodeTests, many_shallow_branches)
*/
TEST(TreeNodeTests, binary_tree)
{
constexpr auto DEPTH = 2;
constexpr auto NODE_COUNT = 7;
constexpr auto BRANCH_COUNT = 2;

std::vector<TreeNodeTestType> nodes;
std::vector<utilities::collections::TreeNode<TreeNodeTestType>> trees;
Expand All @@ -242,7 +250,7 @@ TEST(TreeNodeTests, binary_tree)

// Verify the depth
const auto tree_depth = root.depth();
ASSERT_EQ(tree_depth, 2);
ASSERT_EQ(tree_depth, DEPTH);

// Verify the node count
const auto tree_nodes = root.all_nodes();
Expand All @@ -260,7 +268,7 @@ TEST(TreeNodeTests, binary_tree)

// Verify the branch count
const auto tree_branches = root.branches();
ASSERT_EQ(tree_branches.size(), 2);
ASSERT_EQ(tree_branches.size(), BRANCH_COUNT);

// Verify the branch order
ASSERT_EQ(tree_branches.front().info.name, "1");
Expand All @@ -271,7 +279,7 @@ TEST(TreeNodeTests, binary_tree)
{
// Verify the branch count
const auto branch_branches = branch.branches();
ASSERT_EQ(branch_branches.size(), 2);
ASSERT_EQ(branch_branches.size(), BRANCH_COUNT);

// Verify that every branch is a leaf
for (const auto& branch_branch : branch_branches)
Expand Down

0 comments on commit 568668d

Please sign in to comment.