Skip to content

Commit

Permalink
tests: Added tests for Helper::setElement()
Browse files Browse the repository at this point in the history
  • Loading branch information
braw-lee committed Nov 21, 2023
1 parent 71d85f9 commit b5dd175
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/modules/helper/HelperTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <regex>
#include <stdexcept>
#include <unordered_map>
#include <vector>

#include "gtest/gtest.h"

Expand All @@ -18,6 +19,24 @@ class HelperTest : public Test
namespace
{

TEST_F(HelperTest, SetElement)
{
std::set<char> chars{'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'l', 'm'};
std::vector<char> randomChars;
for (int i = 0; i < 30; ++i)
{
randomChars.push_back(Helper::setElement(chars));
}
for (auto character : randomChars)
{
ASSERT_TRUE(chars.find(character) != chars.end());
}
}
TEST_F(HelperTest, SetElementEmptyData)
{
std::set<char> chars{};
ASSERT_THROW(Helper::setElement<char>(chars), std::invalid_argument);
}
TEST_F(HelperTest, ReplaceSymbolWithNumber)
{
std::string input = "123#456!";
Expand Down

0 comments on commit b5dd175

Please sign in to comment.