Skip to content

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.

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

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