-
Notifications
You must be signed in to change notification settings - Fork 16
2 ternary numbers #27
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?
Conversation
| return std::stoi(ternary); | ||
| } | ||
|
|
||
| TEST(PowerTest, ItReturnSameNumberForIndexOne) |
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.
по канонам TDD у теья не должно висеть красных тестов на протяжении долгого времени. Если ты написал тест, который требует доп реализации и прохождения других тестов сначала - тест следует убрать или задизэйблить. У Google Test есть такая фича - https://stackoverflow.com/a/7208119/5607187
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.
Понял, спасибо)
| If your language provides a method in the standard library to perform the conversion, pretend it doesn't exist and implement it yourself. | ||
| */ | ||
|
|
||
| int Power(int number, int index) |
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::pow уже сделал это за нас :)
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.
If your language provides a method in the standard library
Слишком буквально это воспринял)))
| { | ||
| result.push_back(ch - '0'); | ||
| } | ||
| return result; |
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::transform для наполения вектора:
http://www.cplusplus.com/reference/algorithm/transform/
std::string in = "123";
std::vector<int> out(3);
std::transform(in.cbegin(), in.cend(), out.begin(), [] (char ch) { return ch - '0'; });
EXPECT_EQ(std::vector<int>({1,2,3}), out);
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.