Simple fix for the omitted multiplication sign before a left parenthesis (#1661)
* simple fix for the omitted multiplication sign * accepts unary-op-code
This commit is contained in:
parent
8797e37e73
commit
10ae9430a0
@ -519,6 +519,12 @@ void CCalcEngine::ProcessCommandWorker(OpCode wParam)
|
||||
|
||||
if (wParam == IDC_OPENP)
|
||||
{
|
||||
// if there's an omitted multiplication sign
|
||||
if (IsDigitOpCode(m_nLastCom) || IsUnaryOpCode(m_nLastCom) || m_nLastCom == IDC_PNT || m_nLastCom == IDC_CLOSEP)
|
||||
{
|
||||
ProcessCommand(IDC_MUL);
|
||||
}
|
||||
|
||||
CheckAndAddLastBinOpToHistory();
|
||||
m_HistoryCollector.AddOpenBraceToHistory();
|
||||
|
||||
|
@ -633,16 +633,16 @@ namespace CalculatorManagerTest
|
||||
|
||||
Command commands3[] = { Command::Command1, Command::Command2, Command::CommandCLOSEP,
|
||||
Command::CommandCLOSEP, Command::CommandOPENP, Command::CommandNULL };
|
||||
TestDriver::Test(L"12", L"(", commands3, true, true);
|
||||
TestDriver::Test(L"12", L"12 \x00D7 (", commands3, true, true);
|
||||
|
||||
Command commands4[] = {
|
||||
Command::Command2, Command::CommandOPENP, Command::Command2, Command::CommandCLOSEP, Command::CommandADD, Command::CommandNULL
|
||||
};
|
||||
TestDriver::Test(L"2", L"(2) + ", commands4, true, true);
|
||||
TestDriver::Test(L"4", L"2 \x00D7 (2) + ", commands4, true, true);
|
||||
|
||||
Command commands5[] = { Command::Command2, Command::CommandOPENP, Command::Command2, Command::CommandCLOSEP,
|
||||
Command::CommandADD, Command::CommandEQU, Command::CommandNULL };
|
||||
TestDriver::Test(L"4", L"(2) + 2=", commands5, true, true);
|
||||
TestDriver::Test(L"8", L"2 \x00D7 (2) + 4=", commands5, true, true);
|
||||
}
|
||||
|
||||
void CalculatorManagerTest::CalculatorManagerTestScientificError()
|
||||
|
Loading…
Reference in New Issue
Block a user