Skip to content

02 - word count#2

Open
Alexandr1992 wants to merge 13 commits intoBranchForPullRequestfrom
TernaryNumbers
Open

02 - word count#2
Alexandr1992 wants to merge 13 commits intoBranchForPullRequestfrom
TernaryNumbers

Conversation

@Alexandr1992
Copy link
Copy Markdown
Owner

No description provided.

Copy link
Copy Markdown

@mettizik mettizik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Слишком большие шаги, видно что ты уже понимал, как хочешь реализовать функцию и просто писал тесты под эту реализацию. А надо отталкиваться от тестов, а не наоборот

std::map<std::string, size_t> words = SeparateWords("hello bro");
EXPECT_EQ(1, words.size());
words_mt words = SeparateWords("hello");
ASSERT_EQ(1, words.size());
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Слишком много ожиданий

EXPECT_EQ(1, words.size());
words_mt words = SeparateWords("hello");
ASSERT_EQ(1, words.size());
EXPECT_TRUE(words.find("hello") != words.end());
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

за find респект


words_mt SeparateWords(const std::string& phrase)
{
const size_t index = phrase.find_first_of(wordSeparator);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

это уже имплемент, а не рефакторинг - написанный тест не нуждается вэтом функционале

const size_t index = phrase.find_first_of(wordSeparator);
return {{phrase.substr(0, index), 1}};

if (index != std::string::npos)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

на этот if нет теста

words_mt SeparateWords(const std::string& phrase)
{
const size_t index = phrase.find_first_of(wordSeparator);
std::string separatedPhrase = phrase;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

тест был сложноват, но он всё равно не нуждается в таком кол-ве функционала, как по мне

EXPECT_EQ(1, words["hello"]);
}

TEST(WordsCount, TestTrimWord)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

тоже сложный тест и многоекспектов

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants