Skip to content

Conversation

@ZakKurasov
Copy link

No description provided.

return std::stoi(ternary);
}

TEST(PowerTest, ItReturnSameNumberForIndexOne)
Copy link
Collaborator

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

Copy link
Author

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)
Copy link
Collaborator

Choose a reason for hiding this comment

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

std::pow уже сделал это за нас :)

Copy link
Author

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;
Copy link
Collaborator

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);

Copy link
Author

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.

2 participants