Skip to content

Commit

Permalink
Update enum tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pwojcikdev committed Jan 25, 2024
1 parent 59f9135 commit fa1c303
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
18 changes: 18 additions & 0 deletions nano/core_test/enums.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,22 @@ TEST (enums, stat_dir)
{
ASSERT_FALSE (nano::to_string (static_cast<nano::stat::dir> (0)).empty ());
ASSERT_FALSE (nano::to_string (nano::stat::dir::_last).empty ());
}

TEST (enums, log_type)
{
ASSERT_FALSE (nano::log::to_string (static_cast<nano::log::type> (0)).empty ());
ASSERT_FALSE (nano::log::to_string (nano::log::type::_last).empty ());
}

TEST (enums, log_detail)
{
ASSERT_FALSE (nano::log::to_string (static_cast<nano::log::detail> (0)).empty ());
ASSERT_FALSE (nano::log::to_string (nano::log::detail::_last).empty ());
}

TEST (enums, log_category)
{
ASSERT_FALSE (nano::log::to_string (static_cast<nano::log::type> (0)).empty ());
ASSERT_FALSE (nano::log::to_string (nano::log::type::_last).empty ());
}
5 changes: 5 additions & 0 deletions nano/lib/logging_enums.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ enum class type
bootstrap,
bootstrap_lazy,
bootstrap_legacy,

_last // Must be the last enum
};

enum class detail
Expand Down Expand Up @@ -112,6 +114,7 @@ enum class detail
requesting_account_or_head,
requesting_pending,

_last // Must be the last enum
};

// TODO: Additionally categorize logs by categories which can be enabled/disabled independently
Expand All @@ -121,6 +124,8 @@ enum class category

work_generation,
// ...

_last // Must be the last enum
};
}

Expand Down

0 comments on commit fa1c303

Please sign in to comment.