Build with /W4 (#197)
All projects are built with warning level 4 (/W4) and treat warnings as errors (/WX). Fixed build errors resulting from enabling these compiler flags.
This commit is contained in:
@@ -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;
|
||||
@@ -407,11 +407,11 @@ namespace CalculatorUnitTests
|
||||
const UCM::Unit usdUnit = GetUnit(unitList, L"USD");
|
||||
const UCM::Unit eurUnit = GetUnit(unitList, L"EUR");
|
||||
|
||||
VERIFY_ARE_EQUAL(StringReference(L"United States - Dollar"), ref new String(usdUnit.name.c_str()));
|
||||
VERIFY_ARE_EQUAL(StringReference(L"USD"), ref new String(usdUnit.abbreviation.c_str()));
|
||||
VERIFY_ARE_EQUAL(wstring(L"United States - Dollar"), usdUnit.name);
|
||||
VERIFY_ARE_EQUAL(wstring(L"USD"), usdUnit.abbreviation);
|
||||
|
||||
VERIFY_ARE_EQUAL(StringReference(L"Europe - Euro"), ref new String(eurUnit.name.c_str()));
|
||||
VERIFY_ARE_EQUAL(StringReference(L"EUR"), ref new String(eurUnit.abbreviation.c_str()));
|
||||
VERIFY_ARE_EQUAL(wstring(L"Europe - Euro"), eurUnit.name);
|
||||
VERIFY_ARE_EQUAL(wstring(L"EUR"), eurUnit.abbreviation);
|
||||
}
|
||||
|
||||
TEST_METHOD(Loaded_LoadOrderedRatios)
|
||||
@@ -472,8 +472,8 @@ namespace CalculatorUnitTests
|
||||
|
||||
const pair<wstring, wstring> symbols = loader.GetCurrencySymbols(usdUnit, eurUnit);
|
||||
|
||||
VERIFY_ARE_EQUAL(ref new String(L"$"), StringReference(symbols.first.c_str()));
|
||||
VERIFY_ARE_EQUAL(ref new String(L"€"), StringReference(symbols.second.c_str()));
|
||||
VERIFY_ARE_EQUAL(wstring(L"$"), symbols.first);
|
||||
VERIFY_ARE_EQUAL(wstring(L"\x20ac"), symbols.second); // €
|
||||
}
|
||||
|
||||
TEST_METHOD(Loaded_GetCurrencySymbols_Invalid)
|
||||
@@ -503,8 +503,8 @@ namespace CalculatorUnitTests
|
||||
|
||||
pair<wstring, wstring> symbols = loader.GetCurrencySymbols(fakeUnit1, fakeUnit2);
|
||||
|
||||
VERIFY_ARE_EQUAL(ref new String(L""), StringReference(symbols.first.c_str()));
|
||||
VERIFY_ARE_EQUAL(ref new String(L""), StringReference(symbols.second.c_str()));
|
||||
VERIFY_ARE_EQUAL(wstring(L""), wstring(symbols.first.c_str()));
|
||||
VERIFY_ARE_EQUAL(wstring(L""), wstring(symbols.second.c_str()));
|
||||
|
||||
// Verify that when only one unit is valid, both symbols return as empty string.
|
||||
vector<UCM::Unit> unitList = loader.LoadOrderedUnits(CURRENCY_CATEGORY);
|
||||
@@ -514,13 +514,13 @@ namespace CalculatorUnitTests
|
||||
|
||||
symbols = loader.GetCurrencySymbols(fakeUnit1, usdUnit);
|
||||
|
||||
VERIFY_ARE_EQUAL(ref new String(L""), StringReference(symbols.first.c_str()));
|
||||
VERIFY_ARE_EQUAL(ref new String(L""), StringReference(symbols.second.c_str()));
|
||||
VERIFY_ARE_EQUAL(wstring(L""), symbols.first);
|
||||
VERIFY_ARE_EQUAL(wstring(L""), symbols.second);
|
||||
|
||||
symbols = loader.GetCurrencySymbols(usdUnit, fakeUnit1);
|
||||
|
||||
VERIFY_ARE_EQUAL(ref new String(L""), StringReference(symbols.first.c_str()));
|
||||
VERIFY_ARE_EQUAL(ref new String(L""), StringReference(symbols.second.c_str()));
|
||||
VERIFY_ARE_EQUAL(wstring(L""), symbols.first);
|
||||
VERIFY_ARE_EQUAL(wstring(L""), symbols.second);
|
||||
}
|
||||
|
||||
TEST_METHOD(Loaded_GetCurrencyRatioEquality_Valid)
|
||||
@@ -548,8 +548,8 @@ namespace CalculatorUnitTests
|
||||
|
||||
const pair<wstring, wstring> ratio = loader.GetCurrencyRatioEquality(usdUnit, eurUnit);
|
||||
|
||||
VERIFY_ARE_EQUAL(ref new String(L"1 USD = 0.9205 EUR"), StringReference(ratio.first.c_str()));
|
||||
VERIFY_ARE_EQUAL(ref new String(L"1 United States Dollar = 0.9205 Europe Euro"), StringReference(ratio.second.c_str()));
|
||||
VERIFY_ARE_EQUAL(wstring(L"1 USD = 0.9205 EUR"), ratio.first);
|
||||
VERIFY_ARE_EQUAL(wstring(L"1 United States Dollar = 0.9205 Europe Euro"), ratio.second);
|
||||
}
|
||||
|
||||
TEST_METHOD(Loaded_GetCurrencyRatioEquality_Invalid)
|
||||
@@ -578,8 +578,8 @@ namespace CalculatorUnitTests
|
||||
|
||||
pair<wstring, wstring> ratio = loader.GetCurrencyRatioEquality(fakeUnit1, fakeUnit2);
|
||||
|
||||
VERIFY_ARE_EQUAL(ref new String(L""), StringReference(ratio.first.c_str()));
|
||||
VERIFY_ARE_EQUAL(ref new String(L""), StringReference(ratio.second.c_str()));
|
||||
VERIFY_ARE_EQUAL(wstring(L""), ratio.first);
|
||||
VERIFY_ARE_EQUAL(wstring(L""), ratio.second);
|
||||
|
||||
// Verify that when only one unit is valid, both symbols return as empty string.
|
||||
vector<UCM::Unit> unitList = loader.LoadOrderedUnits(CURRENCY_CATEGORY);
|
||||
@@ -589,13 +589,13 @@ namespace CalculatorUnitTests
|
||||
|
||||
ratio = loader.GetCurrencyRatioEquality(fakeUnit1, usdUnit);
|
||||
|
||||
VERIFY_ARE_EQUAL(ref new String(L""), StringReference(ratio.first.c_str()));
|
||||
VERIFY_ARE_EQUAL(ref new String(L""), StringReference(ratio.second.c_str()));
|
||||
VERIFY_ARE_EQUAL(wstring(L""), ratio.first);
|
||||
VERIFY_ARE_EQUAL(wstring(L""), ratio.second);
|
||||
|
||||
ratio = loader.GetCurrencyRatioEquality(usdUnit, fakeUnit1);
|
||||
|
||||
VERIFY_ARE_EQUAL(ref new String(L""), StringReference(ratio.first.c_str()));
|
||||
VERIFY_ARE_EQUAL(ref new String(L""), StringReference(ratio.second.c_str()));
|
||||
VERIFY_ARE_EQUAL(wstring(L""), ratio.first);
|
||||
VERIFY_ARE_EQUAL(wstring(L""), ratio.second);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@@ -42,7 +42,7 @@ namespace CalculatorFunctionalTests
|
||||
HistoryViewModel^ m_historyViewModel;
|
||||
StandardCalculatorViewModel^ m_standardViewModel;
|
||||
|
||||
void Initialize(unsigned int windowId = 0)
|
||||
void Initialize()
|
||||
{
|
||||
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()
|
||||
{
|
||||
m_standardViewModel->m_standardCalculatorManager.SendCommand(Command::ModeBasic);
|
||||
m_historyViewModel->OnClearCommand(nullptr);
|
||||
@@ -79,9 +79,9 @@ namespace CalculatorFunctionalTests
|
||||
m_standardViewModel->IsFToEEnabled = false;
|
||||
}
|
||||
|
||||
void AddSingleHistoryItem(unsigned int windowId = 0)
|
||||
void AddSingleHistoryItem()
|
||||
{
|
||||
Initialize(windowId);
|
||||
Initialize();
|
||||
int initialSize = m_historyViewModel->ItemSize;
|
||||
m_standardViewModel->m_standardCalculatorManager.SendCommand(Command::Command1);
|
||||
m_standardViewModel->m_standardCalculatorManager.SendCommand(Command::CommandADD);
|
||||
@@ -94,25 +94,24 @@ namespace CalculatorFunctionalTests
|
||||
VERIFY_ARE_EQUAL(initialSize + 1, sizeAfterItemAdd);
|
||||
VERIFY_ARE_EQUAL(expression, StringReference(historyItem->historyItemVector.expression.c_str()));
|
||||
VERIFY_ARE_EQUAL(result, StringReference(historyItem->historyItemVector.result.c_str()));
|
||||
Cleanup(windowId);
|
||||
Cleanup();
|
||||
}
|
||||
|
||||
void AddMaxHistoryItems(unsigned int windowId = 0)
|
||||
void AddMaxHistoryItems()
|
||||
{
|
||||
Initialize(windowId);
|
||||
int initialSize = m_historyViewModel->ItemSize;
|
||||
Initialize();
|
||||
m_standardViewModel->m_standardCalculatorManager.SendCommand(Command::Command1);
|
||||
m_standardViewModel->m_standardCalculatorManager.SendCommand(Command::CommandADD);
|
||||
m_standardViewModel->m_standardCalculatorManager.SendCommand(Command::Command1);
|
||||
m_standardViewModel->m_standardCalculatorManager.SendCommand(Command::CommandEQU);
|
||||
for (int i = 1; i < m_standardViewModel->m_standardCalculatorManager.MaxHistorySize(); i++)
|
||||
for (size_t i = 1; i < m_standardViewModel->m_standardCalculatorManager.MaxHistorySize(); i++)
|
||||
{
|
||||
m_standardViewModel->m_standardCalculatorManager.SendCommand(Command::Command1);
|
||||
m_standardViewModel->m_standardCalculatorManager.SendCommand(Command::CommandADD);
|
||||
m_standardViewModel->m_standardCalculatorManager.SendCommand(Command::Command2);
|
||||
m_standardViewModel->m_standardCalculatorManager.SendCommand(Command::CommandEQU);
|
||||
}
|
||||
VERIFY_ARE_EQUAL(m_historyViewModel->ItemSize, m_standardViewModel->m_standardCalculatorManager.MaxHistorySize());
|
||||
VERIFY_ARE_EQUAL((size_t)m_historyViewModel->ItemSize, m_standardViewModel->m_standardCalculatorManager.MaxHistorySize());
|
||||
String ^expression = UtfUtils::LRO + L"1 + 1 =" + UtfUtils::PDF;
|
||||
int output = 2;
|
||||
String ^result = output.ToString();
|
||||
@@ -123,19 +122,19 @@ namespace CalculatorFunctionalTests
|
||||
m_standardViewModel->m_standardCalculatorManager.SendCommand(Command::CommandADD);
|
||||
m_standardViewModel->m_standardCalculatorManager.SendCommand(Command::Command5);
|
||||
m_standardViewModel->m_standardCalculatorManager.SendCommand(Command::CommandEQU);
|
||||
VERIFY_ARE_EQUAL(m_historyViewModel->ItemSize, m_standardViewModel->m_standardCalculatorManager.MaxHistorySize());
|
||||
VERIFY_ARE_EQUAL((size_t)m_historyViewModel->ItemSize, m_standardViewModel->m_standardCalculatorManager.MaxHistorySize());
|
||||
expression = UtfUtils::LRO + L"1 + 2 =" + UtfUtils::PDF;
|
||||
output = 3;
|
||||
result = output.ToString();
|
||||
historyItem = m_standardViewModel->m_standardCalculatorManager.GetHistoryItem(0);
|
||||
VERIFY_ARE_EQUAL(expression, StringReference(historyItem->historyItemVector.expression.c_str()));
|
||||
VERIFY_ARE_EQUAL(result, StringReference(historyItem->historyItemVector.result.c_str()));
|
||||
Cleanup(windowId);
|
||||
Cleanup();
|
||||
}
|
||||
|
||||
void ReloadHistory(unsigned int windowId = 0)
|
||||
void ReloadHistory()
|
||||
{
|
||||
Initialize(windowId);
|
||||
Initialize();
|
||||
|
||||
m_standardViewModel->m_standardCalculatorManager.Reset();
|
||||
int scientificItems = 5;
|
||||
@@ -187,12 +186,12 @@ namespace CalculatorFunctionalTests
|
||||
VERIFY_ARE_EQUAL(expr, historyItem->historyItemVector.expression);
|
||||
VERIFY_ARE_EQUAL(result, StringReference(historyItem->historyItemVector.result.c_str()));
|
||||
}
|
||||
Cleanup(windowId);
|
||||
Cleanup();
|
||||
}
|
||||
|
||||
void ClearHistory(unsigned int windowId = 0)
|
||||
void ClearHistory()
|
||||
{
|
||||
Initialize(windowId);
|
||||
Initialize();
|
||||
m_standardViewModel->m_standardCalculatorManager.SendCommand(Command::ModeScientific);
|
||||
m_standardViewModel->m_standardCalculatorManager.SendCommand(Command::Command1);
|
||||
m_standardViewModel->m_standardCalculatorManager.SendCommand(Command::CommandADD);
|
||||
@@ -207,12 +206,12 @@ namespace CalculatorFunctionalTests
|
||||
VERIFY_ARE_EQUAL(0, m_historyViewModel->ItemSize);
|
||||
VERIFY_IS_TRUE(IsHistoryContainerEmpty(GetHistoryContainerKeyHelper(CM_STD)));
|
||||
VERIFY_IS_TRUE(IsHistoryContainerEmpty(GetHistoryContainerKeyHelper(CM_SCI)));
|
||||
Cleanup(windowId);
|
||||
Cleanup();
|
||||
}
|
||||
|
||||
void SerializeDeSerializeHistoryItem(unsigned int windowId = 0)
|
||||
void SerializeDeSerializeHistoryItem()
|
||||
{
|
||||
Initialize(windowId);
|
||||
Initialize();
|
||||
m_standardViewModel->m_standardCalculatorManager.SendCommand(Command::ModeScientific);
|
||||
m_standardViewModel->m_standardCalculatorManager.SendCommand(Command::Command1);
|
||||
m_standardViewModel->m_standardCalculatorManager.SendCommand(Command::CommandADD);
|
||||
@@ -223,12 +222,12 @@ namespace CalculatorFunctionalTests
|
||||
m_historyViewModel->ReloadHistory(ViewMode::Scientific);
|
||||
auto itemAfterSerializeDeserialize = m_standardViewModel->m_standardCalculatorManager.GetHistoryItem(0);
|
||||
VERIFY_IS_TRUE((itemBeforeSerializeDeserialize->historyItemVector.expression == itemAfterSerializeDeserialize->historyItemVector.expression) && (itemBeforeSerializeDeserialize->historyItemVector.result == itemAfterSerializeDeserialize->historyItemVector.result) && (itemBeforeSerializeDeserialize->historyItemVector.spCommands == itemAfterSerializeDeserialize->historyItemVector.spCommands) && (itemBeforeSerializeDeserialize->historyItemVector.spTokens == itemAfterSerializeDeserialize->historyItemVector.spTokens));
|
||||
Cleanup(windowId);
|
||||
Cleanup();
|
||||
}
|
||||
|
||||
void SaveAndReloadHistory(unsigned int windowid = 0)
|
||||
void SaveAndReloadHistory()
|
||||
{
|
||||
Initialize(windowid);
|
||||
Initialize();
|
||||
m_standardViewModel->m_standardCalculatorManager.SendCommand(Command::ModeScientific);
|
||||
m_standardViewModel->m_standardCalculatorManager.SendCommand(Command::Command1);
|
||||
m_standardViewModel->m_standardCalculatorManager.SendCommand(Command::CommandADD);
|
||||
@@ -258,12 +257,12 @@ namespace CalculatorFunctionalTests
|
||||
VERIFY_ARE_EQUAL(result, StringReference(historyItem->historyItemVector.result.c_str()));
|
||||
VERIFY_ARE_NOT_EQUAL(itemsBeforeSaveAndReload, itemsAfterSaveAndReload);
|
||||
VERIFY_ARE_EQUAL(itemsBeforeSaveAndReload, itemsAfterSaveAndReload + 1);
|
||||
Cleanup(windowid);
|
||||
Cleanup();
|
||||
}
|
||||
|
||||
void HistoryItemWithPrettyExpressions(unsigned int windowId = 0)
|
||||
void HistoryItemWithPrettyExpressions()
|
||||
{
|
||||
Initialize(windowId);
|
||||
Initialize();
|
||||
Command commands[] = { Command::CommandSIN, Command::CommandCOS, Command::CommandTAN, Command::CommandASIN, Command::CommandACOS, Command::CommandATAN };
|
||||
Command mode[] = { Command::CommandDEG, Command::CommandRAD, Command::CommandGRAD };
|
||||
int modes = sizeof(mode) / sizeof(Command);
|
||||
@@ -290,12 +289,12 @@ namespace CalculatorFunctionalTests
|
||||
itemIndex++;
|
||||
}
|
||||
}
|
||||
Cleanup(windowId);
|
||||
Cleanup();
|
||||
}
|
||||
|
||||
void HistoryItemWithPrettyExpressionsMixedRadix(unsigned int windowId = 0)
|
||||
void HistoryItemWithPrettyExpressionsMixedRadix()
|
||||
{
|
||||
Initialize(windowId);
|
||||
Initialize();
|
||||
ResourceLoader^ m_uiResourceLoader = ResourceLoader::GetForViewIndependentUse(L"CEngineStrings");
|
||||
m_standardViewModel->m_standardCalculatorManager.SendCommand(Command::ModeScientific);
|
||||
m_standardViewModel->m_standardCalculatorManager.SendCommand(Command::CommandDEG);
|
||||
@@ -321,12 +320,12 @@ namespace CalculatorFunctionalTests
|
||||
expr = UtfUtils::LRO + expr + UtfUtils::PDF;
|
||||
VERIFY_ARE_EQUAL(historyItem->historyItemVector.expression, expr);
|
||||
|
||||
Cleanup(windowId);
|
||||
Cleanup();
|
||||
}
|
||||
|
||||
void HistoryItemClicked(unsigned int windowId = 0)
|
||||
void HistoryItemClicked()
|
||||
{
|
||||
Initialize(windowId);
|
||||
Initialize();
|
||||
m_standardViewModel->m_standardCalculatorManager.SendCommand(Command::ModeScientific);
|
||||
m_standardViewModel->m_standardCalculatorManager.SendCommand(Command::Command1);
|
||||
m_standardViewModel->m_standardCalculatorManager.SendCommand(Command::CommandADD);
|
||||
@@ -348,12 +347,12 @@ namespace CalculatorFunctionalTests
|
||||
VERIFY_ARE_EQUAL(StringReference(L" "), m_standardViewModel->ExpressionTokens->GetAt(5)->Token);
|
||||
VERIFY_ARE_EQUAL(StringReference(L"+"), m_standardViewModel->ExpressionTokens->GetAt(6)->Token);
|
||||
VERIFY_ARE_EQUAL(StringReference(L" "), m_standardViewModel->ExpressionTokens->GetAt(7)->Token);
|
||||
Cleanup(windowId);
|
||||
Cleanup();
|
||||
}
|
||||
|
||||
void HistoryItemLoadAndContinueCalculation(unsigned int windowId = 0)
|
||||
void HistoryItemLoadAndContinueCalculation()
|
||||
{
|
||||
Initialize(windowId);
|
||||
Initialize();
|
||||
m_standardViewModel->m_standardCalculatorManager.SendCommand(Command::ModeBasic);
|
||||
m_standardViewModel->m_standardCalculatorManager.SendCommand(Command::Command1);
|
||||
m_standardViewModel->m_standardCalculatorManager.SendCommand(Command::CommandADD);
|
||||
@@ -385,12 +384,12 @@ namespace CalculatorFunctionalTests
|
||||
item = ref new HistoryItemViewModel(expression, result, historyItem->historyItemVector.spTokens, historyItem->historyItemVector.spCommands);
|
||||
MockOnHistoryItemClicked(item);
|
||||
VERIFY_ARE_EQUAL(StringReference(L"14"), m_standardViewModel->DisplayValue);
|
||||
Cleanup(windowId);
|
||||
Cleanup();
|
||||
}
|
||||
|
||||
void DisplayValueAutomationNames(unsigned int windowId = 0)
|
||||
void DisplayValueAutomationNames()
|
||||
{
|
||||
Initialize(windowId);
|
||||
Initialize();
|
||||
m_standardViewModel->m_standardCalculatorManager.SendCommand(Command::Command1);
|
||||
m_standardViewModel->m_standardCalculatorManager.SendCommand(Command::CommandADD);
|
||||
m_standardViewModel->m_standardCalculatorManager.SendCommand(Command::Command8);
|
||||
@@ -414,12 +413,12 @@ namespace CalculatorFunctionalTests
|
||||
expression = StringReference(L"Display is 3");
|
||||
VERIFY_ARE_EQUAL(expression, m_standardViewModel->CalculationResultAutomationName);
|
||||
|
||||
Cleanup(windowId);
|
||||
Cleanup();
|
||||
}
|
||||
|
||||
void RadixAutomationName(unsigned int windowId = 0)
|
||||
void RadixAutomationName()
|
||||
{
|
||||
Initialize(windowId);
|
||||
Initialize();
|
||||
m_standardViewModel->m_standardCalculatorManager.SendCommand(Command::ModeProgrammer);
|
||||
m_standardViewModel->IsProgrammer = true;
|
||||
m_standardViewModel->m_standardCalculatorManager.SendCommand(Command::Command1);
|
||||
@@ -435,26 +434,26 @@ namespace CalculatorFunctionalTests
|
||||
expression = StringReference(L"Binary 1000");
|
||||
result = L"Binary " + Utils::GetStringValue(m_standardViewModel->BinaryDisplayValue);
|
||||
VERIFY_ARE_EQUAL(expression, result);
|
||||
Cleanup(windowId);
|
||||
Cleanup();
|
||||
}
|
||||
|
||||
void HistoryEmpty(unsigned int windowId = 0)
|
||||
void HistoryEmpty()
|
||||
{
|
||||
Initialize(windowId);
|
||||
Initialize();
|
||||
VERIFY_ARE_EQUAL(0, m_historyViewModel->ItemSize);
|
||||
m_standardViewModel->m_standardCalculatorManager.SendCommand(Command::ModeScientific);
|
||||
VERIFY_ARE_EQUAL(0, m_historyViewModel->ItemSize);
|
||||
Cleanup(windowId);
|
||||
Cleanup();
|
||||
}
|
||||
|
||||
void HistoryClearCommandWithEmptyHistory(unsigned int windowId = 0)
|
||||
void HistoryClearCommandWithEmptyHistory()
|
||||
{
|
||||
Initialize(windowId);
|
||||
Initialize();
|
||||
VERIFY_ARE_EQUAL(0, m_historyViewModel->ItemSize);
|
||||
m_standardViewModel->m_standardCalculatorManager.SendCommand(Command::ModeScientific);
|
||||
m_historyViewModel->OnClearCommand(nullptr);
|
||||
VERIFY_ARE_EQUAL(0, m_historyViewModel->ItemSize);
|
||||
Cleanup(windowId);
|
||||
Cleanup();
|
||||
|
||||
}
|
||||
};
|
||||
|
@@ -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"
|
||||
@@ -274,7 +274,7 @@ namespace CalculatorUnitTests
|
||||
for (size_t index = 0; index < orderedModes.size(); index++)
|
||||
{
|
||||
ViewMode mode = orderedModes[index];
|
||||
VERIFY_ARE_EQUAL(index, NavCategory::GetIndex(mode));
|
||||
VERIFY_ARE_EQUAL(index, (size_t)NavCategory::GetIndex(mode));
|
||||
}
|
||||
|
||||
VERIFY_ARE_EQUAL(-1, NavCategory::GetIndex(ViewMode::None));
|
||||
@@ -306,7 +306,7 @@ namespace CalculatorUnitTests
|
||||
for (size_t pos = 1; pos <= orderedModes.size(); pos++)
|
||||
{
|
||||
ViewMode mode = orderedModes[pos - 1];
|
||||
VERIFY_ARE_EQUAL(pos, NavCategory::GetPosition(mode));
|
||||
VERIFY_ARE_EQUAL(pos, (size_t)NavCategory::GetPosition(mode));
|
||||
}
|
||||
|
||||
VERIFY_ARE_EQUAL(-1, NavCategory::GetPosition(ViewMode::None));
|
||||
|
@@ -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"");
|
||||
|
Reference in New Issue
Block a user