mirror of
https://github.com/Microsoft/calculator.git
synced 2025-07-05 20:51:09 -07:00
Bugfix: Division Bug in Programmer Dec Mode (#2300)
* Update intrat function added a programmer mode test case * Added three more test cases --------- Co-authored-by: Ishuah Kariuki <ikariuki@microsoft.com>
This commit is contained in:
parent
71454cee1f
commit
758c5505c6
2 changed files with 31 additions and 0 deletions
|
@ -303,6 +303,12 @@ void intrat(_Inout_ PRAT* px, uint32_t radix, int32_t precision)
|
|||
DUPRAT(pret, *px);
|
||||
remrat(&pret, rat_one);
|
||||
|
||||
// Flatten pret in case it's not aligned with px after remrat operation
|
||||
if (!equnum((*px)->pq, pret->pq))
|
||||
{
|
||||
flatrat(pret, radix, precision);
|
||||
}
|
||||
|
||||
subrat(px, pret, precision);
|
||||
destroyrat(pret);
|
||||
|
||||
|
|
|
@ -752,6 +752,31 @@ namespace CalculatorManagerTest
|
|||
|
||||
Command commands10[] = { Command::ModeProgrammer, Command::Command1, Command::CommandRORC, Command::CommandRORC, Command::CommandNULL };
|
||||
TestDriver::Test(L"-9,223,372,036,854,775,808", L"RoR(RoR(1))", commands10, true, false);
|
||||
|
||||
Command commands11[] = { Command::ModeProgrammer, Command::CommandDec, Command::Command4, Command::Command2, Command::Command9, Command::Command4,
|
||||
Command::Command9, Command::Command6, Command::Command7, Command::Command2, Command::Command9, Command::Command6,
|
||||
Command::CommandDIV, Command::Command2, Command::Command5, Command::Command5, Command::CommandEQU, Command::CommandNULL };
|
||||
TestDriver::Test(L"16,843,009", L"4294967296 \x00F7 255=", commands11, true, false);
|
||||
|
||||
Command commands12[] = {
|
||||
Command::ModeProgrammer, Command::CommandDec, Command::Command4, Command::Command2, Command::Command9, Command::Command4,
|
||||
Command::Command9, Command::Command6, Command::Command7, Command::Command3, Command::Command0, Command::Command3,
|
||||
Command::CommandDIV, Command::Command2, Command::Command5, Command::Command5, Command::CommandEQU, Command::CommandNULL
|
||||
};
|
||||
TestDriver::Test(L"16,843,009", L"4294967303 \x00F7 255=", commands12, true, false);
|
||||
|
||||
Command commands13[] = {
|
||||
Command::ModeProgrammer, Command::CommandDec, Command::Command1, Command::Command0, Command::Command0, Command::Command0,
|
||||
Command::Command0, Command::Command0, Command::Command0, Command::Command0, Command::Command0, Command::Command0, Command::CommandDIV,
|
||||
Command::Command6, Command::Command4, Command::Command4, Command::Command8, Command::Command7, Command::CommandEQU, Command::CommandNULL
|
||||
};
|
||||
TestDriver::Test(L"15,507", L"1000000000 \x00F7 64487=", commands13, true, false);
|
||||
|
||||
Command commands14[] = { Command::ModeProgrammer, Command::CommandDec, Command::Command1, Command::Command0, Command::Command0,
|
||||
Command::Command0, Command::Command0, Command::Command0, Command::Command0, Command::Command0,
|
||||
Command::Command0, Command::Command0, Command::CommandDIV, Command::Command6, Command::Command4,
|
||||
Command::Command4, Command::Command8, Command::Command8, Command::CommandEQU, Command::CommandNULL };
|
||||
TestDriver::Test(L"15,506", L"1000000000 \x00F7 64488=", commands14, true, false);
|
||||
}
|
||||
|
||||
void CalculatorManagerTest::CalculatorManagerTestMemory()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue