mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-22 06:13:14 -07:00
Build with /w4
This commit is contained in:
parent
f09258375e
commit
89cef60d9e
11 changed files with 79 additions and 64 deletions
|
@ -118,17 +118,17 @@ void CalculationResult::OnTextContainerLayoutUpdated(Object^ /*sender*/, Object^
|
|||
}
|
||||
}
|
||||
|
||||
void CalculationResult::TextContainerSizeChanged(Object^ sender, SizeChangedEventArgs^ /*e*/)
|
||||
void CalculationResult::TextContainerSizeChanged(Object^ /*sender*/, SizeChangedEventArgs^ /*e*/)
|
||||
{
|
||||
UpdateTextState();
|
||||
}
|
||||
|
||||
void CalculationResult::OnIsActivePropertyChanged(bool /*oldValue*/, bool newValue)
|
||||
void CalculationResult::OnIsActivePropertyChanged(bool /*oldValue*/, bool /*newValue */)
|
||||
{
|
||||
UpdateVisualState();
|
||||
}
|
||||
|
||||
void CalculationResult::OnAccentColorPropertyChanged(Brush^ oldValue, Brush^ newValue)
|
||||
void CalculationResult::OnAccentColorPropertyChanged(Brush^ /*oldValue*/, Brush^ /*newValue*/)
|
||||
{
|
||||
// Force the "Active" transition to happen again
|
||||
if (IsActive)
|
||||
|
|
|
@ -277,7 +277,7 @@ void Calculator::OnLayoutStateChanged(_In_ Object^ sender, _In_ Object^ e)
|
|||
UpdatePanelViewState();
|
||||
}
|
||||
|
||||
void Calculator::OnIsStandardPropertyChanged(bool /*oldValue*/, bool newValue)
|
||||
void Calculator::OnIsStandardPropertyChanged(bool /*oldValue*/, bool /*newValue*/)
|
||||
{
|
||||
UpdateViewState();
|
||||
UpdatePanelViewState();
|
||||
|
|
|
@ -102,7 +102,7 @@ void DateCalculator::FromDate_DateChanged(_In_ CalendarDatePicker^ sender, _In_
|
|||
{
|
||||
auto dateCalcViewModel = safe_cast<DateCalculatorViewModel^>(this->DataContext);
|
||||
dateCalcViewModel->FromDate = e->NewDate->Value;
|
||||
TraceLogger::GetInstance().LogDateDifferenceModeUsed(ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread()));
|
||||
TraceLogger::GetInstance().LogDateDifferenceModeUsed();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -116,7 +116,7 @@ void DateCalculator::ToDate_DateChanged(_In_ CalendarDatePicker^ sender, _In_ Ca
|
|||
{
|
||||
auto dateCalcViewModel = safe_cast<DateCalculatorViewModel^>(this->DataContext);
|
||||
dateCalcViewModel->ToDate = e->NewDate->Value;
|
||||
TraceLogger::GetInstance().LogDateDifferenceModeUsed(ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread()));
|
||||
TraceLogger::GetInstance().LogDateDifferenceModeUsed();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -31,18 +31,18 @@ namespace CalculatorUnitTests
|
|||
m_calcInput.TryBeginExponent();
|
||||
m_calcInput.TryAddDigit(3, 10, false, L"999", 64, 32);
|
||||
|
||||
VERIFY_ARE_EQUAL(L"-1.2e+3", m_calcInput.ToString(10, false), L"Verify input is correct.");
|
||||
VERIFY_ARE_EQUAL(L"-1.2e+3", m_calcInput.ToString(10), L"Verify input is correct.");
|
||||
|
||||
m_calcInput.Clear();
|
||||
|
||||
::Logger::WriteMessage(m_calcInput.ToString(10, false).c_str());
|
||||
VERIFY_ARE_EQUAL(L"0", m_calcInput.ToString(10, false), L"Verify input is 0 after clear.");
|
||||
::Logger::WriteMessage(m_calcInput.ToString(10).c_str());
|
||||
VERIFY_ARE_EQUAL(L"0", m_calcInput.ToString(10), L"Verify input is 0 after clear.");
|
||||
}
|
||||
|
||||
TEST_METHOD(TryToggleSignZero)
|
||||
{
|
||||
VERIFY_IS_TRUE(m_calcInput.TryToggleSign(false, L"999"), L"Verify toggling 0 succeeds.");
|
||||
VERIFY_ARE_EQUAL(L"0", m_calcInput.ToString(10, false), L"Verify toggling 0 does not create -0.");
|
||||
VERIFY_ARE_EQUAL(L"0", m_calcInput.ToString(10), L"Verify toggling 0 does not create -0.");
|
||||
}
|
||||
TEST_METHOD(TryToggleSignExponent)
|
||||
{
|
||||
|
@ -50,23 +50,23 @@ namespace CalculatorUnitTests
|
|||
m_calcInput.TryBeginExponent();
|
||||
m_calcInput.TryAddDigit(2, 10, false, L"999", 64, 32);
|
||||
VERIFY_IS_TRUE(m_calcInput.TryToggleSign(false, L"999"), L"Verify toggling exponent sign succeeds.");
|
||||
VERIFY_ARE_EQUAL(L"1.e-2", m_calcInput.ToString(10, false), L"Verify toggling exponent sign does not toggle base sign.");
|
||||
VERIFY_ARE_EQUAL(L"1.e-2", m_calcInput.ToString(10), L"Verify toggling exponent sign does not toggle base sign.");
|
||||
VERIFY_IS_TRUE(m_calcInput.TryToggleSign(false, L"999"), L"Verify toggling exponent sign succeeds.");
|
||||
VERIFY_ARE_EQUAL(L"1.e+2", m_calcInput.ToString(10, false), L"Verify toggling negative exponent sign does not toggle base sign.");
|
||||
VERIFY_ARE_EQUAL(L"1.e+2", m_calcInput.ToString(10), L"Verify toggling negative exponent sign does not toggle base sign.");
|
||||
}
|
||||
TEST_METHOD(TryToggleSignBase)
|
||||
{
|
||||
m_calcInput.TryAddDigit(1, 10, false, L"999", 64, 32);
|
||||
VERIFY_IS_TRUE(m_calcInput.TryToggleSign(false, L"999"), L"Verify toggling base sign succeeds.");
|
||||
VERIFY_ARE_EQUAL(L"-1", m_calcInput.ToString(10, false), L"Verify toggling base sign creates negative base.");
|
||||
VERIFY_ARE_EQUAL(L"-1", m_calcInput.ToString(10), L"Verify toggling base sign creates negative base.");
|
||||
VERIFY_IS_TRUE(m_calcInput.TryToggleSign(false, L"999"), L"Verify toggling base sign succeeds.");
|
||||
VERIFY_ARE_EQUAL(L"1", m_calcInput.ToString(10, false), L"Verify toggling negative base sign creates positive base.");
|
||||
VERIFY_ARE_EQUAL(L"1", m_calcInput.ToString(10), L"Verify toggling negative base sign creates positive base.");
|
||||
}
|
||||
TEST_METHOD(TryToggleSignBaseIntegerMode)
|
||||
{
|
||||
m_calcInput.TryAddDigit(1, 10, false, L"999", 64, 32);
|
||||
VERIFY_IS_TRUE(m_calcInput.TryToggleSign(true, L"999"), L"Verify toggling base sign in integer mode succeeds.");
|
||||
VERIFY_ARE_EQUAL(L"-1", m_calcInput.ToString(10, false), L"Verify toggling base sign creates negative base.");
|
||||
VERIFY_ARE_EQUAL(L"-1", m_calcInput.ToString(10), L"Verify toggling base sign creates negative base.");
|
||||
}
|
||||
TEST_METHOD(TryToggleSignRollover)
|
||||
{
|
||||
|
@ -75,7 +75,7 @@ namespace CalculatorUnitTests
|
|||
VERIFY_IS_TRUE(m_calcInput.TryToggleSign(true, L"127"), L"Verify toggling base sign in integer mode succeeds.");
|
||||
m_calcInput.TryAddDigit(8, 10, false, L"999", 64, 32);
|
||||
VERIFY_IS_FALSE(m_calcInput.TryToggleSign(true, L"127"), L"Verify toggling base sign in integer mode fails on rollover.");
|
||||
VERIFY_ARE_EQUAL(L"-128", m_calcInput.ToString(10, false), L"Verify toggling base sign on rollover does not change value.");
|
||||
VERIFY_ARE_EQUAL(L"-128", m_calcInput.ToString(10), L"Verify toggling base sign on rollover does not change value.");
|
||||
}
|
||||
|
||||
TEST_METHOD(TryAddDigitLeadingZeroes)
|
||||
|
@ -83,26 +83,26 @@ namespace CalculatorUnitTests
|
|||
VERIFY_IS_TRUE(m_calcInput.TryAddDigit(0, 10, false, L"999", 64, 32), L"Verify TryAddDigit succeeds.");
|
||||
VERIFY_IS_TRUE(m_calcInput.TryAddDigit(0, 10, false, L"999", 64, 32), L"Verify TryAddDigit succeeds.");
|
||||
VERIFY_IS_TRUE(m_calcInput.TryAddDigit(0, 10, false, L"999", 64, 32), L"Verify TryAddDigit succeeds.");
|
||||
VERIFY_ARE_EQUAL(L"0", m_calcInput.ToString(10, false), L"Verify leading zeros are ignored.");
|
||||
VERIFY_ARE_EQUAL(L"0", m_calcInput.ToString(10), L"Verify leading zeros are ignored.");
|
||||
}
|
||||
TEST_METHOD(TryAddDigitMaxCount)
|
||||
{
|
||||
VERIFY_IS_TRUE(m_calcInput.TryAddDigit(1, 10, false, L"999", 64, 32), L"Verify TryAddDigit for base with length < maxDigits succeeds.");
|
||||
VERIFY_ARE_EQUAL(L"1", m_calcInput.ToString(10, false), L"Verify adding digit for base with length < maxDigits succeeded.");
|
||||
VERIFY_ARE_EQUAL(L"1", m_calcInput.ToString(10), L"Verify adding digit for base with length < maxDigits succeeded.");
|
||||
VERIFY_IS_FALSE(m_calcInput.TryAddDigit(2, 10, false, L"999", 64, 1), L"Verify TryAddDigit for base with length > maxDigits fails.");
|
||||
VERIFY_ARE_EQUAL(L"1", m_calcInput.ToString(10, false), L"Verify digit for base was not added.");
|
||||
VERIFY_ARE_EQUAL(L"1", m_calcInput.ToString(10), L"Verify digit for base was not added.");
|
||||
m_calcInput.TryBeginExponent();
|
||||
VERIFY_IS_TRUE(m_calcInput.TryAddDigit(1, 10, false, L"999", 64, 32), L"Verify TryAddDigit for exponent with length < maxDigits succeeds.");
|
||||
VERIFY_IS_TRUE(m_calcInput.TryAddDigit(2, 10, false, L"999", 64, 32), L"Verify TryAddDigit for exponent with length < maxDigits succeeds.");
|
||||
VERIFY_IS_TRUE(m_calcInput.TryAddDigit(3, 10, false, L"999", 64, 32), L"Verify TryAddDigit for exponent with length < maxDigits succeeds.");
|
||||
VERIFY_IS_TRUE(m_calcInput.TryAddDigit(4, 10, false, L"999", 64, 32), L"Verify TryAddDigit for exponent with length < maxDigits succeeds.");
|
||||
VERIFY_IS_FALSE(m_calcInput.TryAddDigit(5, 10, false, L"999", 64, 32), L"Verify TryAddDigit for exponent with length > maxDigits fails.");
|
||||
VERIFY_ARE_EQUAL(L"1.e+1234", m_calcInput.ToString(10, false), L"Verify adding digits for exponent with length < maxDigits succeeded.");
|
||||
VERIFY_ARE_EQUAL(L"1.e+1234", m_calcInput.ToString(10), L"Verify adding digits for exponent with length < maxDigits succeeded.");
|
||||
|
||||
m_calcInput.Clear();
|
||||
m_calcInput.TryAddDecimalPt();
|
||||
VERIFY_IS_TRUE(m_calcInput.TryAddDigit(1, 10, false, L"999", 64, 1), L"Verify decimal point and leading zero does not count toward maxDigits.");
|
||||
VERIFY_ARE_EQUAL(L"0.1", m_calcInput.ToString(10, false), L"Verify input value checking dec pt and leading zero impact on maxDigits.");
|
||||
VERIFY_ARE_EQUAL(L"0.1", m_calcInput.ToString(10), L"Verify input value checking dec pt and leading zero impact on maxDigits.");
|
||||
}
|
||||
TEST_METHOD(TryAddDigitValues)
|
||||
{
|
||||
|
@ -181,7 +181,7 @@ namespace CalculatorUnitTests
|
|||
VERIFY_IS_FALSE(m_calcInput.HasDecimalPt(), L"Verify input has no decimal point.");
|
||||
VERIFY_IS_TRUE(m_calcInput.TryAddDecimalPt(), L"Verify adding decimal to empty input.");
|
||||
VERIFY_IS_TRUE(m_calcInput.HasDecimalPt(), L"Verify input has decimal point.");
|
||||
VERIFY_ARE_EQUAL(L"0.", m_calcInput.ToString(10, false), L"Verify decimal on empty input.");
|
||||
VERIFY_ARE_EQUAL(L"0.", m_calcInput.ToString(10), L"Verify decimal on empty input.");
|
||||
}
|
||||
TEST_METHOD(TryAddDecimalPointTwice)
|
||||
{
|
||||
|
@ -202,7 +202,7 @@ namespace CalculatorUnitTests
|
|||
{
|
||||
m_calcInput.TryAddDigit(1, 10, false, L"999", 64, 32);
|
||||
VERIFY_IS_TRUE(m_calcInput.TryBeginExponent(), L"Verify adding exponent succeeds on input without exponent.");
|
||||
VERIFY_ARE_EQUAL(L"1.e+0", m_calcInput.ToString(10, false), L"Verify exponent present.");
|
||||
VERIFY_ARE_EQUAL(L"1.e+0", m_calcInput.ToString(10), L"Verify exponent present.");
|
||||
}
|
||||
TEST_METHOD(TryBeginExponentWithExponent)
|
||||
{
|
||||
|
@ -214,31 +214,31 @@ namespace CalculatorUnitTests
|
|||
TEST_METHOD(BackspaceZero)
|
||||
{
|
||||
m_calcInput.Backspace();
|
||||
VERIFY_ARE_EQUAL(L"0", m_calcInput.ToString(10, false), L"Verify backspace on 0 is still 0.");
|
||||
VERIFY_ARE_EQUAL(L"0", m_calcInput.ToString(10), L"Verify backspace on 0 is still 0.");
|
||||
}
|
||||
TEST_METHOD(BackspaceSingleChar)
|
||||
{
|
||||
m_calcInput.TryAddDigit(1, 10, false, L"999", 64, 32);
|
||||
VERIFY_ARE_EQUAL(L"1", m_calcInput.ToString(10, false), L"Verify input before backspace.");
|
||||
VERIFY_ARE_EQUAL(L"1", m_calcInput.ToString(10), L"Verify input before backspace.");
|
||||
m_calcInput.Backspace();
|
||||
VERIFY_ARE_EQUAL(L"0", m_calcInput.ToString(10, false), L"Verify input after backspace.");
|
||||
VERIFY_ARE_EQUAL(L"0", m_calcInput.ToString(10), L"Verify input after backspace.");
|
||||
}
|
||||
TEST_METHOD(BackspaceMultiChar)
|
||||
{
|
||||
m_calcInput.TryAddDigit(1, 10, false, L"999", 64, 32);
|
||||
m_calcInput.TryAddDigit(2, 10, false, L"999", 64, 32);
|
||||
VERIFY_ARE_EQUAL(L"12", m_calcInput.ToString(10, false), L"Verify input before backspace.");
|
||||
VERIFY_ARE_EQUAL(L"12", m_calcInput.ToString(10), L"Verify input before backspace.");
|
||||
m_calcInput.Backspace();
|
||||
VERIFY_ARE_EQUAL(L"1", m_calcInput.ToString(10, false), L"Verify input after backspace.");
|
||||
VERIFY_ARE_EQUAL(L"1", m_calcInput.ToString(10), L"Verify input after backspace.");
|
||||
}
|
||||
TEST_METHOD(BackspaceDecimal)
|
||||
{
|
||||
m_calcInput.TryAddDigit(1, 10, false, L"999", 64, 32);
|
||||
m_calcInput.TryAddDecimalPt();
|
||||
VERIFY_ARE_EQUAL(L"1.", m_calcInput.ToString(10, false), L"Verify input before backspace.");
|
||||
VERIFY_ARE_EQUAL(L"1.", m_calcInput.ToString(10), L"Verify input before backspace.");
|
||||
VERIFY_IS_TRUE(m_calcInput.HasDecimalPt(), L"Verify input has decimal point.");
|
||||
m_calcInput.Backspace();
|
||||
VERIFY_ARE_EQUAL(L"1", m_calcInput.ToString(10, false), L"Verify input after backspace.");
|
||||
VERIFY_ARE_EQUAL(L"1", m_calcInput.ToString(10), L"Verify input after backspace.");
|
||||
VERIFY_IS_FALSE(m_calcInput.HasDecimalPt(), L"Verify decimal point was removed.");
|
||||
}
|
||||
TEST_METHOD(BackspaceMultiCharDecimal)
|
||||
|
@ -247,47 +247,47 @@ namespace CalculatorUnitTests
|
|||
m_calcInput.TryAddDecimalPt();
|
||||
m_calcInput.TryAddDigit(2, 10, false, L"999", 64, 32);
|
||||
m_calcInput.TryAddDigit(3, 10, false, L"999", 64, 32);
|
||||
VERIFY_ARE_EQUAL(L"1.23", m_calcInput.ToString(10, false), L"Verify input before backspace.");
|
||||
VERIFY_ARE_EQUAL(L"1.23", m_calcInput.ToString(10), L"Verify input before backspace.");
|
||||
m_calcInput.Backspace();
|
||||
VERIFY_ARE_EQUAL(L"1.2", m_calcInput.ToString(10, false), L"Verify input after backspace.");
|
||||
VERIFY_ARE_EQUAL(L"1.2", m_calcInput.ToString(10), L"Verify input after backspace.");
|
||||
}
|
||||
|
||||
TEST_METHOD(SetDecimalSymbol)
|
||||
{
|
||||
m_calcInput.TryAddDecimalPt();
|
||||
VERIFY_ARE_EQUAL(L"0.", m_calcInput.ToString(10, false), L"Verify default decimal point.");
|
||||
VERIFY_ARE_EQUAL(L"0.", m_calcInput.ToString(10), L"Verify default decimal point.");
|
||||
m_calcInput.SetDecimalSymbol(L',');
|
||||
VERIFY_ARE_EQUAL(L"0,", m_calcInput.ToString(10, false), L"Verify new decimal point.");
|
||||
VERIFY_ARE_EQUAL(L"0,", m_calcInput.ToString(10), L"Verify new decimal point.");
|
||||
}
|
||||
|
||||
TEST_METHOD(ToStringEmpty)
|
||||
{
|
||||
VERIFY_ARE_EQUAL(L"0", m_calcInput.ToString(10, false), L"Verify ToString of empty value.");
|
||||
VERIFY_ARE_EQUAL(L"0", m_calcInput.ToString(10), L"Verify ToString of empty value.");
|
||||
}
|
||||
TEST_METHOD(ToStringNegative)
|
||||
{
|
||||
m_calcInput.TryAddDigit(1, 10, false, L"999", 64, 32);
|
||||
m_calcInput.TryToggleSign(false, L"999");
|
||||
VERIFY_ARE_EQUAL(L"-1", m_calcInput.ToString(10, false), L"Verify ToString of negative value.");
|
||||
VERIFY_ARE_EQUAL(L"-1", m_calcInput.ToString(10), L"Verify ToString of negative value.");
|
||||
}
|
||||
TEST_METHOD(ToStringExponentBase10)
|
||||
{
|
||||
m_calcInput.TryAddDigit(1, 10, false, L"999", 64, 32);
|
||||
m_calcInput.TryBeginExponent();
|
||||
VERIFY_ARE_EQUAL(L"1.e+0", m_calcInput.ToString(10, false), L"Verify ToString of empty base10 exponent.");
|
||||
VERIFY_ARE_EQUAL(L"1.e+0", m_calcInput.ToString(10), L"Verify ToString of empty base10 exponent.");
|
||||
}
|
||||
TEST_METHOD(ToStringExponentBase8)
|
||||
{
|
||||
m_calcInput.TryAddDigit(1, 10, false, L"999", 64, 32);
|
||||
m_calcInput.TryBeginExponent();
|
||||
VERIFY_ARE_EQUAL(L"1.^+0", m_calcInput.ToString(8, false), L"Verify ToString of empty base8 exponent.");
|
||||
VERIFY_ARE_EQUAL(L"1.^+0", m_calcInput.ToString(8), L"Verify ToString of empty base8 exponent.");
|
||||
}
|
||||
TEST_METHOD(ToStringExponentNegative)
|
||||
{
|
||||
m_calcInput.TryAddDigit(1, 8, false, L"999", 64, 32);
|
||||
m_calcInput.TryBeginExponent();
|
||||
m_calcInput.TryToggleSign(false, L"999");
|
||||
VERIFY_ARE_EQUAL(L"1.e-0", m_calcInput.ToString(10, false), L"Verify ToString of empty negative exponent.");
|
||||
VERIFY_ARE_EQUAL(L"1.e-0", m_calcInput.ToString(10), L"Verify ToString of empty negative exponent.");
|
||||
}
|
||||
TEST_METHOD(ToStringExponentPositive)
|
||||
{
|
||||
|
@ -296,12 +296,12 @@ namespace CalculatorUnitTests
|
|||
m_calcInput.TryAddDigit(2, 10, false, L"999", 64, 32);
|
||||
m_calcInput.TryAddDigit(3, 10, false, L"999", 64, 32);
|
||||
m_calcInput.TryAddDigit(4, 10, false, L"999", 64, 32);
|
||||
VERIFY_ARE_EQUAL(L"1.e+234", m_calcInput.ToString(10, false), L"Verify ToString of exponent with value.");
|
||||
VERIFY_ARE_EQUAL(L"1.e+234", m_calcInput.ToString(10), L"Verify ToString of exponent with value.");
|
||||
}
|
||||
TEST_METHOD(ToStringInteger)
|
||||
{
|
||||
m_calcInput.TryAddDigit(1, 10, false, L"999", 64, 32);
|
||||
VERIFY_ARE_EQUAL(L"1", m_calcInput.ToString(10, true), L"Verify ToString of integer value hides decimal.");
|
||||
VERIFY_ARE_EQUAL(L"1", m_calcInput.ToString(10), L"Verify ToString of integer value hides decimal.");
|
||||
}
|
||||
TEST_METHOD(ToStringBaseTooLong)
|
||||
{
|
||||
|
@ -311,7 +311,7 @@ namespace CalculatorUnitTests
|
|||
maxStr += L"1";
|
||||
m_calcInput.TryAddDigit(1, 10, false, maxStr, 64, 100);
|
||||
}
|
||||
auto result = m_calcInput.ToString(10, false);
|
||||
auto result = m_calcInput.ToString(10);
|
||||
VERIFY_IS_TRUE(result.empty(), L"Verify ToString of base value that is too large yields empty string.");
|
||||
}
|
||||
TEST_METHOD(ToStringExponentTooLong)
|
||||
|
@ -328,7 +328,7 @@ namespace CalculatorUnitTests
|
|||
exponentCapped = true;
|
||||
}
|
||||
}
|
||||
auto result = m_calcInput.ToString(10, false);
|
||||
auto result = m_calcInput.ToString(10);
|
||||
|
||||
// TryAddDigit caps the exponent length to C_EXP_MAX_DIGITS = 4, so ToString() succeeds.
|
||||
// If that cap is removed, ToString() should return an empty string.
|
||||
|
@ -347,7 +347,7 @@ namespace CalculatorUnitTests
|
|||
m_calcInput.TryAddDigit(1, 10, false, L"999", 64, 32);
|
||||
m_calcInput.TryAddDigit(2, 10, false, L"999", 64, 32);
|
||||
m_calcInput.TryAddDigit(3, 10, false, L"999", 64, 32);
|
||||
VERIFY_ARE_EQUAL(L"123", m_calcInput.ToString(10, false), L"Verify input before conversion to rational.");
|
||||
VERIFY_ARE_EQUAL(L"123", m_calcInput.ToString(10), L"Verify input before conversion to rational.");
|
||||
|
||||
auto rat = m_calcInput.ToRational(10, false);
|
||||
VERIFY_ARE_EQUAL(1, rat.P().Mantissa().size(), L"Verify digit count of rational.");
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#include "pch.h"
|
||||
|
@ -40,7 +40,7 @@ namespace CalculatorManagerTest
|
|||
{
|
||||
m_isError = isError;
|
||||
}
|
||||
void SetExpressionDisplay(_Inout_ std::shared_ptr<CalculatorVector<std::pair<std::wstring, int>>> const &tokens, _Inout_ std::shared_ptr<CalculatorVector<std::shared_ptr<IExpressionCommand>>> const &commands)
|
||||
void SetExpressionDisplay(_Inout_ std::shared_ptr<CalculatorVector<std::pair<std::wstring, int>>> const &tokens, _Inout_ std::shared_ptr<CalculatorVector<std::shared_ptr<IExpressionCommand>>> const & /*commands*/)
|
||||
{
|
||||
m_expression.clear();
|
||||
unsigned int nTokens = 0;
|
||||
|
@ -79,7 +79,7 @@ namespace CalculatorManagerTest
|
|||
return m_isError;
|
||||
}
|
||||
|
||||
void OnHistoryItemAdded(_In_ unsigned int addedItemIndex)
|
||||
void OnHistoryItemAdded(_In_ unsigned int /*addedItemIndex */)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -98,7 +98,7 @@ namespace CalculatorManagerTest
|
|||
m_binaryOperatorReceivedCallCount++;
|
||||
}
|
||||
|
||||
void MemoryItemChanged(unsigned int indexOfMemory)
|
||||
void MemoryItemChanged(unsigned int /*indexOfMemory*/)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -137,6 +137,8 @@
|
|||
<AdditionalOptions>/bigobj /await /std:c++17 /permissive- /Zc:twoPhase- %(AdditionalOptions)</AdditionalOptions>
|
||||
<DisableSpecificWarnings>4453;28204</DisableSpecificWarnings>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir);$(SolutionDir)CalcManager;$(SolutionDir)CalcViewModel;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
|
||||
|
@ -144,6 +146,8 @@
|
|||
<AdditionalOptions>/bigobj /await /std:c++17 /permissive- /Zc:twoPhase- %(AdditionalOptions)</AdditionalOptions>
|
||||
<DisableSpecificWarnings>4453;28204</DisableSpecificWarnings>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir);$(SolutionDir)CalcManager;$(SolutionDir)CalcViewModel;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
|
||||
|
@ -151,6 +155,8 @@
|
|||
<AdditionalOptions>/bigobj /await /std:c++17 /permissive- /Zc:twoPhase- %(AdditionalOptions)</AdditionalOptions>
|
||||
<DisableSpecificWarnings>4453;28204</DisableSpecificWarnings>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir);$(SolutionDir)CalcManager;$(SolutionDir)CalcViewModel;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
|
||||
|
@ -158,6 +164,8 @@
|
|||
<AdditionalOptions>/bigobj /await /std:c++17 /permissive- /Zc:twoPhase- %(AdditionalOptions)</AdditionalOptions>
|
||||
<DisableSpecificWarnings>4453;28204</DisableSpecificWarnings>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir);$(SolutionDir)CalcManager;$(SolutionDir)CalcViewModel;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
|
@ -165,6 +173,8 @@
|
|||
<AdditionalOptions>/bigobj /await /std:c++17 /permissive- /Zc:twoPhase- %(AdditionalOptions)</AdditionalOptions>
|
||||
<DisableSpecificWarnings>4453;28204</DisableSpecificWarnings>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir);$(SolutionDir)CalcManager;$(SolutionDir)CalcViewModel;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
|
@ -172,6 +182,8 @@
|
|||
<AdditionalOptions>/bigobj /await /std:c++17 /permissive- /Zc:twoPhase- %(AdditionalOptions)</AdditionalOptions>
|
||||
<DisableSpecificWarnings>4453;28204</DisableSpecificWarnings>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir);$(SolutionDir)CalcManager;$(SolutionDir)CalcViewModel;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
|
@ -179,6 +191,8 @@
|
|||
<AdditionalOptions>/bigobj /await /std:c++17 /permissive- /Zc:twoPhase- %(AdditionalOptions)</AdditionalOptions>
|
||||
<DisableSpecificWarnings>4453;28204</DisableSpecificWarnings>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir);$(SolutionDir)CalcManager;$(SolutionDir)CalcViewModel;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
|
@ -186,6 +200,8 @@
|
|||
<AdditionalOptions>/bigobj /await /std:c++17 /permissive- /Zc:twoPhase- %(AdditionalOptions)</AdditionalOptions>
|
||||
<DisableSpecificWarnings>4453;28204</DisableSpecificWarnings>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir);$(SolutionDir)CalcManager;$(SolutionDir)CalcViewModel;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#include "pch.h"
|
||||
|
@ -74,15 +74,15 @@ public:
|
|||
m_task_completion_event{ tce }
|
||||
{}
|
||||
|
||||
void CurrencyDataLoadFinished(bool didLoad) override
|
||||
void CurrencyDataLoadFinished(bool /*didLoad*/) override
|
||||
{
|
||||
m_task_completion_event.set();
|
||||
}
|
||||
|
||||
void CurrencySymbolsCallback(_In_ const wstring& fromSymbol, _In_ const wstring& toSymbol) override {}
|
||||
void CurrencyRatiosCallback(_In_ const wstring& ratioEquality, _In_ const wstring& accRatioEquality) override {}
|
||||
void CurrencyTimestampCallback(_In_ const std::wstring& timestamp, bool isWeekOldData) override {}
|
||||
void NetworkBehaviorChanged(_In_ int newBehavior) override {}
|
||||
void CurrencySymbolsCallback(_In_ const wstring& /*fromSymbol*/, _In_ const wstring& /*toSymbol*/) override {}
|
||||
void CurrencyRatiosCallback(_In_ const wstring& /*ratioEquality*/, _In_ const wstring& /*accRatioEquality*/) override {}
|
||||
void CurrencyTimestampCallback(_In_ const std::wstring& /*timestamp*/, bool /*isWeekOldData*/) override {}
|
||||
void NetworkBehaviorChanged(_In_ int /*newBehavior*/) override {}
|
||||
|
||||
private:
|
||||
Concurrency::task_completion_event<void> m_task_completion_event;
|
||||
|
|
|
@ -42,7 +42,7 @@ namespace CalculatorFunctionalTests
|
|||
HistoryViewModel^ m_historyViewModel;
|
||||
StandardCalculatorViewModel^ m_standardViewModel;
|
||||
|
||||
void Initialize(unsigned int windowId = 0)
|
||||
void Initialize(unsigned int /*windowId*/ = 0)
|
||||
{
|
||||
m_standardViewModel = ref new StandardCalculatorViewModel();
|
||||
m_standardViewModel->IsStandard = true;
|
||||
|
@ -50,7 +50,7 @@ namespace CalculatorFunctionalTests
|
|||
m_historyViewModel->SetCalculatorDisplay(m_standardViewModel->m_calculatorDisplay);
|
||||
}
|
||||
|
||||
void Cleanup(unsigned int windowId = 0)
|
||||
void Cleanup(unsigned int /*windowId*/ = 0)
|
||||
{
|
||||
m_standardViewModel->m_standardCalculatorManager.SendCommand(Command::ModeBasic);
|
||||
m_historyViewModel->OnClearCommand(nullptr);
|
||||
|
@ -100,7 +100,6 @@ namespace CalculatorFunctionalTests
|
|||
void AddMaxHistoryItems(unsigned int windowId = 0)
|
||||
{
|
||||
Initialize(windowId);
|
||||
int initialSize = m_historyViewModel->ItemSize;
|
||||
m_standardViewModel->m_standardCalculatorManager.SendCommand(Command::Command1);
|
||||
m_standardViewModel->m_standardCalculatorManager.SendCommand(Command::CommandADD);
|
||||
m_standardViewModel->m_standardCalculatorManager.SendCommand(Command::Command1);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#include "pch.h"
|
||||
|
@ -116,7 +116,7 @@ namespace UnitConverterUnitTests
|
|||
return m_ratioMaps[u];
|
||||
}
|
||||
|
||||
bool SupportsCategory(const Category& target)
|
||||
bool SupportsCategory(const Category& /*target*/)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#include "pch.h"
|
||||
|
@ -234,7 +234,7 @@ namespace CalculatorUnitTests
|
|||
return wstring(L"");
|
||||
}
|
||||
|
||||
void UnitConverterMock::DeSerialize(const wstring& serializedData)
|
||||
void UnitConverterMock::DeSerialize(const wstring& /*serializedData*/)
|
||||
{
|
||||
m_deSerializeCallCount++;
|
||||
}
|
||||
|
@ -244,7 +244,7 @@ namespace CalculatorUnitTests
|
|||
return L"TEST";
|
||||
};
|
||||
|
||||
void UnitConverterMock::RestoreUserPreferences(_In_ const std::wstring& userPreferences)
|
||||
void UnitConverterMock::RestoreUserPreferences(_In_ const std::wstring& /*userPreferences*/)
|
||||
{
|
||||
};
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#include "pch.h"
|
||||
|
@ -41,7 +41,7 @@ namespace CalculatorUnitTests
|
|||
void RestoreUserPreferences(_In_ const std::wstring& userPreferences) override;
|
||||
void SendCommand(UCM::Command command) override;
|
||||
void SetViewModelCallback(const std::shared_ptr<UCM::IUnitConverterVMCallback>& newCallback) override;
|
||||
void SetViewModelCurrencyCallback(_In_ const std::shared_ptr<UCM::IViewModelCurrencyCallback>& newCallback) override {}
|
||||
void SetViewModelCurrencyCallback(_In_ const std::shared_ptr<UCM::IViewModelCurrencyCallback>& /*newCallback*/) override {}
|
||||
concurrency::task<std::pair<bool, std::wstring>> RefreshCurrencyRatios() override
|
||||
{
|
||||
co_return std::make_pair(L"", L"");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue