Clang-format most of the sources (#1467)

This commit is contained in:
Michał Janiszewski 2021-05-10 19:18:39 +02:00 committed by GitHub
commit f30e9494ce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
54 changed files with 826 additions and 896 deletions

View file

@ -31,13 +31,8 @@ namespace
// 0 is returned. Higher the number, higher the precedence of the operator.
int NPrecedenceOfOp(int nopCode)
{
static uint16_t rgbPrec[] = {
0,0, IDC_OR,0, IDC_XOR,0,
IDC_AND,1, IDC_NAND,1, IDC_NOR,1,
IDC_ADD,2, IDC_SUB,2,
IDC_RSHF,3, IDC_LSHF,3, IDC_RSHFL,3,
IDC_MOD,3, IDC_DIV,3, IDC_MUL,3,
IDC_PWR,4, IDC_ROOT,4, IDC_LOGBASEY,4 };
static uint16_t rgbPrec[] = { 0, 0, IDC_OR, 0, IDC_XOR, 0, IDC_AND, 1, IDC_NAND, 1, IDC_NOR, 1, IDC_ADD, 2, IDC_SUB, 2, IDC_RSHF, 3,
IDC_LSHF, 3, IDC_RSHFL, 3, IDC_MOD, 3, IDC_DIV, 3, IDC_MUL, 3, IDC_PWR, 4, IDC_ROOT, 4, IDC_LOGBASEY, 4 };
for (unsigned int iPrec = 0; iPrec < size(rgbPrec); iPrec += 2)
{
@ -85,8 +80,7 @@ void CCalcEngine::ClearDisplay()
{
if (nullptr != m_pCalcDisplay)
{
m_pCalcDisplay->SetExpressionDisplay(
make_shared<vector<pair<wstring, int>>>(), make_shared<vector<shared_ptr<IExpressionCommand>>>());
m_pCalcDisplay->SetExpressionDisplay(make_shared<vector<pair<wstring, int>>>(), make_shared<vector<shared_ptr<IExpressionCommand>>>());
}
}
@ -142,18 +136,10 @@ void CCalcEngine::ProcessCommandWorker(OpCode wParam)
// Toggle Record/Display mode if appropriate.
if (m_bRecord)
{
if (IsBinOpCode(wParam) ||
IsUnaryOpCode(wParam) ||
IsOpInRange(wParam, IDC_FE, IDC_MMINUS) ||
IsOpInRange(wParam, IDC_OPENP, IDC_CLOSEP) ||
IsOpInRange(wParam, IDM_HEX, IDM_BIN) ||
IsOpInRange(wParam, IDM_QWORD, IDM_BYTE) ||
IsOpInRange(wParam, IDM_DEG, IDM_GRAD) ||
IsOpInRange(wParam, IDC_BINEDITSTART, IDC_BINEDITEND) ||
(IDC_INV == wParam) ||
(IDC_SIGN == wParam && 10 != m_radix) ||
(IDC_RAND == wParam) ||
(IDC_EULER == wParam))
if (IsBinOpCode(wParam) || IsUnaryOpCode(wParam) || IsOpInRange(wParam, IDC_FE, IDC_MMINUS) || IsOpInRange(wParam, IDC_OPENP, IDC_CLOSEP)
|| IsOpInRange(wParam, IDM_HEX, IDM_BIN) || IsOpInRange(wParam, IDM_QWORD, IDM_BYTE) || IsOpInRange(wParam, IDM_DEG, IDM_GRAD)
|| IsOpInRange(wParam, IDC_BINEDITSTART, IDC_BINEDITEND) || (IDC_INV == wParam) || (IDC_SIGN == wParam && 10 != m_radix) || (IDC_RAND == wParam)
|| (IDC_EULER == wParam))
{
m_bRecord = false;
m_currentVal = m_input.ToRational(m_radix, m_precision);
@ -269,7 +255,6 @@ void CCalcEngine::ProcessCommandWorker(OpCode wParam)
DisplayNum();
if (!m_fPrecedence)
{
wstring groupedString = GroupDigitsPerRadix(m_numberString, m_radix);
m_HistoryCollector.CompleteEquation(groupedString);
m_HistoryCollector.AddOpndToHistory(m_numberString, m_currentVal);
@ -360,13 +345,10 @@ void CCalcEngine::ProcessCommandWorker(OpCode wParam)
/* reset the m_bInv flag and indicators if it is set
and have been used */
if (m_bInv &&
((wParam == IDC_CHOP) || (wParam == IDC_SIN) || (wParam == IDC_COS) ||
(wParam == IDC_TAN) || (wParam == IDC_LN) || (wParam == IDC_DMS) ||
(wParam == IDC_DEGREES) || (wParam == IDC_SINH) || (wParam == IDC_COSH) ||
(wParam == IDC_TANH) || (wParam == IDC_SEC) || (wParam == IDC_CSC) ||
(wParam == IDC_COT) || (wParam == IDC_SECH) || (wParam == IDC_CSCH) ||
(wParam == IDC_COTH)))
if (m_bInv
&& ((wParam == IDC_CHOP) || (wParam == IDC_SIN) || (wParam == IDC_COS) || (wParam == IDC_TAN) || (wParam == IDC_LN) || (wParam == IDC_DMS)
|| (wParam == IDC_DEGREES) || (wParam == IDC_SINH) || (wParam == IDC_COSH) || (wParam == IDC_TANH) || (wParam == IDC_SEC) || (wParam == IDC_CSC)
|| (wParam == IDC_COT) || (wParam == IDC_SECH) || (wParam == IDC_CSCH) || (wParam == IDC_COTH)))
{
m_bInv = false;
}
@ -928,8 +910,7 @@ struct FunctionNameElement
};
// Table for each unary operator
static const std::unordered_map<int, FunctionNameElement> operatorStringTable =
{
static const std::unordered_map<int, FunctionNameElement> operatorStringTable = {
{ IDC_CHOP, { L"", SIDS_FRAC } },
{ IDC_SIN, { SIDS_SIND, SIDS_ASIND, SIDS_SINR, SIDS_ASINR, SIDS_SING, SIDS_ASING } },

View file

@ -118,7 +118,6 @@ public:
ResultCode hr = this->GetSize(&nTokens);
if (SUCCEEDED(hr))
{
std::pair<std::wstring, int> currentPair;
for (unsigned int i = 0; i < nTokens; i++)
{

View file

@ -206,8 +206,7 @@ inline constexpr auto SIDS_CUBEROOT = L"CubeRoot";
inline constexpr auto SIDS_PROGRAMMER_MOD = L"ProgrammerMod";
// Include the resource key ID from above into this vector to load it into memory for the engine to use
inline constexpr std::array<std::wstring_view, 152> g_sids =
{
inline constexpr std::array<std::wstring_view, 152> g_sids = {
SIDS_PLUS_MINUS,
SIDS_C,
SIDS_CE,

View file

@ -162,8 +162,7 @@ namespace UnitConversionManager
std::unordered_map<UnitConversionManager::Unit, UnitConversionManager::ConversionData, UnitConversionManager::UnitHash>,
UnitConversionManager::UnitHash>
UnitToUnitToConversionDataMap;
typedef std::unordered_map<int, std::vector<UnitConversionManager::Unit>>
CategoryToUnitVectorMap;
typedef std::unordered_map<int, std::vector<UnitConversionManager::Unit>> CategoryToUnitVectorMap;
class IViewModelCurrencyCallback
{

View file

@ -77,6 +77,5 @@ public
static NarratorAnnouncement ^ GetAlwaysOnTopChangedAnnouncement(Platform::String ^ announcement);
static NarratorAnnouncement ^ GetBitShiftRadioButtonCheckedAnnouncement(Platform::String ^ announcement);
};
}

View file

@ -347,8 +347,9 @@ bool NavCategory::IsValidViewMode(ViewMode mode)
bool NavCategory::IsViewModeEnabled(ViewMode mode)
{
auto iter =
find_if(begin(s_categoryManifest), end(s_categoryManifest), [mode](const NavCategoryInitializer& initializer) { return initializer.viewMode == mode && initializer.isEnabled; });
auto iter = find_if(begin(s_categoryManifest), end(s_categoryManifest), [mode](const NavCategoryInitializer& initializer) {
return initializer.viewMode == mode && initializer.isEnabled;
});
return iter != s_categoryManifest.end();
}

View file

@ -241,7 +241,6 @@ namespace Utils
};
}
// Regular DependencyProperty
template <typename TOwner, typename TType>
Windows::UI::Xaml::DependencyProperty^ RegisterDependencyProperty(

View file

@ -437,6 +437,3 @@ void App::DismissedEventHandler(SplashScreen ^ sender, Object ^ e)
{
SetupJumpList();
}

View file

@ -528,7 +528,8 @@ void KeyboardShortcutManager::OnAcceleratorKeyActivated(CoreDispatcher ^, Accele
return;
}
const bool controlKeyPressed = (Window::Current->CoreWindow->GetKeyState(VirtualKey::Control) & CoreVirtualKeyStates::Down) == CoreVirtualKeyStates::Down;
const bool controlKeyPressed =
(Window::Current->CoreWindow->GetKeyState(VirtualKey::Control) & CoreVirtualKeyStates::Down) == CoreVirtualKeyStates::Down;
// Ctrl is pressed in addition to alt, this means Alt Gr is intended. do not navigate.
if (controlKeyPressed)
{

View file

@ -726,16 +726,18 @@ namespace CalculatorManagerTest
Command::Command8, Command::Command3, Command::CommandAnd, Command::CommandNULL };
TestDriver::Test(L"-120", L"53 NOR 83 AND ", commands2, true, false);
Command commands3[] = { Command::ModeProgrammer, Command::Command5, Command::CommandLSHF,
Command::Command1, Command::CommandAnd, Command::CommandNULL };
Command commands3[] = {
Command::ModeProgrammer, Command::Command5, Command::CommandLSHF, Command::Command1, Command::CommandAnd, Command::CommandNULL
};
TestDriver::Test(L"10", L"5 Lsh 1 AND ", commands3, true, false);
Command commands5[] = { Command::ModeProgrammer, Command::Command5, Command::CommandRSHFL,
Command::Command1, Command::CommandAnd, Command::CommandNULL };
Command commands5[] = {
Command::ModeProgrammer, Command::Command5, Command::CommandRSHFL, Command::Command1, Command::CommandAnd, Command::CommandNULL
};
TestDriver::Test(L"2", L"5 Rsh 1 AND ", commands5, true, false);
Command commands6[] = { Command::ModeProgrammer, Command::CommandBINPOS63, Command::CommandRSHF,
Command::Command5, Command::Command6, Command::CommandAnd, Command::CommandNULL };
Command commands6[] = { Command::ModeProgrammer, Command::CommandBINPOS63, Command::CommandRSHF, Command::Command5,
Command::Command6, Command::CommandAnd, Command::CommandNULL };
TestDriver::Test(L"-128", L"-9223372036854775808 Rsh 56 AND ", commands6, true, false);
Command commands7[] = { Command::ModeProgrammer, Command::Command1, Command::CommandROL, Command::CommandNULL };
@ -1021,10 +1023,7 @@ namespace CalculatorManagerTest
VERIFY_ARE_EQUAL(0, pCalculatorDisplay->GetBinaryOperatorReceivedCallCount());
m_calculatorManager->SetStandardMode();
ExecuteCommands({
Command::Command1,
Command::CommandADD
});
ExecuteCommands({ Command::Command1, Command::CommandADD });
wstring display = pCalculatorDisplay->GetPrimaryDisplay();
VERIFY_ARE_EQUAL(L"1", display);
@ -1040,12 +1039,7 @@ namespace CalculatorManagerTest
VERIFY_ARE_EQUAL(0, pCalculatorDisplay->GetBinaryOperatorReceivedCallCount());
m_calculatorManager->SetStandardMode();
ExecuteCommands({
Command::Command1,
Command::CommandADD,
Command::CommandSUB,
Command::CommandMUL
});
ExecuteCommands({ Command::Command1, Command::CommandADD, Command::CommandSUB, Command::CommandMUL });
wstring display = pCalculatorDisplay->GetPrimaryDisplay();
VERIFY_ARE_EQUAL(L"1", display);
@ -1061,8 +1055,7 @@ namespace CalculatorManagerTest
VERIFY_ARE_EQUAL(0, pCalculatorDisplay->GetBinaryOperatorReceivedCallCount());
m_calculatorManager->SetStandardMode();
ExecuteCommands({
Command::Command1,
ExecuteCommands({ Command::Command1,
Command::CommandADD,
Command::Command2,
Command::CommandMUL,
@ -1072,8 +1065,7 @@ namespace CalculatorManagerTest
Command::Command5,
Command::CommandDIV,
Command::Command5,
Command::CommandEQU
});
Command::CommandEQU });
wstring display = pCalculatorDisplay->GetPrimaryDisplay();
VERIFY_ARE_EQUAL(L"5", display);
@ -1135,7 +1127,8 @@ namespace CalculatorManagerTest
Command commands17[] = { Command::Command1, Command::CommandADD, Command::Command2, Command::CommandEQU, Command::CommandNULL };
TestDriver::Test(L"3", L"1 + 2=", commands17);
Command commands18[] = { Command::Command2, Command::Command0, Command::CommandMUL, Command::Command0, Command::Command2, Command::CommandEQU, Command::CommandNULL };
Command commands18[] = { Command::Command2, Command::Command0, Command::CommandMUL, Command::Command0,
Command::Command2, Command::CommandEQU, Command::CommandNULL };
TestDriver::Test(L"40", L"20 \x00D7 2=", commands18);
Command commands19[] = { Command::Command1, Command::CommandADD, Command::Command2, Command::CommandADD, Command::CommandBACK, Command::CommandNULL };
@ -1153,7 +1146,8 @@ namespace CalculatorManagerTest
Command commands23[] = { Command::Command1, Command::CommandADD, Command::Command2, Command::CommandCENTR, Command::CommandNULL };
TestDriver::Test(L"0", L"1 + ", commands23);
Command commands24[] = { Command::Command1, Command::CommandMUL, Command::Command2, Command::CommandMUL, Command::Command3, Command::CommandMUL, Command::Command4, Command::CommandMUL, Command::Command5, Command::CommandMUL, Command::CommandNULL };
Command commands24[] = { Command::Command1, Command::CommandMUL, Command::Command2, Command::CommandMUL, Command::Command3, Command::CommandMUL,
Command::Command4, Command::CommandMUL, Command::Command5, Command::CommandMUL, Command::CommandNULL };
TestDriver::Test(L"120", L"120 \x00D7 ", commands24);
}

View file

@ -73,21 +73,13 @@ namespace CalculatorUnitTests
}
VERIFY_ARE_EQUAL(
m_CopyPasteManager->ValidatePasteExpression(
StringReference(exp_TooLong.c_str()),
ViewMode::Standard,
CategoryGroupType::Calculator,
NumberBase::Unknown,
BitLength::BitLengthUnknown),
StringReference(exp_TooLong.c_str()), ViewMode::Standard, CategoryGroupType::Calculator, NumberBase::Unknown, BitLength::BitLengthUnknown),
StringReference(exp_TooLong.c_str()),
L"Verify ValidatePasteExpression handles expressions up to max length");
exp_TooLong += L"1";
VERIFY_ARE_EQUAL(
m_CopyPasteManager->ValidatePasteExpression(
StringReference(exp_TooLong.c_str()),
ViewMode::Standard,
CategoryGroupType::Calculator,
NumberBase::Unknown,
BitLength::BitLengthUnknown),
StringReference(exp_TooLong.c_str()), ViewMode::Standard, CategoryGroupType::Calculator, NumberBase::Unknown, BitLength::BitLengthUnknown),
StringReference(L"NoOp"),
L"Verify ValidatePasteExpression returns NoOp for strings over max length");
@ -333,8 +325,7 @@ namespace CalculatorUnitTests
0,
L"Verify Scientific mode maximum values");
VERIFY_MAXOPERANDLENGTHANDVALUE_ARE_EQUALS(
m_CopyPasteManager->GetMaxOperandLengthAndValue(
ViewMode::None, CategoryGroupType::Converter, NumberBase::Unknown, BitLength::BitLengthUnknown),
m_CopyPasteManager->GetMaxOperandLengthAndValue(ViewMode::None, CategoryGroupType::Converter, NumberBase::Unknown, BitLength::BitLengthUnknown),
m_CopyPasteManager->MaxConverterInputLength,
0,
L"Verify Converter mode maximum values");
@ -345,96 +336,79 @@ namespace CalculatorUnitTests
unsigned long long int ullByteMax = UINT8_MAX;
Logger::WriteMessage(L"Verify Programmer Mode NumberBase::HexBase maximum values");
VERIFY_MAXOPERANDLENGTHANDVALUE_ARE_EQUALS(
m_CopyPasteManager->GetMaxOperandLengthAndValue(
ViewMode::Programmer, CategoryGroupType::None, NumberBase::HexBase, BitLength::BitLengthQWord),
m_CopyPasteManager->GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, NumberBase::HexBase, BitLength::BitLengthQWord),
16u,
ullQwordMax);
VERIFY_MAXOPERANDLENGTHANDVALUE_ARE_EQUALS(
m_CopyPasteManager->GetMaxOperandLengthAndValue(
ViewMode::Programmer, CategoryGroupType::None, NumberBase::HexBase, BitLength::BitLengthDWord),
m_CopyPasteManager->GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, NumberBase::HexBase, BitLength::BitLengthDWord),
8u,
ullDwordMax);
VERIFY_MAXOPERANDLENGTHANDVALUE_ARE_EQUALS(
m_CopyPasteManager->GetMaxOperandLengthAndValue(
ViewMode::Programmer, CategoryGroupType::None, NumberBase::HexBase, BitLength::BitLengthWord),
m_CopyPasteManager->GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, NumberBase::HexBase, BitLength::BitLengthWord),
4u,
ullWordMax);
VERIFY_MAXOPERANDLENGTHANDVALUE_ARE_EQUALS(
m_CopyPasteManager->GetMaxOperandLengthAndValue(
ViewMode::Programmer, CategoryGroupType::None, NumberBase::HexBase, BitLength::BitLengthByte),
m_CopyPasteManager->GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, NumberBase::HexBase, BitLength::BitLengthByte),
2u,
ullByteMax);
Logger::WriteMessage(L"Verify Programmer Mode NumberBase::DecBase maximum values");
VERIFY_MAXOPERANDLENGTHANDVALUE_ARE_EQUALS(
m_CopyPasteManager->GetMaxOperandLengthAndValue(
ViewMode::Programmer, CategoryGroupType::None, NumberBase::DecBase, BitLength::BitLengthQWord),
m_CopyPasteManager->GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, NumberBase::DecBase, BitLength::BitLengthQWord),
19u,
ullQwordMax >> 1);
VERIFY_MAXOPERANDLENGTHANDVALUE_ARE_EQUALS(
m_CopyPasteManager->GetMaxOperandLengthAndValue(
ViewMode::Programmer, CategoryGroupType::None, NumberBase::DecBase, BitLength::BitLengthDWord),
m_CopyPasteManager->GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, NumberBase::DecBase, BitLength::BitLengthDWord),
10u,
ullDwordMax >> 1);
VERIFY_MAXOPERANDLENGTHANDVALUE_ARE_EQUALS(
m_CopyPasteManager->GetMaxOperandLengthAndValue(
ViewMode::Programmer, CategoryGroupType::None, NumberBase::DecBase, BitLength::BitLengthWord),
m_CopyPasteManager->GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, NumberBase::DecBase, BitLength::BitLengthWord),
5u,
ullWordMax >> 1);
VERIFY_MAXOPERANDLENGTHANDVALUE_ARE_EQUALS(
m_CopyPasteManager->GetMaxOperandLengthAndValue(
ViewMode::Programmer, CategoryGroupType::None, NumberBase::DecBase, BitLength::BitLengthByte),
m_CopyPasteManager->GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, NumberBase::DecBase, BitLength::BitLengthByte),
3u,
ullByteMax >> 1);
Logger::WriteMessage(L"Verify Programmer Mode NumberBase::OctBase maximum values");
VERIFY_MAXOPERANDLENGTHANDVALUE_ARE_EQUALS(
m_CopyPasteManager->GetMaxOperandLengthAndValue(
ViewMode::Programmer, CategoryGroupType::None, NumberBase::OctBase, BitLength::BitLengthQWord),
m_CopyPasteManager->GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, NumberBase::OctBase, BitLength::BitLengthQWord),
22u,
ullQwordMax);
VERIFY_MAXOPERANDLENGTHANDVALUE_ARE_EQUALS(
m_CopyPasteManager->GetMaxOperandLengthAndValue(
ViewMode::Programmer, CategoryGroupType::None, NumberBase::OctBase, BitLength::BitLengthDWord),
m_CopyPasteManager->GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, NumberBase::OctBase, BitLength::BitLengthDWord),
11u,
ullDwordMax);
VERIFY_MAXOPERANDLENGTHANDVALUE_ARE_EQUALS(
m_CopyPasteManager->GetMaxOperandLengthAndValue(
ViewMode::Programmer, CategoryGroupType::None, NumberBase::OctBase, BitLength::BitLengthWord),
m_CopyPasteManager->GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, NumberBase::OctBase, BitLength::BitLengthWord),
6u,
ullWordMax);
VERIFY_MAXOPERANDLENGTHANDVALUE_ARE_EQUALS(
m_CopyPasteManager->GetMaxOperandLengthAndValue(
ViewMode::Programmer, CategoryGroupType::None, NumberBase::OctBase, BitLength::BitLengthByte),
m_CopyPasteManager->GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, NumberBase::OctBase, BitLength::BitLengthByte),
3u,
ullByteMax);
Logger::WriteMessage(L"Verify Programmer Mode NumberBase::BinBase maximum values");
VERIFY_MAXOPERANDLENGTHANDVALUE_ARE_EQUALS(
m_CopyPasteManager->GetMaxOperandLengthAndValue(
ViewMode::Programmer, CategoryGroupType::None, NumberBase::BinBase, BitLength::BitLengthQWord),
m_CopyPasteManager->GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, NumberBase::BinBase, BitLength::BitLengthQWord),
64u,
ullQwordMax);
VERIFY_MAXOPERANDLENGTHANDVALUE_ARE_EQUALS(
m_CopyPasteManager->GetMaxOperandLengthAndValue(
ViewMode::Programmer, CategoryGroupType::None, NumberBase::BinBase, BitLength::BitLengthDWord),
m_CopyPasteManager->GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, NumberBase::BinBase, BitLength::BitLengthDWord),
32u,
ullDwordMax);
VERIFY_MAXOPERANDLENGTHANDVALUE_ARE_EQUALS(
m_CopyPasteManager->GetMaxOperandLengthAndValue(
ViewMode::Programmer, CategoryGroupType::None, NumberBase::BinBase, BitLength::BitLengthWord),
m_CopyPasteManager->GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, NumberBase::BinBase, BitLength::BitLengthWord),
16u,
ullWordMax);
VERIFY_MAXOPERANDLENGTHANDVALUE_ARE_EQUALS(
m_CopyPasteManager->GetMaxOperandLengthAndValue(
ViewMode::Programmer, CategoryGroupType::None, NumberBase::BinBase, BitLength::BitLengthByte),
m_CopyPasteManager->GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, NumberBase::BinBase, BitLength::BitLengthByte),
8u,
ullByteMax);
Logger::WriteMessage(L"Verify invalid ViewModes/Categories return 0 for max values");
VERIFY_MAXOPERANDLENGTHANDVALUE_ARE_EQUALS(
m_CopyPasteManager->GetMaxOperandLengthAndValue(
ViewMode::None, CategoryGroupType::None, NumberBase::Unknown, BitLength::BitLengthUnknown),
m_CopyPasteManager->GetMaxOperandLengthAndValue(ViewMode::None, CategoryGroupType::None, NumberBase::Unknown, BitLength::BitLengthUnknown),
0u,
0ull);
};
@ -551,8 +525,7 @@ namespace CalculatorUnitTests
VERIFY_IS_NULL(CopyPasteManager::TryOperandToULL(L"0xFFFFFFFFFFFFFFFFF1", NumberBase::HexBase));
VERIFY_IS_NULL(CopyPasteManager::TryOperandToULL(L"18446744073709551616", NumberBase::DecBase));
VERIFY_IS_NULL(CopyPasteManager::TryOperandToULL(L"2000000000000000000000", NumberBase::OctBase));
VERIFY_IS_NULL(
CopyPasteManager::TryOperandToULL(L"11111111111111111111111111111111111111111111111111111111111111111", NumberBase::BinBase));
VERIFY_IS_NULL(CopyPasteManager::TryOperandToULL(L"11111111111111111111111111111111111111111111111111111111111111111", NumberBase::BinBase));
// Invalid values/characters
VERIFY_IS_NULL(CopyPasteManager::TryOperandToULL(L"-1", NumberBase::DecBase));
VERIFY_IS_NULL(CopyPasteManager::TryOperandToULL(L"5555", NumberBase::BinBase));
@ -827,12 +800,17 @@ namespace CalculatorUnitTests
L"61%99"
L"-6.1%99",
L"1.1111111111111111111111111111111e+1142" };
String
^ negativeInput[] = { L"abcdef", L"xyz", L"ABab", L"e+234", L"123456789123456781234567890123456" /*boundary condition: greater than 32 digits*/,
String ^ negativeInput[] = { L"abcdef",
L"xyz",
L"ABab",
L"e+234",
L"123456789123456781234567890123456" /*boundary condition: greater than 32 digits*/,
L"11.1111111111111111111111111111111e+1142",
L"1.1e+10001", /*boundary condition: exponent greater than 5 digits*/
L"0.11111111111111111111111111111111111e+111111" /*boundary condition: both exponent and non exponent exceed limits*/
L"SIN(2)", L"2+2==", L"2=+2" };
L"SIN(2)",
L"2+2==",
L"2=+2" };
ASSERT_POSITIVE_TESTCASES(ValidateScientificPasteExpression, positiveInput);
ASSERT_NEGATIVE_TESTCASES(ValidateScientificPasteExpression, negativeInput);
@ -1221,9 +1199,16 @@ namespace CalculatorUnitTests
void CopyPasteManagerTest::ValidateProgrammerOctPasteExpressionTest()
{
String ^ qwordPositiveInput[] = { L"123", L"123+456", L"1,234", L"1 2 3", L"1'2'3'4", L"1_2_3_4", L"\n\r1,234\n", L"\f\n1+2\t\r\v\x85",
L"\n 1+\n2 ", L"1\"2", L"(123)+(456)", L"0t1234", L"0T1234", L"0o1234", L"0O1234", L"1234u",
L"1234ul", L"1234ULL", L"2+2=", L"2+2= ",
String ^ qwordPositiveInput[] = { L"123", L"123+456",
L"1,234", L"1 2 3",
L"1'2'3'4", L"1_2_3_4",
L"\n\r1,234\n", L"\f\n1+2\t\r\v\x85",
L"\n 1+\n2 ", L"1\"2",
L"(123)+(456)", L"0t1234",
L"0T1234", L"0o1234",
L"0O1234", L"1234u",
L"1234ul", L"1234ULL",
L"2+2=", L"2+2= ",
L"127%71", L"1777777777777777777777" /*boundary condition: the max allowed number*/ };
String ^ qwordNegativeInput[] = { L"+123",
L"1.23",
@ -1514,11 +1499,9 @@ namespace CalculatorUnitTests
ASSERT_POSITIVE_TESTCASES(ValidateProgrammerBinWordPasteExpression, wordPositiveInput);
ASSERT_NEGATIVE_TESTCASES(ValidateProgrammerBinWordPasteExpression, wordNegativeInput);
String
^ bytePositiveInput[] = { L"100", L"100+101", L"1,001", L"1 0 1", L"1'0'0'1", L"1_0_0_1", L"\n\r1,010\n",
L"\n 1+\n1 ", L"1\"1", L"(101)+(10)", L"0b1001", L"0B1111", L"0y1001", L"0Y1001",
L"1100b", L"1101B", L"1111u", L"1111ul", L"1111ULL", L"10100010",
L"11111111" /*boundary condition: max allowed number*/ };
String ^ bytePositiveInput[] = { L"100", L"100+101", L"1,001", L"1 0 1", L"1'0'0'1", L"1_0_0_1", L"\n\r1,010\n", L"\n 1+\n1 ",
L"1\"1", L"(101)+(10)", L"0b1001", L"0B1111", L"0y1001", L"0Y1001", L"1100b", L"1101B",
L"1111u", L"1111ul", L"1111ULL", L"10100010", L"11111111" /*boundary condition: max allowed number*/ };
String ^ byteNegativeInput[] = { L"+10101",
L"1.01",
L"1''0",

View file

@ -380,11 +380,12 @@ TEST_METHOD(Load_Success_LoadedFromWeb)
}
;
TEST_CLASS(CurrencyConverterUnitTests){
TEST_CLASS(CurrencyConverterUnitTests)
{
const UCM::Category CURRENCY_CATEGORY = { NavCategory::Serialize(ViewMode::Currency), L"Currency", false /*supportsNegative*/ };
const UCM::Unit GetUnit(const vector<UCM::Unit>& unitList, const wstring& target){
const UCM::Unit GetUnit(const vector<UCM::Unit>& unitList, const wstring& target)
{
return *find_if(begin(unitList), end(unitList), [&target](const UCM::Unit& u) { return u.abbreviation == target; });
}
@ -624,6 +625,5 @@ TEST_METHOD(Test_RoundCurrencyRatio)
VERIFY_ARE_EQUAL(CurrencyDataLoader::RoundCurrencyRatio(0.000000002134987218), 0.000000002135);
VERIFY_ARE_EQUAL(CurrencyDataLoader::RoundCurrencyRatio(0.000000000000087231445), 0.00000000000008723);
}
}
;
};
}

View file

@ -411,124 +411,149 @@ namespace CalculatorFunctionalTests
Cleanup();
}
void HistoryStandardOrderOfOperations_1() {
void HistoryStandardOrderOfOperations_1()
{
Command commands[] = { Command::Command1, Command::CommandREC };
HistoryStandardOrderOfOperationsHelper(L"", L"", commands);
}
void HistoryStandardOrderOfOperations_2() {
void HistoryStandardOrderOfOperations_2()
{
Command commands[] = { Command::Command4, Command::CommandSQRT };
HistoryStandardOrderOfOperationsHelper(L"", L"", commands);
}
void HistoryStandardOrderOfOperations_3() {
void HistoryStandardOrderOfOperations_3()
{
Command commands[] = { Command::Command1, Command::CommandADD, Command::Command4, Command::CommandSQRT };
HistoryStandardOrderOfOperationsHelper(L"", L"", commands);
}
void HistoryStandardOrderOfOperations_4() {
void HistoryStandardOrderOfOperations_4()
{
Command commands[] = { Command::Command1, Command::CommandADD, Command::Command4, Command::CommandSQRT, Command::CommandSUB };
HistoryStandardOrderOfOperationsHelper(L"3", L"1 + \x221A( 4 ) =", commands);
}
void HistoryStandardOrderOfOperations_5() {
void HistoryStandardOrderOfOperations_5()
{
Command commands[] = { Command::Command2, Command::CommandMUL, Command::Command4, Command::CommandREC };
HistoryStandardOrderOfOperationsHelper(L"", L"", commands);
}
void HistoryStandardOrderOfOperations_6() {
void HistoryStandardOrderOfOperations_6()
{
Command commands[] = { Command::Command5, Command::CommandDIV, Command::Command6, Command::CommandPERCENT };
HistoryStandardOrderOfOperationsHelper(L"", L"", commands);
}
void HistoryStandardOrderOfOperations_7() {
void HistoryStandardOrderOfOperations_7()
{
Command commands[] = { Command::Command4, Command::CommandSQRT, Command::CommandSUB };
HistoryStandardOrderOfOperationsHelper(L"", L"", commands);
}
void HistoryStandardOrderOfOperations_8() {
void HistoryStandardOrderOfOperations_8()
{
Command commands[] = { Command::Command7, Command::CommandSQR, Command::CommandDIV };
HistoryStandardOrderOfOperationsHelper(L"", L"", commands);
}
void HistoryStandardOrderOfOperations_9() {
void HistoryStandardOrderOfOperations_9()
{
Command commands[] = { Command::Command8, Command::CommandSQR, Command::CommandSQRT };
HistoryStandardOrderOfOperationsHelper(L"", L"", commands);
}
void HistoryStandardOrderOfOperations_10() {
void HistoryStandardOrderOfOperations_10()
{
Command commands[] = { Command::Command1, Command::Command0, Command::CommandADD, Command::Command2, Command::CommandSUB };
HistoryStandardOrderOfOperationsHelper(L"12", L"10 + 2 =", commands);
}
void HistoryStandardOrderOfOperations_11() {
void HistoryStandardOrderOfOperations_11()
{
Command commands[] = { Command::Command3, Command::CommandMUL, Command::Command4, Command::CommandDIV };
HistoryStandardOrderOfOperationsHelper(L"12", L"3 \x00D7 4 =", commands);
}
void HistoryStandardOrderOfOperations_12() {
void HistoryStandardOrderOfOperations_12()
{
Command commands[] = { Command::Command6, Command::CommandDIV, Command::Command3, Command::CommandSUB, Command::CommandADD };
HistoryStandardOrderOfOperationsHelper(L"2", L"6 \x00F7 3 =", commands);
}
void HistoryStandardOrderOfOperations_13() {
void HistoryStandardOrderOfOperations_13()
{
Command commands[] = { Command::Command7, Command::CommandSUB, Command::Command4, Command::CommandDIV, Command::CommandMUL };
HistoryStandardOrderOfOperationsHelper(L"3", L"7 - 4 =", commands);
}
void HistoryStandardOrderOfOperations_14() {
void HistoryStandardOrderOfOperations_14()
{
Command commands[] = { Command::Command8, Command::CommandMUL, Command::Command2, Command::CommandADD, Command::CommandSQRT };
HistoryStandardOrderOfOperationsHelper(L"16", L"8 \x00D7 2 =", commands);
}
void HistoryStandardOrderOfOperations_15() {
void HistoryStandardOrderOfOperations_15()
{
Command commands[] = { Command::Command9, Command::CommandADD, Command::Command0, Command::CommandMUL, Command::CommandSIGN };
HistoryStandardOrderOfOperationsHelper(L"9", L"9 + 0 =", commands);
}
void HistoryStandardOrderOfOperations_16() {
void HistoryStandardOrderOfOperations_16()
{
Command commands[] = { Command::Command9, Command::CommandSIGN, Command::Command0, Command::CommandADD, Command::CommandMUL };
HistoryStandardOrderOfOperationsHelper(L"", L"", commands);
}
void HistoryStandardOrderOfOperations_17() {
void HistoryStandardOrderOfOperations_17()
{
Command commands[] = { Command::Command1, Command::CommandADD, Command::Command2, Command::CommandEQU };
HistoryStandardOrderOfOperationsHelper(L"3", L"1 + 2 =", commands);
}
void HistoryStandardOrderOfOperations_18() {
void HistoryStandardOrderOfOperations_18()
{
Command commands[] = { Command::Command2, Command::Command0, Command::CommandMUL, Command::Command0, Command::Command2, Command::CommandEQU };
HistoryStandardOrderOfOperationsHelper(L"40", L"20 \x00D7 2 =", commands);
}
void HistoryStandardOrderOfOperations_19() {
void HistoryStandardOrderOfOperations_19()
{
Command commands[] = { Command::Command1, Command::CommandADD, Command::Command2, Command::CommandADD, Command::CommandBACK };
HistoryStandardOrderOfOperationsHelper(L"3", L"1 + 2 =", commands);
}
void HistoryStandardOrderOfOperations_20() {
void HistoryStandardOrderOfOperations_20()
{
Command commands[] = { Command::Command1, Command::CommandADD, Command::Command2, Command::CommandADD, Command::CommandCLEAR };
HistoryStandardOrderOfOperationsHelper(L"3", L"1 + 2 =", commands);
}
void HistoryStandardOrderOfOperations_21() {
void HistoryStandardOrderOfOperations_21()
{
Command commands[] = { Command::Command1, Command::CommandADD, Command::Command2, Command::CommandADD, Command::CommandCENTR };
HistoryStandardOrderOfOperationsHelper(L"3", L"1 + 2 =", commands);
}
void HistoryStandardOrderOfOperations_22() {
void HistoryStandardOrderOfOperations_22()
{
Command commands[] = { Command::Command1, Command::CommandADD, Command::Command2, Command::CommandCLEAR };
HistoryStandardOrderOfOperationsHelper(L"", L"", commands);
}
void HistoryStandardOrderOfOperations_23() {
void HistoryStandardOrderOfOperations_23()
{
Command commands[] = { Command::Command1, Command::CommandADD, Command::Command2, Command::CommandCENTR };
HistoryStandardOrderOfOperationsHelper(L"", L"", commands);
}
void HistoryStandardOrderOfOperationsMultiple() {
void HistoryStandardOrderOfOperationsMultiple()
{
Initialize();
Command commands[] = { Command::Command1, Command::CommandMUL, Command::Command2, Command::CommandMUL, Command::Command3, Command::CommandMUL, Command::Command4, Command::CommandMUL, Command::Command5, Command::CommandMUL };
Command commands[] = { Command::Command1, Command::CommandMUL, Command::Command2, Command::CommandMUL, Command::Command3,
Command::CommandMUL, Command::Command4, Command::CommandMUL, Command::Command5, Command::CommandMUL };
int initialSize = m_historyViewModel->ItemsCount;
Command* currentCommand = commands;
while (*currentCommand != Command::CommandNULL)
@ -613,99 +638,123 @@ namespace CalculatorFunctionalTests
HistoryClearCommandWithEmptyHistory();
}
void HistoryTests::TestHistoryStandardOrderOfOperations_1(){
void HistoryTests::TestHistoryStandardOrderOfOperations_1()
{
HistoryStandardOrderOfOperations_1();
}
void HistoryTests::TestHistoryStandardOrderOfOperations_2(){
void HistoryTests::TestHistoryStandardOrderOfOperations_2()
{
HistoryStandardOrderOfOperations_2();
}
void HistoryTests::TestHistoryStandardOrderOfOperations_3(){
void HistoryTests::TestHistoryStandardOrderOfOperations_3()
{
HistoryStandardOrderOfOperations_3();
}
void HistoryTests::TestHistoryStandardOrderOfOperations_4(){
void HistoryTests::TestHistoryStandardOrderOfOperations_4()
{
HistoryStandardOrderOfOperations_4();
}
void HistoryTests::TestHistoryStandardOrderOfOperations_5(){
void HistoryTests::TestHistoryStandardOrderOfOperations_5()
{
HistoryStandardOrderOfOperations_5();
}
void HistoryTests::TestHistoryStandardOrderOfOperations_6(){
void HistoryTests::TestHistoryStandardOrderOfOperations_6()
{
HistoryStandardOrderOfOperations_6();
}
void HistoryTests::TestHistoryStandardOrderOfOperations_7(){
void HistoryTests::TestHistoryStandardOrderOfOperations_7()
{
HistoryStandardOrderOfOperations_7();
}
void HistoryTests::TestHistoryStandardOrderOfOperations_8(){
void HistoryTests::TestHistoryStandardOrderOfOperations_8()
{
HistoryStandardOrderOfOperations_8();
}
void HistoryTests::TestHistoryStandardOrderOfOperations_9(){
void HistoryTests::TestHistoryStandardOrderOfOperations_9()
{
HistoryStandardOrderOfOperations_9();
}
void HistoryTests::TestHistoryStandardOrderOfOperations_10(){
void HistoryTests::TestHistoryStandardOrderOfOperations_10()
{
HistoryStandardOrderOfOperations_10();
}
void HistoryTests::TestHistoryStandardOrderOfOperations_11(){
void HistoryTests::TestHistoryStandardOrderOfOperations_11()
{
HistoryStandardOrderOfOperations_11();
}
void HistoryTests::TestHistoryStandardOrderOfOperations_12(){
void HistoryTests::TestHistoryStandardOrderOfOperations_12()
{
HistoryStandardOrderOfOperations_12();
}
void HistoryTests::TestHistoryStandardOrderOfOperations_13(){
void HistoryTests::TestHistoryStandardOrderOfOperations_13()
{
HistoryStandardOrderOfOperations_13();
}
void HistoryTests::TestHistoryStandardOrderOfOperations_14(){
void HistoryTests::TestHistoryStandardOrderOfOperations_14()
{
HistoryStandardOrderOfOperations_14();
}
void HistoryTests::TestHistoryStandardOrderOfOperations_15(){
void HistoryTests::TestHistoryStandardOrderOfOperations_15()
{
HistoryStandardOrderOfOperations_15();
}
void HistoryTests::TestHistoryStandardOrderOfOperations_16(){
void HistoryTests::TestHistoryStandardOrderOfOperations_16()
{
HistoryStandardOrderOfOperations_16();
}
void HistoryTests::TestHistoryStandardOrderOfOperations_17(){
void HistoryTests::TestHistoryStandardOrderOfOperations_17()
{
HistoryStandardOrderOfOperations_17();
}
void HistoryTests::TestHistoryStandardOrderOfOperations_18(){
void HistoryTests::TestHistoryStandardOrderOfOperations_18()
{
HistoryStandardOrderOfOperations_18();
}
void HistoryTests::TestHistoryStandardOrderOfOperations_19(){
void HistoryTests::TestHistoryStandardOrderOfOperations_19()
{
HistoryStandardOrderOfOperations_19();
}
void HistoryTests::TestHistoryStandardOrderOfOperations_20(){
void HistoryTests::TestHistoryStandardOrderOfOperations_20()
{
HistoryStandardOrderOfOperations_20();
}
void HistoryTests::TestHistoryStandardOrderOfOperations_21(){
void HistoryTests::TestHistoryStandardOrderOfOperations_21()
{
HistoryStandardOrderOfOperations_21();
}
void HistoryTests::TestHistoryStandardOrderOfOperations_22(){
void HistoryTests::TestHistoryStandardOrderOfOperations_22()
{
HistoryStandardOrderOfOperations_22();
}
void HistoryTests::TestHistoryStandardOrderOfOperations_23(){
void HistoryTests::TestHistoryStandardOrderOfOperations_23()
{
HistoryStandardOrderOfOperations_23();
}
void HistoryTests::TestHistoryStandardOrderOfOperationsMultiple(){
void HistoryTests::TestHistoryStandardOrderOfOperationsMultiple()
{
HistoryStandardOrderOfOperationsMultiple();
}
}

View file

@ -14,37 +14,15 @@ using namespace Microsoft::VisualStudio::CppUnitTestFramework;
namespace CalculatorUnitTests
{
TEST_CLASS(LocalizationServiceUnitTests)
{
public:
TEST_CLASS(LocalizationServiceUnitTests){ public:
TEST_METHOD(TestSortStrings)
{
auto localizationService = LocalizationService::GetInstance();
vector<String^> stringsToSort =
{
L"Zebra",
L"Alpha",
L"beta1",
L"Gamma",
L"Beta",
L"alpha1",
L"États-Unis",
L"Epsilon",
L"Etude",
TEST_METHOD(TestSortStrings){ auto localizationService = LocalizationService::GetInstance();
vector<String ^> stringsToSort = {
L"Zebra", L"Alpha", L"beta1", L"Gamma", L"Beta", L"alpha1", L"États-Unis", L"Epsilon", L"Etude",
};
vector<String^> expectedResult =
{
L"Alpha",
L"alpha1",
L"Beta",
L"beta1",
L"Epsilon",
L"États-Unis",
L"Etude",
L"Gamma",
L"Zebra",
vector<String ^> expectedResult = {
L"Alpha", L"alpha1", L"Beta", L"beta1", L"Epsilon", L"États-Unis", L"Etude", L"Gamma", L"Zebra",
};
VERIFY_ARE_EQUAL(stringsToSort.size(), expectedResult.size());
VERIFY_IS_FALSE(equal(stringsToSort.begin(), stringsToSort.end(), expectedResult.begin()));
@ -68,42 +46,17 @@ namespace CalculatorUnitTests
TEST_METHOD(TestSortGeneric)
{
vector<String^> stringsToSort =
{
L"fermentum",
L"fringilla",
L"Curabitur",
L"rhoncus",
L"Aenean",
L"Fusce",
L"sollicitudin",
L"empor",
L"edapibus",
L"édapibas",
L"édapîbos",
L"édapîbÉs",
vector<String ^> stringsToSort = {
L"fermentum", L"fringilla", L"Curabitur", L"rhoncus", L"Aenean", L"Fusce",
L"sollicitudin", L"empor", L"edapibus", L"édapibas", L"édapîbos", L"édapîbÉs",
};
vector<String^> expectedResult =
{
L"Aenean",
L"Curabitur",
L"édapibas",
L"édapîbÉs",
L"édapîbos",
L"edapibus",
L"empor",
L"fermentum",
L"fringilla",
L"Fusce",
L"rhoncus",
L"sollicitudin",
vector<String ^> expectedResult = {
L"Aenean", L"Curabitur", L"édapibas", L"édapîbÉs", L"édapîbos", L"edapibus",
L"empor", L"fermentum", L"fringilla", L"Fusce", L"rhoncus", L"sollicitudin",
};
auto sortFunction = [](String^ s) {
return ref new String(L"CAL:") + s + L"TEST";
};
auto sortFunction = [](String ^ s) { return ref new String(L"CAL:") + s + L"TEST"; };
VERIFY_ARE_EQUAL(stringsToSort.size(), expectedResult.size());
VERIFY_IS_FALSE(equal(stringsToSort.begin(), stringsToSort.end(), expectedResult.begin()));
@ -112,32 +65,19 @@ namespace CalculatorUnitTests
localizationService->Sort<String ^>(stringsToSort, sortFunction);
VERIFY_IS_TRUE(equal(stringsToSort.begin(), stringsToSort.end(), expectedResult.begin()));
vector<String^> expected2Result =
{
L"édapibas",
L"édapîbÉs",
L"édapîbos",
L"edapibus",
L"Aenean",
L"fermentum",
L"rhoncus",
L"empor",
L"sollicitudin",
L"fringilla",
L"Curabitur",
L"Fusce",
vector<String ^> expected2Result = {
L"édapibas", L"édapîbÉs", L"édapîbos", L"edapibus", L"Aenean", L"fermentum",
L"rhoncus", L"empor", L"sollicitudin", L"fringilla", L"Curabitur", L"Fusce",
};
auto sort2Function = [](String^ s) {
return ref new String(s->Begin()+1);
};
auto sort2Function = [](String ^ s) { return ref new String(s->Begin() + 1); };
VERIFY_ARE_EQUAL(stringsToSort.size(), expected2Result.size());
VERIFY_IS_FALSE(equal(stringsToSort.begin(), stringsToSort.end(), expected2Result.begin()));
localizationService->Sort<String ^>(stringsToSort, sort2Function);
VERIFY_IS_TRUE(equal(stringsToSort.begin(), stringsToSort.end(), expected2Result.begin()));
}
};
}
;
}

View file

@ -18,12 +18,7 @@ static Windows::Globalization::NumberFormatting::DecimalFormatter ^ CreateDecima
namespace CalculatorUnitTests
{
TEST_CLASS(LocalizationSettingsUnitTests)
{
public:
TEST_METHOD(TestLocaleName)
{
auto formatter = CreateDecimalFormatter(L"en-US", L"US");
TEST_CLASS(LocalizationSettingsUnitTests){ public: TEST_METHOD(TestLocaleName){ auto formatter = CreateDecimalFormatter(L"en-US", L"US");
LocalizationSettings settings(formatter);
VERIFY_ARE_EQUAL(L"en-US", settings.GetLocaleName());
}
@ -89,5 +84,6 @@ namespace CalculatorUnitTests
LocalizationSettings settings(formatter);
VERIFY_ARE_EQUAL(L"1000000", settings.RemoveGroupSeparators(L"1,000 000"));
}
};
}
;
}

View file

@ -4,12 +4,10 @@
#include <CppUnitTest.h>
using namespace Windows::UI::Xaml::Automation::Peers;
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
using namespace CalculatorApp::Common::Automation;
namespace CalculatorUnitTests
{
TEST_CLASS(NarratorAnnouncementUnitTests)
@ -183,10 +181,3 @@ namespace CalculatorUnitTests
const Platform::StringReference NarratorAnnouncementUnitTests::m_testAnnouncement(L"TestAnnouncement");
}

View file

@ -586,8 +586,7 @@ namespace CalculatorUnitTests
VERIFY_ARE_EQUAL(m_viewModel->DecimalDisplayValue, StringReference(L"-2"));
VERIFY_ARE_EQUAL(m_viewModel->OctalDisplayValue, StringReference(L"1 777 777 777 777 777 777 776"));
VERIFY_ARE_EQUAL(
m_viewModel->BinaryDisplayValue,
StringReference(L"1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1110"));
m_viewModel->BinaryDisplayValue, StringReference(L"1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1110"));
VERIFY_ARE_EQUAL(m_viewModel->DisplayValue, StringReference(L"-2"));
auto val = ref new Platform::Collections::Vector<bool>(64, true);
val->SetAt(0, false);

View file

@ -293,7 +293,6 @@ namespace UnitConverterUnitTests
VERIFY_IS_TRUE(s_testVMCallback->CheckSuggestedValues(vector<tuple<wstring, Unit>>(begin(test2), end(test2))));
}
// Verify a basic copy paste steam. '20.43' with backspace button pressed
void UnitConverterTest::UnitConverterTestBackspaceBasic()
{
@ -360,7 +359,6 @@ namespace UnitConverterUnitTests
VERIFY_IS_TRUE(s_testVMCallback->CheckSuggestedValues(vector<tuple<wstring, Unit>>()));
}
// Test input escaping
void UnitConverterTest::UnitConverterTestQuote()
{

View file

@ -123,8 +123,8 @@ namespace GraphControl
HRESULT hr;
// Reset the Grid using the m_initialDisplayRange properties when the user was last in Manual Adjustment mode and an equation was added.
// Reset the Grid using the TryPlotGraph method when the range is updated via Graph Settings. Return out of this block so we don't render 2 times.
// Reset the Grid using the ResetRange() in all other cases.
// Reset the Grid using the TryPlotGraph method when the range is updated via Graph Settings. Return out of this block so we don't render 2
// times. Reset the Grid using the ResetRange() in all other cases.
if (m_resetUsingInitialDisplayRange)
{
hr = renderer->SetDisplayRanges(m_initialDisplayRangeXMin, m_initialDisplayRangeXMax, m_initialDisplayRangeYMin, m_initialDisplayRangeYMax);
@ -1123,7 +1123,8 @@ optional<vector<shared_ptr<Graphing::IEquation>>> Grapher::TryInitializeGraph(bo
{
if (IsKeepCurrentView)
{
// PrepareGraph() populates the values of the graph after TryInitialize but before rendering. This allows us to get the range of the graph to be rendered.
// PrepareGraph() populates the values of the graph after TryInitialize but before rendering. This allows us to get the range of the graph to be
// rendered.
if (SUCCEEDED(renderer->PrepareGraph()))
{
// Get the initial display ranges from the graph that was just initialized to be used in ResetGrid if they user clicks the GraphView button.

View file

@ -82,7 +82,6 @@ public enum class GraphViewChangedReason
void ZoomFromCenter(double scale);
void ResetGrid();
property Windows::Foundation::Point TraceLocation
{
Windows::Foundation::Point get()

View file

@ -254,8 +254,7 @@ namespace GraphControl::DX
lround(m_d3dRenderTargetSize.Width),
lround(m_d3dRenderTargetSize.Height),
DXGI_FORMAT_B8G8R8A8_UNORM,
0
);
0);
if (hr == DXGI_ERROR_DEVICE_REMOVED || hr == DXGI_ERROR_DEVICE_RESET)
{
@ -533,8 +532,7 @@ namespace GraphControl::DX
// This method is called in the event handler for the CompositionScaleChanged event.
void DeviceResources::SetCompositionScale(float compositionScaleX, float compositionScaleY)
{
if (m_compositionScaleX != compositionScaleX ||
m_compositionScaleY != compositionScaleY)
if (m_compositionScaleX != compositionScaleX || m_compositionScaleY != compositionScaleY)
{
m_compositionScaleX = compositionScaleX;
m_compositionScaleY = compositionScaleY;

View file

@ -152,6 +152,7 @@ namespace GraphControl::DX
void OnSizeChanged(Platform::Object ^ sender, Windows::UI::Xaml::SizeChangedEventArgs ^ e);
double GetPrecision(const double maxAxis, const double minAxis);
private:
DX::DeviceResources m_deviceResources;
NearestPointRenderer m_nearestPointRenderer;
@ -191,7 +192,6 @@ namespace GraphControl::DX
double m_XTraceValue;
double m_YTraceValue;
// And where is it located on screen
Windows::Foundation::Point m_TraceLocation;

View file

@ -158,7 +158,8 @@ public
{
auto equation = static_cast<Equation ^>(sender);
auto propertyName = args->PropertyName;
if (propertyName == GraphControl::Equation::LineColorPropertyName || propertyName == GraphControl::Equation::IsSelectedPropertyName || propertyName == GraphControl::Equation::EquationStylePropertyName)
if (propertyName == GraphControl::Equation::LineColorPropertyName || propertyName == GraphControl::Equation::IsSelectedPropertyName
|| propertyName == GraphControl::Equation::EquationStylePropertyName)
{
EquationStyleChanged(equation);
}

View file

@ -4,7 +4,6 @@
#pragma once
#include "Utils.h"
namespace Graphing
{
struct IGraphFunctionAnalysisData;
@ -17,7 +16,6 @@ namespace CalculatorApp
namespace GraphControl
{
public
ref class KeyGraphFeaturesInfo sealed
{

View file

@ -25,7 +25,6 @@
#include <map>
#include <type_traits>
// DirectX headers
#include <d2d1_3.h>
#include <d3d11_4.h>

View file

@ -109,7 +109,6 @@ namespace MockGraphingImpl
return S_OK;
}
private:
double m_xMin;
double m_xMax;

View file

@ -23,7 +23,18 @@ namespace Graphing::Renderer
virtual HRESULT SetDpi(float dpiX, float dpiY) = 0;
virtual HRESULT DrawD2D1(ID2D1Factory* pDirect2dFactory, ID2D1RenderTarget* pRenderTarget, bool& hasSomeMissingDataOut) = 0;
virtual HRESULT GetClosePointData(double inScreenPointX, double inScreenPointY, double precision, int& formulaIdOut, float& xScreenPointOut, float& yScreenPointOut, double& xValueOut, double& yValueOut, double& rhoValueOut, double& thetaValueOut, double& tValueOut) = 0;
virtual HRESULT GetClosePointData(
double inScreenPointX,
double inScreenPointY,
double precision,
int& formulaIdOut,
float& xScreenPointOut,
float& yScreenPointOut,
double& xValueOut,
double& yValueOut,
double& rhoValueOut,
double& thetaValueOut,
double& tValueOut) = 0;
virtual HRESULT ScaleRange(double centerX, double centerY, double scale) = 0;
virtual HRESULT ChangeRange(ChangeRangeAction action) = 0;

View file

@ -6,7 +6,7 @@
using namespace TraceLogging;
using namespace std;
using namespace Platform;;
using namespace Platform;
using namespace Windows::Foundation;
using namespace Windows::Foundation::Diagnostics;

View file

@ -23,7 +23,6 @@ namespace TraceLogging
private:
TraceLoggingCommon();
Windows::Foundation::Diagnostics::LoggingChannel ^ g_calculatorProvider;
Windows::Foundation::Diagnostics::LoggingActivity ^ m_appLaunchActivity;
GUID sessionGuid;