Skip to content
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

Ternary number #8

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open

Conversation

dariatdd
Copy link

No description provided.


TEST(TernaryNumber, ConvertValidTernaryNumberTest)
{
EXPECT_EQ(5, ConvertTernaryToDecimal("012"));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Можно было сначала добавить тест на невалидное значение.
Шаг выглядит великоватым.

Copy link
Collaborator

Choose a reason for hiding this comment

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

  • перед этим тестом нужен был тест с пустой строкой

@@ -28,6 +28,11 @@ int ConvertTernaryToDecimal(const std::string& ternaryNumber)

for(int i = numberLen - 1; i >= 0; --i)
{
int currentSymbol = static_cast<int>(ternaryNumber[i]) - s_ascii_shift;
if(currentSymbol > 3 || currentSymbol < 0)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Не соответствует условию задачи:
Trinary numbers contain three symbols: 0, 1, and 2.

if(ternaryNumber == "012")
int sum = 0;
long value = 1;
for(int i = ternaryNumber.length() - 1; i >= 0; --i)
Copy link
Collaborator

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