-
Notifications
You must be signed in to change notification settings - Fork 16
01 - Leap Year #19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
01 - Leap Year #19
Conversation
mettizik
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
| TEST(SplitTest, ReturnSameWordForOneWordSentence) | ||
| TEST(SplitTest, ReturnsNWordsForNWordsSentenceSentence) | ||
| { | ||
| EXPECT_EQ(std::vector<std::string>({"word"}), Split("word", " ")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
этот экспект должен идти отдельно, поскольку изолирует отдельный кейс отсутствия делимитера
| for (const std::string& word : words) | ||
| { | ||
| result.insert(std::make_pair(word, 1)); | ||
| if (result.find(word) != result.end()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
можно упростить за счёт оператора [] в std::map:
result[word] += 1;
Он сделает вставку, если элемента нет, а в противном случае возьмет существующий
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А он проинициализирует вставленное значение нулем?)
No description provided.