Skip to content
5 changes: 5 additions & 0 deletions tdd_intro/homework/02_ternary_numbers/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.

{
return 0;
}
sum += (ternaryNumber[i] - s_ascii_shift) * value;
value *= s_ternary_base;
}
Expand Down