Files
MuditaOS/module-apps/application-calculator/data/CalculatorInputProcessor.cpp
Artur Śleszyński a702bbd17c [EGD-6561] Make calculator input testable
I got sick of manually testing calculator like a troglodyte.
2021-04-20 13:17:54 +02:00

34 lines
737 B
C++

// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include "CalculatorInputProcessor.hpp"
bool calc::InputProcessor::isSymbol(uint32_t code)
{
using namespace symbols::codes;
switch (code) {
case plus:
[[fallthrough]];
case minus:
[[fallthrough]];
case division:
[[fallthrough]];
case multiplication:
[[fallthrough]];
case comma:
[[fallthrough]];
case full_stop:
return true;
default:
return false;
}
}
bool calc::InputProcessor::isDecimalSeparator(uint32_t code)
{
using namespace symbols::codes;
return code == comma || code == full_stop;
}