mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-22 22:23:29 -07:00
Merge remote-tracking branch 'upstream/master' into settings
This commit is contained in:
commit
dd591f5c50
74 changed files with 968 additions and 1003 deletions
41
build/pipelines/azure-pipelines.ci-internal.yaml
Normal file
41
build/pipelines/azure-pipelines.ci-internal.yaml
Normal file
|
@ -0,0 +1,41 @@
|
|||
#
|
||||
# Continuous Integration (CI) - Internal
|
||||
# This pipeline builds and validate the app for all supported architectures, in a production
|
||||
# configuration. This pipeline relies on Microsoft-internal resources to run.
|
||||
#
|
||||
|
||||
trigger:
|
||||
- master
|
||||
- release/*
|
||||
- feature/*
|
||||
pr: none
|
||||
|
||||
name: 0.$(Date:yyMM).$(DayOfMonth)$(Rev:rr).0
|
||||
|
||||
jobs:
|
||||
- template: ./templates/build-app-internal.yaml
|
||||
parameters:
|
||||
platform: x64
|
||||
|
||||
- template: ./templates/build-app-internal.yaml
|
||||
parameters:
|
||||
platform: x86
|
||||
|
||||
- template: ./templates/build-app-internal.yaml
|
||||
parameters:
|
||||
platform: ARM
|
||||
|
||||
- template: ./templates/run-ui-tests.yaml
|
||||
parameters:
|
||||
platform: x64
|
||||
runsettingsFileName: CalculatorUITests.release.runsettings
|
||||
|
||||
- template: ./templates/run-unit-tests.yaml
|
||||
parameters:
|
||||
platform: x64
|
||||
|
||||
- template: ./templates/run-unit-tests.yaml
|
||||
parameters:
|
||||
platform: x86
|
||||
|
||||
- template: ./templates/package-appxbundle.yaml
|
|
@ -1,7 +1,7 @@
|
|||
#
|
||||
# Continuous Integration (CI)
|
||||
# This pipeline builds and validate the app in all supported configurations. If the build was
|
||||
# queued to validate a pull request, we build and test only x64.
|
||||
# This pipeline builds and validate the app for all supported architecutres, in a public
|
||||
# configuration. If the build was queued to validate a pull request, we build and test only x64.
|
||||
#
|
||||
|
||||
trigger:
|
||||
|
|
|
@ -13,6 +13,7 @@ schedules:
|
|||
branches:
|
||||
include:
|
||||
- master
|
||||
always: true
|
||||
|
||||
trigger: none
|
||||
pr: none
|
||||
|
|
|
@ -16,8 +16,8 @@ pr: none
|
|||
|
||||
variables:
|
||||
versionMajor: 10
|
||||
versionMinor: 2102
|
||||
versionBuild: $[counter('10.2102.*', 0)]
|
||||
versionMinor: 2103
|
||||
versionBuild: $[counter('10.2103.*', 0)]
|
||||
versionPatch: 0
|
||||
|
||||
name: '$(versionMajor).$(versionMinor).$(versionBuild).$(versionPatch)'
|
||||
|
|
|
@ -105,7 +105,7 @@ jobs:
|
|||
- task: MS-RDX-MRO.windows-store-publish-dev.package-task.store-package@2
|
||||
displayName: Create StoreBroker Payload
|
||||
inputs:
|
||||
serviceEndpoint: StoreBrokerProxy
|
||||
serviceEndpoint: Calculator StoreBroker Connection
|
||||
sbConfigPath: Tools/Build/StoreBroker/SBCalculatorConfig.json
|
||||
sourceFolder: $(Build.ArtifactStagingDirectory)/appxBundleSigned
|
||||
contents: Microsoft.WindowsCalculator_8wekyb3d8bbwe.appxbundle
|
||||
|
@ -125,7 +125,7 @@ jobs:
|
|||
displayName: 'Flight StoreBroker Payload to team ring'
|
||||
name: StoreBrokerFlight
|
||||
inputs:
|
||||
serviceEndpoint: StoreBrokerProxy
|
||||
serviceEndpoint: Calculator StoreBroker Connection
|
||||
appId: '$(AppId)'
|
||||
flightId: '$(FlightId)'
|
||||
inputMethod: JsonAndZip
|
||||
|
@ -149,8 +149,3 @@ jobs:
|
|||
SubmissionDataPath: '$(SBPackagePath)\SBCalculator.json'
|
||||
PackagePath: '$(SBPackagePath)\SBCalculator.zip'
|
||||
AeroEnvironment: Production
|
||||
|
||||
- task: PkgESLateTasks@10
|
||||
displayName: Run PackageES LateTasks
|
||||
env:
|
||||
XES_DISABLEPROV: true
|
||||
|
|
|
@ -4,11 +4,12 @@ Windows Calculator is under active development by Microsoft.
|
|||
|
||||
## Focus
|
||||
|
||||
In 2020, the Windows Calculator team is focused on:
|
||||
* Iterating upon the existing app design based on the latest guidelines for [Fluent Design](https://developer.microsoft.com/en-us/windows/apps/design), [Windows 10X dual-screen devices](https://docs.microsoft.com/en-us/dual-screen/windows/), and [WinUI 3.0](https://github.com/microsoft/microsoft-ui-xaml).
|
||||
* Unblocking community contributions by identifying and addressing bottlenecks affecting developers, including migrating portions of the codebase to C# ([#893](https://github.com/microsoft/calculator/issues/893)) and adding a settings page ([#596](https://github.com/microsoft/calculator/issues/596)).
|
||||
* Addressing top user pain points, including clearing up confusion around how Standard Calculator behaves ([#138](https://github.com/microsoft/calculator/issues/138)) and fixing hidden characters in copied results ([#504](https://github.com/microsoft/calculator/issues/504)).
|
||||
* Investigating unit converter improvements ([#379](https://github.com/microsoft/calculator/issues/379), [#589](https://github.com/microsoft/calculator/issues/589) and [#594](https://github.com/microsoft/calculator/issues/594))
|
||||
In 2021, the Windows Calculator team is focused on:
|
||||
* Iterating upon the existing app design based on the latest guidelines for [Fluent Design](https://developer.microsoft.com/en-us/windows/apps/design) and [WinUI](https://github.com/microsoft/microsoft-ui-xaml).
|
||||
* Unblocking community contributions by identifying and addressing bottlenecks affecting developers, including:
|
||||
* Migrating the codebase to C# ([#893](https://github.com/microsoft/calculator/issues/893))
|
||||
* Releasing infinite-precision engine as standalone package ([#1545](https://github.com/microsoft/calculator/issues/1545)) and adding support for arbitrary expression parsing ([#526](https://github.com/microsoft/calculator/issues/526))
|
||||
* Adding a settings page ([#596](https://github.com/microsoft/calculator/issues/596))
|
||||
* [Your feature idea here] - please review our [new feature development process](https://github.com/Microsoft/calculator/blob/master/docs/NewFeatureProcess.md) to get started!
|
||||
|
||||
We welcome contributions of all kinds from the community, but especially those that support the efforts above. Please see our [contributing guidelines](https://github.com/Microsoft/calculator/blob/master/CONTRIBUTING.md) for more information on how to get involved.
|
||||
|
|
|
@ -52,8 +52,8 @@ namespace CalcEngine
|
|||
|
||||
Rational::Rational(uint64_t ui)
|
||||
{
|
||||
uint32_t hi = (uint32_t) (((ui) >> 32) & 0xffffffff);
|
||||
uint32_t lo = (uint32_t) ui;
|
||||
uint32_t hi = (uint32_t)(((ui) >> 32) & 0xffffffff);
|
||||
uint32_t lo = (uint32_t)ui;
|
||||
|
||||
Rational temp = (Rational{ hi } << 32) | lo;
|
||||
|
||||
|
|
|
@ -31,17 +31,12 @@ 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)
|
||||
{
|
||||
if (nopCode == rgbPrec[iPrec])
|
||||
if (nopCode == rgbPrec[iPrec])
|
||||
{
|
||||
return rgbPrec[iPrec + 1];
|
||||
}
|
||||
|
@ -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 } },
|
||||
|
|
|
@ -55,7 +55,7 @@ CalcEngine::Rational CCalcEngine::SciCalcFunctions(CalcEngine::Rational const& r
|
|||
|
||||
uint64_t w64Bits = result.ToUInt64_t();
|
||||
uint64_t msb = (w64Bits >> (m_dwWordBitWidth - 1)) & 1;
|
||||
w64Bits <<= 1; // LShift by 1
|
||||
w64Bits <<= 1; // LShift by 1
|
||||
|
||||
if (op == IDC_ROL)
|
||||
{
|
||||
|
@ -64,7 +64,7 @@ CalcEngine::Rational CCalcEngine::SciCalcFunctions(CalcEngine::Rational const& r
|
|||
else
|
||||
{
|
||||
w64Bits |= m_carryBit; // Set the carry bit as the LSB
|
||||
m_carryBit = msb; // Store the msb as the next carry bit
|
||||
m_carryBit = msb; // Store the msb as the next carry bit
|
||||
}
|
||||
|
||||
result = w64Bits;
|
||||
|
@ -272,7 +272,7 @@ CalcEngine::Rational CCalcEngine::SciCalcFunctions(CalcEngine::Rational const& r
|
|||
break;
|
||||
|
||||
case IDC_FLOOR:
|
||||
result = (Frac(rat) < 0) ? Integer(rat - 1 ) : Integer(rat);
|
||||
result = (Frac(rat) < 0) ? Integer(rat - 1) : Integer(rat);
|
||||
break;
|
||||
|
||||
case IDC_ABS:
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
#include <vector>
|
||||
#include "winerror_cross_platform.h"
|
||||
#include "Ratpack/CalcErr.h"
|
||||
#include <stdexcept> // for std::out_of_range
|
||||
#include "sal_cross_platform.h" // for SAL
|
||||
#include <stdexcept> // for std::out_of_range
|
||||
#include "sal_cross_platform.h" // for SAL
|
||||
|
||||
template <typename TType>
|
||||
class CalculatorVector
|
||||
|
@ -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++)
|
||||
{
|
||||
|
|
|
@ -162,7 +162,7 @@ namespace CalculationManager
|
|||
CommandCOTH = 410,
|
||||
CommandACOTH = 411,
|
||||
|
||||
CommandPOW2 = 412, // 2 ^ x
|
||||
CommandPOW2 = 412, // 2 ^ x
|
||||
CommandAbs = 413,
|
||||
CommandFloor = 414,
|
||||
CommandCeil = 415,
|
||||
|
|
|
@ -137,44 +137,44 @@
|
|||
#define IDC_INV 146
|
||||
#define IDC_SET_RESULT 147
|
||||
|
||||
#define IDC_STRING_MAPPED_VALUES 400
|
||||
#define IDC_UNARYEXTENDEDFIRST IDC_STRING_MAPPED_VALUES
|
||||
#define IDC_SEC 400 // Secant
|
||||
#define IDC_STRING_MAPPED_VALUES 400
|
||||
#define IDC_UNARYEXTENDEDFIRST IDC_STRING_MAPPED_VALUES
|
||||
#define IDC_SEC 400 // Secant
|
||||
// 401 reserved for inverse
|
||||
#define IDC_CSC 402 // Cosecant
|
||||
#define IDC_CSC 402 // Cosecant
|
||||
// 403 reserved for inverse
|
||||
#define IDC_COT 404 // Cotangent
|
||||
#define IDC_COT 404 // Cotangent
|
||||
// 405 reserved for inverse
|
||||
|
||||
#define IDC_SECH 406 //Hyperbolic Secant
|
||||
#define IDC_SECH 406 // Hyperbolic Secant
|
||||
// 407 reserved for inverse
|
||||
#define IDC_CSCH 408 //Hyperbolic Cosecant
|
||||
#define IDC_CSCH 408 // Hyperbolic Cosecant
|
||||
// 409 reserved for inverse
|
||||
#define IDC_COTH 410 //Hyperbolic Cotangent
|
||||
#define IDC_COTH 410 // Hyperbolic Cotangent
|
||||
// 411 reserved for inverse
|
||||
|
||||
#define IDC_POW2 412 // 2 ^ x
|
||||
#define IDC_ABS 413 // Absolute Value
|
||||
#define IDC_FLOOR 414 // Floor
|
||||
#define IDC_CEIL 415 // Ceiling
|
||||
#define IDC_POW2 412 // 2 ^ x
|
||||
#define IDC_ABS 413 // Absolute Value
|
||||
#define IDC_FLOOR 414 // Floor
|
||||
#define IDC_CEIL 415 // Ceiling
|
||||
|
||||
#define IDC_ROLC 416 // Rotate Left Circular
|
||||
#define IDC_RORC 417 // Rotate Right Circular
|
||||
#define IDC_ROLC 416 // Rotate Left Circular
|
||||
#define IDC_RORC 417 // Rotate Right Circular
|
||||
|
||||
#define IDC_UNARYEXTENDEDLAST IDC_RORC
|
||||
#define IDC_UNARYEXTENDEDLAST IDC_RORC
|
||||
|
||||
#define IDC_LASTCONTROL IDC_CEIL
|
||||
|
||||
#define IDC_BINARYEXTENDEDFIRST 500
|
||||
#define IDC_LOGBASEY 500 // logy(x)
|
||||
#define IDC_NAND 501 // Nand
|
||||
#define IDC_NOR 502 // Nor
|
||||
#define IDC_LOGBASEY 500 // logy(x)
|
||||
#define IDC_NAND 501 // Nand
|
||||
#define IDC_NOR 502 // Nor
|
||||
|
||||
#define IDC_RSHFL 505 //Right Shift Logical
|
||||
#define IDC_BINARYEXTENDEDLAST IDC_RSHFL
|
||||
#define IDC_RSHFL 505 // Right Shift Logical
|
||||
#define IDC_BINARYEXTENDEDLAST IDC_RSHFL
|
||||
|
||||
#define IDC_RAND 600 // Random
|
||||
#define IDC_EULER 601 // e Constant
|
||||
#define IDC_RAND 600 // Random
|
||||
#define IDC_EULER 601 // e Constant
|
||||
|
||||
#define IDC_BINEDITSTART 700
|
||||
#define IDC_BINPOS0 700
|
||||
|
|
|
@ -120,7 +120,7 @@ private:
|
|||
bool m_bRecord; // Global mode: recording or displaying
|
||||
bool m_bSetCalcState; // Flag for setting the engine result state
|
||||
CalcEngine::CalcInput m_input; // Global calc input object for decimal strings
|
||||
NumberFormat m_nFE; // Scientific notation conversion flag
|
||||
NumberFormat m_nFE; // Scientific notation conversion flag
|
||||
CalcEngine::Rational m_maxTrigonometricNum;
|
||||
std::unique_ptr<CalcEngine::Rational> m_memoryValue; // Current memory value.
|
||||
|
||||
|
@ -147,7 +147,7 @@ private:
|
|||
std::array<int, MAXPRECDEPTH> m_nPrecOp; /* Holding array for precedence operations. */
|
||||
size_t m_precedenceOpCount; /* Current number of precedence ops in holding. */
|
||||
int m_nLastCom; // Last command entered.
|
||||
AngleType m_angletype; // Current Angle type when in dec mode. one of deg, rad or grad
|
||||
AngleType m_angletype; // Current Angle type when in dec mode. one of deg, rad or grad
|
||||
NUM_WIDTH m_numwidth; // one of qword, dword, word or byte mode.
|
||||
int32_t m_dwWordBitWidth; // # of bits in currently selected word size
|
||||
|
||||
|
@ -158,8 +158,8 @@ private:
|
|||
|
||||
CHistoryCollector m_HistoryCollector; // Accumulator of each line of history as various commands are processed
|
||||
|
||||
std::array<CalcEngine::Rational, NUM_WIDTH_LENGTH> m_chopNumbers; // word size enforcement
|
||||
std::array<std::wstring, NUM_WIDTH_LENGTH> m_maxDecimalValueStrings; // maximum values represented by a given word width based off m_chopNumbers
|
||||
std::array<CalcEngine::Rational, NUM_WIDTH_LENGTH> m_chopNumbers; // word size enforcement
|
||||
std::array<std::wstring, NUM_WIDTH_LENGTH> m_maxDecimalValueStrings; // maximum values represented by a given word width based off m_chopNumbers
|
||||
static std::unordered_map<std::wstring_view, std::wstring> s_engineStrings; // the string table shared across all instances
|
||||
wchar_t m_decimalSeparator;
|
||||
wchar_t m_groupSeparator;
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
#include <algorithm>
|
||||
#include <string>
|
||||
#include "CalcErr.h"
|
||||
#include <cstring> // for memmove
|
||||
#include "sal_cross_platform.h" // for SAL
|
||||
#include <cstring> // for memmove
|
||||
#include "sal_cross_platform.h" // for SAL
|
||||
|
||||
static constexpr uint32_t BASEXPWR = 31L; // Internal log2(BASEX)
|
||||
static constexpr uint32_t BASEX = 0x80000000; // Internal radix used in calculations, hope to raise
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -20,6 +20,6 @@
|
|||
|
||||
#define SUCCEEDED(hr) (((ResultCode)(hr)) >= 0)
|
||||
#define FAILED(hr) (((ResultCode)(hr)) < 0)
|
||||
#define SCODE_CODE(sc) ((sc) & 0xFFFF)
|
||||
#define SCODE_CODE(sc) ((sc)&0xFFFF)
|
||||
|
||||
#endif
|
||||
|
|
|
@ -43,7 +43,7 @@ namespace
|
|||
ApplicationViewModel::ApplicationViewModel()
|
||||
: m_CalculatorViewModel(nullptr)
|
||||
, m_DateCalcViewModel(nullptr)
|
||||
, m_GraphingCalcViewModel(nullptr)
|
||||
, m_GraphingCalcViewModel(nullptr)
|
||||
, m_ConverterViewModel(nullptr)
|
||||
, m_PreviousMode(ViewMode::None)
|
||||
, m_mode(ViewMode::None)
|
||||
|
|
|
@ -77,6 +77,5 @@ public
|
|||
static NarratorAnnouncement ^ GetAlwaysOnTopChangedAnnouncement(Platform::String ^ announcement);
|
||||
|
||||
static NarratorAnnouncement ^ GetBitShiftRadioButtonCheckedAnnouncement(Platform::String ^ announcement);
|
||||
|
||||
};
|
||||
}
|
||||
|
|
|
@ -94,33 +94,33 @@ public
|
|||
Byte = (int)CM::Command::CommandByte,
|
||||
Cube = (int)CM::Command::CommandCUB,
|
||||
DMS = (int)CM::Command::CommandDMS,
|
||||
Hyp = (int) CM::Command::CommandHYP,
|
||||
Sec = (int) CM::Command::CommandSEC,
|
||||
Csc = (int) CM::Command::CommandCSC,
|
||||
Cot = (int) CM::Command::CommandCOT,
|
||||
InvSec = (int) CM::Command::CommandASEC,
|
||||
InvCsc = (int) CM::Command::CommandACSC,
|
||||
InvCot = (int) CM::Command::CommandACOT,
|
||||
Sech = (int) CM::Command::CommandSECH,
|
||||
Csch = (int) CM::Command::CommandCSCH,
|
||||
Coth = (int) CM::Command::CommandCOTH,
|
||||
InvSech = (int) CM::Command::CommandASECH,
|
||||
InvCsch = (int) CM::Command::CommandACSCH,
|
||||
InvCoth = (int) CM::Command::CommandACOTH,
|
||||
CubeRoot = (int) CM::Command::CommandCUBEROOT,
|
||||
TwoPowerX = (int) CM::Command::CommandPOW2,
|
||||
LogBaseY = (int) CM::Command::CommandLogBaseY,
|
||||
Nand = (int) CM::Command::CommandNand,
|
||||
Nor = (int) CM::Command::CommandNor,
|
||||
Abs = (int) CM::Command::CommandAbs,
|
||||
Floor = (int) CM::Command::CommandFloor,
|
||||
Ceil = (int) CM::Command::CommandCeil,
|
||||
Rand = (int) CM::Command::CommandRand,
|
||||
Euler = (int) CM::Command::CommandEuler,
|
||||
Hyp = (int)CM::Command::CommandHYP,
|
||||
Sec = (int)CM::Command::CommandSEC,
|
||||
Csc = (int)CM::Command::CommandCSC,
|
||||
Cot = (int)CM::Command::CommandCOT,
|
||||
InvSec = (int)CM::Command::CommandASEC,
|
||||
InvCsc = (int)CM::Command::CommandACSC,
|
||||
InvCot = (int)CM::Command::CommandACOT,
|
||||
Sech = (int)CM::Command::CommandSECH,
|
||||
Csch = (int)CM::Command::CommandCSCH,
|
||||
Coth = (int)CM::Command::CommandCOTH,
|
||||
InvSech = (int)CM::Command::CommandASECH,
|
||||
InvCsch = (int)CM::Command::CommandACSCH,
|
||||
InvCoth = (int)CM::Command::CommandACOTH,
|
||||
CubeRoot = (int)CM::Command::CommandCUBEROOT,
|
||||
TwoPowerX = (int)CM::Command::CommandPOW2,
|
||||
LogBaseY = (int)CM::Command::CommandLogBaseY,
|
||||
Nand = (int)CM::Command::CommandNand,
|
||||
Nor = (int)CM::Command::CommandNor,
|
||||
Abs = (int)CM::Command::CommandAbs,
|
||||
Floor = (int)CM::Command::CommandFloor,
|
||||
Ceil = (int)CM::Command::CommandCeil,
|
||||
Rand = (int)CM::Command::CommandRand,
|
||||
Euler = (int)CM::Command::CommandEuler,
|
||||
RshL = (int)CM::Command::CommandRSHFL,
|
||||
RolC = (int)CM::Command::CommandROLC,
|
||||
RorC = (int)CM::Command::CommandRORC,
|
||||
|
||||
|
||||
BINSTART = (int)CM::Command::CommandBINEDITSTART,
|
||||
BINPOS0 = (int)CM::Command::CommandBINPOS0,
|
||||
BINPOS1 = (int)CM::Command::CommandBINPOS1,
|
||||
|
|
|
@ -118,7 +118,7 @@ public
|
|||
Platform::String ^ operand,
|
||||
CalculatorApp::Common::ViewMode mode,
|
||||
CalculatorApp::Common::CategoryGroupType modeType,
|
||||
CalculatorApp::Common::NumberBase programmerNumberBase);
|
||||
CalculatorApp::Common::NumberBase programmerNumberBase);
|
||||
static ULONG32 ProgrammerOperandLength(Platform::String ^ operand, CalculatorApp::Common::NumberBase numberBase);
|
||||
|
||||
private:
|
||||
|
|
|
@ -62,7 +62,7 @@ LocalizationService ^ LocalizationService::GetInstance()
|
|||
/// <remarks>
|
||||
/// Should only be used for test purpose
|
||||
/// </remarks>
|
||||
void LocalizationService::OverrideWithLanguage(_In_ const wchar_t * const language)
|
||||
void LocalizationService::OverrideWithLanguage(_In_ const wchar_t* const language)
|
||||
{
|
||||
s_singletonInstance = ref new LocalizationService(language);
|
||||
}
|
||||
|
|
|
@ -256,7 +256,7 @@ namespace CalculatorApp
|
|||
std::wstring destination;
|
||||
std::copy_if(
|
||||
begin(source), end(source), std::back_inserter(destination), [this](auto const c) { return c != L' ' && c != m_numberGroupSeparator; });
|
||||
|
||||
|
||||
return ref new Platform::String(destination.c_str());
|
||||
}
|
||||
|
||||
|
|
|
@ -295,7 +295,7 @@ void NavCategory::InitializeCategoryManifest(User ^ user)
|
|||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// This function should only be used when storing the mode to app data.
|
||||
int NavCategory::Serialize(ViewMode mode)
|
||||
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -241,7 +241,6 @@ namespace Utils
|
|||
};
|
||||
}
|
||||
|
||||
|
||||
// Regular DependencyProperty
|
||||
template <typename TOwner, typename TType>
|
||||
Windows::UI::Xaml::DependencyProperty^ RegisterDependencyProperty(
|
||||
|
|
|
@ -89,7 +89,7 @@ namespace CalculatorApp
|
|||
}
|
||||
}
|
||||
|
||||
CurrencyDataLoader::CurrencyDataLoader(_In_ unique_ptr<ICurrencyHttpClient> client, const wchar_t * forcedResponseLanguage)
|
||||
CurrencyDataLoader::CurrencyDataLoader(_In_ unique_ptr<ICurrencyHttpClient> client, const wchar_t* forcedResponseLanguage)
|
||||
: m_client(move(client))
|
||||
, m_loadStatus(CurrencyLoadStatus::NotLoaded)
|
||||
, m_responseLanguage(L"en-US")
|
||||
|
|
|
@ -472,6 +472,3 @@ void App::DismissedEventHandler(SplashScreen ^ sender, Object ^ e)
|
|||
{
|
||||
SetupJumpList();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\..\packages\Microsoft.WindowsCalculator.PGO.1.0.2\build\native\Microsoft.WindowsCalculator.PGO.props" Condition="Exists('..\..\packages\Microsoft.WindowsCalculator.PGO.1.0.2\build\native\Microsoft.WindowsCalculator.PGO.props')" />
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{9447424a-0e05-4911-beb8-e0354405f39a}</ProjectGuid>
|
||||
<RootNamespace>CalculatorApp</RootNamespace>
|
||||
|
@ -961,15 +960,12 @@
|
|||
</ItemGroup>
|
||||
</Target>
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="..\..\packages\Microsoft.WindowsCalculator.PGO.1.0.2\build\native\Microsoft.WindowsCalculator.PGO.targets" Condition="Exists('..\..\packages\Microsoft.WindowsCalculator.PGO.1.0.2\build\native\Microsoft.WindowsCalculator.PGO.targets')" />
|
||||
<Import Project="..\..\packages\Microsoft.UI.Xaml.2.4.3\build\native\Microsoft.UI.Xaml.targets" Condition="Exists('..\..\packages\Microsoft.UI.Xaml.2.4.3\build\native\Microsoft.UI.Xaml.targets')" />
|
||||
</ImportGroup>
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see https://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\..\packages\Microsoft.WindowsCalculator.PGO.1.0.2\build\native\Microsoft.WindowsCalculator.PGO.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.WindowsCalculator.PGO.1.0.2\build\native\Microsoft.WindowsCalculator.PGO.props'))" />
|
||||
<Error Condition="!Exists('..\..\packages\Microsoft.WindowsCalculator.PGO.1.0.2\build\native\Microsoft.WindowsCalculator.PGO.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.WindowsCalculator.PGO.1.0.2\build\native\Microsoft.WindowsCalculator.PGO.targets'))" />
|
||||
<Error Condition="!Exists('..\..\packages\Microsoft.UI.Xaml.2.4.3\build\native\Microsoft.UI.Xaml.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.UI.Xaml.2.4.3\build\native\Microsoft.UI.Xaml.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
|
@ -18,10 +18,10 @@ namespace CalculatorApp
|
|||
#ifdef SEND_DIAGNOSTICS
|
||||
// c.f. WINEVENT_KEYWORD_RESERVED_63-56 0xFF00000000000000 // Bits 63-56 - channel keywords
|
||||
// c.f. WINEVENT_KEYWORD_* 0x00FF000000000000 // Bits 55-48 - system-reserved keywords
|
||||
constexpr int64_t MICROSOFT_KEYWORD_LEVEL_1 = 0x0000800000000000; // Bit 47
|
||||
constexpr int64_t MICROSOFT_KEYWORD_LEVEL_2 = 0x0000400000000000; // Bit 46
|
||||
constexpr int64_t MICROSOFT_KEYWORD_LEVEL_1 = 0x0000800000000000; // Bit 47
|
||||
constexpr int64_t MICROSOFT_KEYWORD_LEVEL_2 = 0x0000400000000000; // Bit 46
|
||||
constexpr int64_t MICROSOFT_KEYWORD_LEVEL_3 = 0x0000200000000000; // Bit 45
|
||||
constexpr int64_t MICROSOFT_KEYWORD_RESERVED_44 = 0x0000100000000000; // Bit 44 (reserved for future assignment)
|
||||
constexpr int64_t MICROSOFT_KEYWORD_RESERVED_44 = 0x0000100000000000; // Bit 44 (reserved for future assignment)
|
||||
#else
|
||||
// define all Keyword options as 0 when we do not want to upload app diagnostics
|
||||
constexpr int64_t MICROSOFT_KEYWORD_LEVEL_1 = 0;
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -75,7 +75,7 @@ namespace CalculatorApp
|
|||
Windows::Foundation::EventRegistrationToken m_textContainerSizeChangedToken;
|
||||
Windows::Foundation::EventRegistrationToken m_scrollRightClickToken;
|
||||
Windows::Foundation::EventRegistrationToken m_scrollLeftClickToken;
|
||||
Windows::Foundation::EventRegistrationToken m_textBlockSizeChangedToken;
|
||||
Windows::Foundation::EventRegistrationToken m_textBlockSizeChangedToken;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1922,7 +1922,7 @@
|
|||
<comment>An abbreviation for a measurement unit of Angle</comment>
|
||||
</data>
|
||||
<data name="UnitAbbreviation_Gradian" xml:space="preserve">
|
||||
<value>Grad</value>
|
||||
<value>gon</value>
|
||||
<comment>An abbreviation for a measurement unit of Angle</comment>
|
||||
</data>
|
||||
<data name="UnitAbbreviation_Atmosphere" xml:space="preserve">
|
||||
|
|
|
@ -3348,7 +3348,7 @@
|
|||
<comment>Label for the Line Style section of the style picker</comment>
|
||||
</data>
|
||||
<data name="KeyGraphFeaturesLabel.Text" xml:space="preserve">
|
||||
<value>Ανάλυση λειτουργίας</value>
|
||||
<value>Ανάλυση συνάρτησης</value>
|
||||
<comment>Title for KeyGraphFeatures Control</comment>
|
||||
</data>
|
||||
<data name="KGFHorizontalAsymptotesNone" xml:space="preserve">
|
||||
|
@ -4047,7 +4047,7 @@
|
|||
<comment>Announcement used in Graphing Calculator when a function is removed from the function list</comment>
|
||||
</data>
|
||||
<data name="KGFEquationTextBox.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
|
||||
<value>Πλαίσιο εξισώσεων ανάλυσης συναρτήσεων</value>
|
||||
<value>Πλαίσιο εξισώσεων Ανάλυση συνάρτησης</value>
|
||||
<comment>This is the automation name text for the equation box in the function analysis panel</comment>
|
||||
</data>
|
||||
<data name="graphingEqualButton.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
|
||||
|
|
|
@ -1106,7 +1106,7 @@
|
|||
<comment>Screen reader prompt for the Unit Converter Units2 i.e. bottom units field.</comment>
|
||||
</data>
|
||||
<data name="CategoryName_AreaText" xml:space="preserve">
|
||||
<value>Zone</value>
|
||||
<value>Aire</value>
|
||||
<comment>Unit conversion category name called Area (eg. area of a sports field in square meters)</comment>
|
||||
</data>
|
||||
<data name="CategoryName_DataText" xml:space="preserve">
|
||||
|
|
|
@ -2992,11 +2992,11 @@
|
|||
<comment>Name for the absolute value function. Used by screen readers.</comment>
|
||||
</data>
|
||||
<data name="LeftShift" xml:space="preserve">
|
||||
<value>ឃី shift ខាងឆ្វេង</value>
|
||||
<value>ប្តូរទៅខាងឆ្វេង</value>
|
||||
<comment>Name for the programmer function that shifts bits to the left. Used by screen readers.</comment>
|
||||
</data>
|
||||
<data name="RightShift" xml:space="preserve">
|
||||
<value>ឃី shift ខាងស្តាំ</value>
|
||||
<value>ប្តូរទៅខាងស្តាំ</value>
|
||||
<comment>Name for the programmer function that shifts bits to the right. Used by screen readers.</comment>
|
||||
</data>
|
||||
<data name="Factorial" xml:space="preserve">
|
||||
|
|
|
@ -1922,7 +1922,7 @@
|
|||
<comment>An abbreviation for a measurement unit of Angle</comment>
|
||||
</data>
|
||||
<data name="UnitAbbreviation_Gradian" xml:space="preserve">
|
||||
<value>대학원생</value>
|
||||
<value>그리드</value>
|
||||
<comment>An abbreviation for a measurement unit of Angle</comment>
|
||||
</data>
|
||||
<data name="UnitAbbreviation_Atmosphere" xml:space="preserve">
|
||||
|
@ -2006,7 +2006,7 @@
|
|||
<comment>A measurement unit for weight. (Please choose the most appropriate plural form to fit any number between 0 and 999,999,999,999,999)</comment>
|
||||
</data>
|
||||
<data name="UnitName_Degree" xml:space="preserve">
|
||||
<value>온도</value>
|
||||
<value>도</value>
|
||||
<comment>A measurement unit for Angle.</comment>
|
||||
</data>
|
||||
<data name="UnitName_Radian" xml:space="preserve">
|
||||
|
@ -4023,7 +4023,7 @@
|
|||
<comment>Graph settings heading for the theme options</comment>
|
||||
</data>
|
||||
<data name="AlwaysLightTheme.Content" xml:space="preserve">
|
||||
<value>항상 가늘게</value>
|
||||
<value>항상 밝게</value>
|
||||
<comment>Graph settings option to set graph to light theme</comment>
|
||||
</data>
|
||||
<data name="MatchAppTheme.Content" xml:space="preserve">
|
||||
|
@ -4035,7 +4035,7 @@
|
|||
<comment>This is the automation name text for the Graph settings heading for the theme options</comment>
|
||||
</data>
|
||||
<data name="AlwaysLightTheme.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
|
||||
<value>항상 가늘게</value>
|
||||
<value>항상 밝게</value>
|
||||
<comment>This is the automation name text for the Graph settings option to set graph to light theme</comment>
|
||||
</data>
|
||||
<data name="MatchAppTheme.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
|
||||
|
|
|
@ -1706,7 +1706,7 @@
|
|||
<comment>A measurement unit for energy. (Please choose the most appropriate plural form to fit any number between 0 and 999,999,999,999,999)</comment>
|
||||
</data>
|
||||
<data name="UnitName_Foot" xml:space="preserve">
|
||||
<value>ຕີນ</value>
|
||||
<value>ຟຸດ</value>
|
||||
<comment>A measurement unit for length. (Please choose the most appropriate plural form to fit any number between 0 and 999,999,999,999,999)</comment>
|
||||
</data>
|
||||
<data name="UnitName_FeetPerSecond" xml:space="preserve">
|
||||
|
|
|
@ -2318,7 +2318,7 @@
|
|||
<comment>{Locked="%1"}. Copyright statement, displayed on the About panel. %1 = the current year (4 digits)</comment>
|
||||
</data>
|
||||
<data name="AboutFlyoutContribute" xml:space="preserve">
|
||||
<value>Para saber como pode contribuir para a calculadora do Windows, dê saída do projeto no %HL%GitHub%HL%.</value>
|
||||
<value>Para saber como pode contribuir para a Calculadora do Windows, consulte o projeto no %HL%GitHub%HL%.</value>
|
||||
<comment>{Locked="%HL%GitHub%HL%"}. GitHub link, Displayed on the About panel</comment>
|
||||
</data>
|
||||
<data name="AboutButton.Content" xml:space="preserve">
|
||||
|
@ -2572,7 +2572,7 @@
|
|||
<comment>Automation name for the group of radices (Hexadecimal, Decimal, Octal, Binary). https://en.wikipedia.org/wiki/Radix </comment>
|
||||
</data>
|
||||
<data name="ProgrammerOperators.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
|
||||
<value>Operadores do programador</value>
|
||||
<value>Operadores de programador</value>
|
||||
<comment>Automation name for the group of programmer operators (RoL, RoR, Lsh, Rsh, OR, XOR, NOT, AND).</comment>
|
||||
</data>
|
||||
<data name="InputModeSelectionGroup.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
|
||||
|
@ -3280,7 +3280,7 @@
|
|||
<comment>Announcement used in Graphing Calculator when graph view button is clicked and automatic best fit is set, resetting the graph</comment>
|
||||
</data>
|
||||
<data name="zoomInButton.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
|
||||
<value>Zoom In (Ctrl + adição)</value>
|
||||
<value>Ampliar (Ctrl + adição)</value>
|
||||
<comment>This is the tool tip automation name for the Calculator zoom in button.</comment>
|
||||
</data>
|
||||
<data name="zoomInButton.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
|
||||
|
@ -3288,7 +3288,7 @@
|
|||
<comment>Screen reader prompt for the zoom in button.</comment>
|
||||
</data>
|
||||
<data name="zoomOutButton.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
|
||||
<value>Zoom out (Ctrl + subtração)</value>
|
||||
<value>Reduzir (Ctrl + subtração)</value>
|
||||
<comment>This is the tool tip automation name for the Calculator zoom out button.</comment>
|
||||
</data>
|
||||
<data name="zoomOutButton.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
|
||||
|
|
|
@ -126,7 +126,7 @@
|
|||
<comment>Error message shown when there's no possible value for a function.</comment>
|
||||
</data>
|
||||
<data name="105" xml:space="preserve">
|
||||
<value>内存不足</value>
|
||||
<value>存储器空间不足</value>
|
||||
<comment>Error message shown when we run out of memory during a calculation.</comment>
|
||||
</data>
|
||||
<data name="107" xml:space="preserve">
|
||||
|
|
|
@ -418,11 +418,11 @@
|
|||
<comment>Used to describe the first bit of a binary number. Used in bit flip</comment>
|
||||
</data>
|
||||
<data name="MemoryButton_Open" xml:space="preserve">
|
||||
<value>打开内存浮出控件</value>
|
||||
<value>打开记忆浮出控件</value>
|
||||
<comment>This is the automation name and label for the memory button when the memory flyout is closed.</comment>
|
||||
</data>
|
||||
<data name="MemoryButton_Close" xml:space="preserve">
|
||||
<value>关闭内存浮出控件</value>
|
||||
<value>关闭记忆浮出控件</value>
|
||||
<comment>This is the automation name and label for the memory button when the memory flyout is open.</comment>
|
||||
</data>
|
||||
<data name="AlwaysOnTop_Enter" xml:space="preserve">
|
||||
|
@ -434,7 +434,7 @@
|
|||
<comment>This is the tool tip automation name for the always-on-top button when in always-on-top mode.</comment>
|
||||
</data>
|
||||
<data name="MemoryButton.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
|
||||
<value>内存</value>
|
||||
<value>记忆</value>
|
||||
<comment>This is the tool tip automation name for the memory button.</comment>
|
||||
</data>
|
||||
<data name="HistoryButton.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
|
||||
|
@ -450,15 +450,15 @@
|
|||
<comment>This is the tool tip automation name for the numberPad button.</comment>
|
||||
</data>
|
||||
<data name="ClearMemoryButton.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
|
||||
<value>清除所有内存(Ctrl+L)</value>
|
||||
<value>清除所有记忆(Ctrl+L)</value>
|
||||
<comment>This is the tool tip automation name for the Clear Memory (MC) button.</comment>
|
||||
</data>
|
||||
<data name="MemoryLabel.Text" xml:space="preserve">
|
||||
<value>内存</value>
|
||||
<value>记忆</value>
|
||||
<comment>The text that shows as the header for the memory list</comment>
|
||||
</data>
|
||||
<data name="MemoryPivotItem.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
|
||||
<value>内存</value>
|
||||
<value>记忆</value>
|
||||
<comment>The automation name for the Memory pivot item that is shown when Calculator is in wide layout.</comment>
|
||||
</data>
|
||||
<data name="HistoryLabel.Text" xml:space="preserve">
|
||||
|
@ -566,7 +566,7 @@
|
|||
<comment>Screen reader prompt for the history flyout</comment>
|
||||
</data>
|
||||
<data name="MemoryPane" xml:space="preserve">
|
||||
<value>内存</value>
|
||||
<value>记忆</value>
|
||||
<comment>Screen reader prompt for the memory flyout</comment>
|
||||
</data>
|
||||
<data name="Format_HexButtonValue" xml:space="preserve">
|
||||
|
@ -606,91 +606,91 @@
|
|||
<comment>Screen reader prompt for the Calculator History button, when the flyout is open.</comment>
|
||||
</data>
|
||||
<data name="memButton.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
|
||||
<value>内存存储</value>
|
||||
<value>记忆存储</value>
|
||||
<comment>Screen reader prompt for the Calculator Memory button</comment>
|
||||
</data>
|
||||
<data name="memButton.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
|
||||
<value>内存存储(Ctrl+M)</value>
|
||||
<value>记忆存储(Ctrl+M)</value>
|
||||
<comment>This is the tool tip automation name for the Memory Store (MS) button.</comment>
|
||||
</data>
|
||||
<data name="ClearMemoryButton.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
|
||||
<value>清除所有内存</value>
|
||||
<value>清除所有记忆</value>
|
||||
<comment>Screen reader prompt for the Calculator Clear Memory button</comment>
|
||||
</data>
|
||||
<data name="Memory_Cleared" xml:space="preserve">
|
||||
<value>已清理内存</value>
|
||||
<value>记忆已清除</value>
|
||||
<comment>Screen reader prompt for the Calculator Clear Memory button, when the button is invoked.</comment>
|
||||
</data>
|
||||
<data name="MemRecall.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
|
||||
<value>内存重新调用</value>
|
||||
<value>记忆读出</value>
|
||||
<comment>Screen reader prompt for the Calculator Memory Recall button</comment>
|
||||
</data>
|
||||
<data name="MemRecall.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
|
||||
<value>内存重新调用(Ctrl+R)</value>
|
||||
<value>记忆读出(Ctrl+R)</value>
|
||||
<comment>This is the tool tip automation name for the Memory Recall (MR) button.</comment>
|
||||
</data>
|
||||
<data name="MemPlus.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
|
||||
<value>内存添加</value>
|
||||
<value>记忆加法</value>
|
||||
<comment>Screen reader prompt for the Calculator Memory Add button</comment>
|
||||
</data>
|
||||
<data name="MemPlus.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
|
||||
<value>内存添加(Ctrl+P)</value>
|
||||
<value>记忆加法(Ctrl+P)</value>
|
||||
<comment>This is the tool tip automation name for the Memory Add (M+) button.</comment>
|
||||
</data>
|
||||
<data name="MemMinus.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
|
||||
<value>内存减少</value>
|
||||
<value>记忆减法</value>
|
||||
<comment>Screen reader prompt for the Calculator Memory Subtract button</comment>
|
||||
</data>
|
||||
<data name="MemMinus.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
|
||||
<value>内存减少(Ctrl+Q)</value>
|
||||
<value>记忆减法(Ctrl+Q)</value>
|
||||
<comment>This is the tool tip automation name for the Memory Subtract (M-) button.</comment>
|
||||
</data>
|
||||
<data name="ClearMemoryItemButton.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
|
||||
<value>清除内存项</value>
|
||||
<value>清除记忆项</value>
|
||||
<comment>Screen reader prompt for the Calculator Clear Memory button</comment>
|
||||
</data>
|
||||
<data name="ClearMemoryItemButton.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
|
||||
<value>清除内存项</value>
|
||||
<value>清除记忆项</value>
|
||||
<comment>This is the tool tip automation name for the Clear Memory Item (MC) button in the Memory list.</comment>
|
||||
</data>
|
||||
<data name="MemPlusItem.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
|
||||
<value>添加到内存项</value>
|
||||
<value>增加到记忆项</value>
|
||||
<comment>Screen reader prompt for the Calculator Memory Add button in the Memory list</comment>
|
||||
</data>
|
||||
<data name="MemPlusItem.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
|
||||
<value>添加到内存项</value>
|
||||
<value>增加到记忆项</value>
|
||||
<comment>This is the tool tip automation name for the Calculator Memory Add button in the Memory list</comment>
|
||||
</data>
|
||||
<data name="MemMinusItem.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
|
||||
<value>从内存项中移除</value>
|
||||
<value>从记忆项中减去</value>
|
||||
<comment>Screen reader prompt for the Calculator Memory Subtract button in the Memory list</comment>
|
||||
</data>
|
||||
<data name="MemMinusItem.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
|
||||
<value>从内存项中移除</value>
|
||||
<value>从记忆项中减去</value>
|
||||
<comment>This is the tool tip automation name for the Calculator Memory Subtract button in the Memory list</comment>
|
||||
</data>
|
||||
<data name="ClearMemorySwipeItem.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
|
||||
<value>清除内存项</value>
|
||||
<value>清除记忆项</value>
|
||||
<comment>Screen reader prompt for the Calculator Clear Memory button</comment>
|
||||
</data>
|
||||
<data name="ClearMemoryMenuItem.Text" xml:space="preserve">
|
||||
<value>清除内存项</value>
|
||||
<value>清除记忆项</value>
|
||||
<comment>Text string for the Calculator Clear Memory option in the Memory list context menu</comment>
|
||||
</data>
|
||||
<data name="MemPlusSwipeItem.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
|
||||
<value>添加到内存项</value>
|
||||
<value>增加到记忆项</value>
|
||||
<comment>Screen reader prompt for the Calculator Memory Add swipe button in the Memory list</comment>
|
||||
</data>
|
||||
<data name="MemPlusMenuItem.Text" xml:space="preserve">
|
||||
<value>添加到内存项</value>
|
||||
<value>增加到记忆项</value>
|
||||
<comment>Text string for the Calculator Memory Add option in the Memory list context menu</comment>
|
||||
</data>
|
||||
<data name="MemMinusSwipeItem.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
|
||||
<value>从内存项中移除</value>
|
||||
<value>从记忆项中减去</value>
|
||||
<comment>Screen reader prompt for the Calculator Memory Subtract swipe button in the Memory list</comment>
|
||||
</data>
|
||||
<data name="MemMinusMenuItem.Text" xml:space="preserve">
|
||||
<value>从内存项中移除</value>
|
||||
<value>从记忆项中减去</value>
|
||||
<comment>Text string for the Calculator Memory Subtract option in the Memory list context menu</comment>
|
||||
</data>
|
||||
<data name="DeleteHistorySwipeItem.Text" xml:space="preserve">
|
||||
|
@ -1122,7 +1122,7 @@
|
|||
<comment>Unit conversion category name called Length</comment>
|
||||
</data>
|
||||
<data name="CategoryName_PowerText" xml:space="preserve">
|
||||
<value>电源</value>
|
||||
<value>功率</value>
|
||||
<comment>Unit conversion category name called Power (eg. the power of an engine or a light bulb)</comment>
|
||||
</data>
|
||||
<data name="CategoryName_SpeedText" xml:space="preserve">
|
||||
|
@ -2286,7 +2286,7 @@
|
|||
<comment>A soccer ball, used as a comparison measurement unit for weight. (Please choose the most appropriate plural form to fit any number between 0 and 999,999,999,999,999)</comment>
|
||||
</data>
|
||||
<data name="MemoryItemHelpText" xml:space="preserve">
|
||||
<value>内存项</value>
|
||||
<value>记忆项</value>
|
||||
<comment>Help text used by accessibility tools to indicate that an item in the list of memory values is a memory item.</comment>
|
||||
</data>
|
||||
<data name="SupplementaryUnit_AutomationName" xml:space="preserve">
|
||||
|
@ -2334,11 +2334,11 @@
|
|||
<comment>The text that shows as the header for the history list</comment>
|
||||
</data>
|
||||
<data name="MemoryPaneEmpty.Text" xml:space="preserve">
|
||||
<value>内存中没有内容</value>
|
||||
<value>存储器中未保存数据</value>
|
||||
<comment>The text that shows as the header for the memory list</comment>
|
||||
</data>
|
||||
<data name="MemoryFlyout.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
|
||||
<value>内存</value>
|
||||
<value>记忆</value>
|
||||
<comment>Screen reader prompt for the negate button on the converter operator keypad</comment>
|
||||
</data>
|
||||
<data name="CannotPaste" xml:space="preserve">
|
||||
|
@ -2536,11 +2536,11 @@
|
|||
<comment>Automation name for when the mode header is focused and the current mode is Date Calculation.</comment>
|
||||
</data>
|
||||
<data name="DockPanel.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
|
||||
<value>历史记录和内存列表</value>
|
||||
<value>历史记录和记忆列表</value>
|
||||
<comment>Automation name for the group of controls for history and memory lists.</comment>
|
||||
</data>
|
||||
<data name="MemoryPanel.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
|
||||
<value>内存控件</value>
|
||||
<value>记忆控件</value>
|
||||
<comment>Automation name for the group of memory controls (Mem Clear, Mem Recall, Mem Add, Mem Subtract, Mem Store, Memory flyout toggle)</comment>
|
||||
</data>
|
||||
<data name="StandardFunctions.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
|
||||
|
@ -2600,15 +2600,15 @@
|
|||
<comment>{Locked='%1','%2'} Formatting string for a Narrator announcement when user presses a button with auditory feedback. "%1" is the display value and "%2" is the button press feedback. Example, user presses "plus" and hears "Display is 7 plus".</comment>
|
||||
</data>
|
||||
<data name="Format_MemorySave" xml:space="preserve">
|
||||
<value>%1 已保存到内存</value>
|
||||
<value>%1 已保存到存储器</value>
|
||||
<comment>{Locked='%1'} Formatting string for a Narrator announcement when the user stores a number to memory. The %1 is the automation name of the display. Users will hear "_current_value_ saved to memory".</comment>
|
||||
</data>
|
||||
<data name="Format_MemorySlotChanged" xml:space="preserve">
|
||||
<value>内存插槽 %1 是 %2</value>
|
||||
<value>记忆组 %1 是 %2</value>
|
||||
<comment>{Locked='%1','%2'} Formatting string for a Narrator announcement when the user changes a memory slot. The %1 is the index of the memory slot and %2 is the new value. For example, users might hear "Memory slot 2 is 37".</comment>
|
||||
</data>
|
||||
<data name="Format_MemorySlotCleared" xml:space="preserve">
|
||||
<value>已清理内存插槽 %1</value>
|
||||
<value>记忆组 %1 已清除</value>
|
||||
<comment>{Locked='%1'} Formatting string for a Narrator announcement when the user clears a memory slot. The %1 is the index of the memory slot. For example, users might hear "Memory slot 2 cleared".</comment>
|
||||
</data>
|
||||
<data name="divideButton.[using:CalculatorApp.Controls]CalculatorButton.AuditoryFeedback" xml:space="preserve">
|
||||
|
@ -2772,11 +2772,11 @@
|
|||
<comment>Access key for the Clear memory button. {StringCategory="Accelerator"}</comment>
|
||||
</data>
|
||||
<data name="ClearMemory.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
|
||||
<value>清除所有内存(Ctrl+L)</value>
|
||||
<value>清除所有记忆(Ctrl+L)</value>
|
||||
<comment>This is the tool tip automation name for the Clear Memory button in the Memory Pane.</comment>
|
||||
</data>
|
||||
<data name="ClearMemory.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
|
||||
<value>清除所有内存</value>
|
||||
<value>清除所有记忆</value>
|
||||
<comment>Screen reader prompt for the Calculator Clear Memory button in the Memory Pane</comment>
|
||||
</data>
|
||||
<data name="HistoryLabel.AccessKey" xml:space="preserve">
|
||||
|
@ -3216,7 +3216,7 @@
|
|||
<comment>Label for a radio button that toggles rotate circular behavior for the shift operations.</comment>
|
||||
</data>
|
||||
<data name="rotateCarryShiftButton.Content" xml:space="preserve">
|
||||
<value>通过循环移位旋转</value>
|
||||
<value>带进位旋转循</value>
|
||||
<comment>Label for a radio button that toggles rotate circular with carry behavior for the shift operations.</comment>
|
||||
</data>
|
||||
<data name="cubeRootButton.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
|
||||
|
@ -4095,11 +4095,11 @@
|
|||
<comment>Screen reader prompt for the graph options panel</comment>
|
||||
</data>
|
||||
<data name="DockPanel_HistoryMemoryLists" xml:space="preserve">
|
||||
<value>历史记录和内存列表</value>
|
||||
<value>历史记录和记忆列表</value>
|
||||
<comment>Automation name for the group of controls for history and memory lists.</comment>
|
||||
</data>
|
||||
<data name="DockPanel_MemoryList" xml:space="preserve">
|
||||
<value>内存列表</value>
|
||||
<value>记忆列表</value>
|
||||
<comment>Automation name for the group of controls for memory list.</comment>
|
||||
</data>
|
||||
<data name="Format_HistorySlotCleared" xml:space="preserve">
|
||||
|
@ -4123,11 +4123,11 @@
|
|||
<comment>Label for a radio button that toggles logical shift behavior for the shift operations.</comment>
|
||||
</data>
|
||||
<data name="rotateCircularButtonSelected" xml:space="preserve">
|
||||
<value>旋转所选循环移位</value>
|
||||
<value>已选择旋转循环移位</value>
|
||||
<comment>Label for a radio button that toggles rotate circular behavior for the shift operations.</comment>
|
||||
</data>
|
||||
<data name="rotateCarryShiftButtonSelected" xml:space="preserve">
|
||||
<value>通过所选循环移位旋转</value>
|
||||
<value>已选择带进位旋转循环移位</value>
|
||||
<comment>Label for a radio button that toggles rotate circular with carry behavior for the shift operations.</comment>
|
||||
</data>
|
||||
</root>
|
|
@ -866,7 +866,9 @@
|
|||
Checked="ShiftButton_Check"
|
||||
Content=""
|
||||
IsEnabledChanged="ShiftButton_IsEnabledChanged"
|
||||
Unchecked="ShiftButton_Check"/>
|
||||
Unchecked="ShiftButton_Check"
|
||||
AllowFocusOnInteraction="False"
|
||||
/>
|
||||
|
||||
<controls:CalculatorButton x:Name="PiButton"
|
||||
x:Uid="piButton"
|
||||
|
|
|
@ -135,6 +135,7 @@
|
|||
Margin="8,0,8,-6"
|
||||
VerticalAlignment="Center"
|
||||
DataContext="{x:Bind}"
|
||||
SmallChange="{x:Bind Step, Mode=TwoWay}"
|
||||
StepFrequency="{x:Bind Step, Mode=TwoWay}"
|
||||
ValueChanged="Slider_ValueChanged"
|
||||
Value="{x:Bind Value, Mode=TwoWay}"
|
||||
|
|
|
@ -80,7 +80,7 @@ public
|
|||
void AnnounceCategoryName();
|
||||
|
||||
CalculatorApp::Calculator ^ m_calculator;
|
||||
GraphingCalculator^ m_graphingCalculator;
|
||||
GraphingCalculator ^ m_graphingCalculator;
|
||||
CalculatorApp::UnitConverter ^ m_converter;
|
||||
CalculatorApp::DateCalculator ^ m_dateCalculator;
|
||||
CalculatorApp::SettingsPage ^ m_settings;
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.UI.Xaml" version="2.4.3" targetFramework="native" />
|
||||
<package id="Microsoft.WindowsCalculator.PGO" version="1.0.2" targetFramework="native" />
|
||||
</packages>
|
||||
|
|
|
@ -718,24 +718,26 @@ namespace CalculatorManagerTest
|
|||
|
||||
void CalculatorManagerTest::CalculatorManagerTestProgrammer()
|
||||
{
|
||||
Command commands1[] = { Command::ModeProgrammer, Command::Command5, Command::Command3, Command::CommandNand,
|
||||
Command::Command8, Command::Command3, Command::CommandAnd, Command::CommandNULL };
|
||||
Command commands1[] = { Command::ModeProgrammer, Command::Command5, Command::Command3, Command::CommandNand,
|
||||
Command::Command8, Command::Command3, Command::CommandAnd, Command::CommandNULL };
|
||||
TestDriver::Test(L"-18", L"53 NAND 83 AND ", commands1, true, false);
|
||||
|
||||
Command commands2[] = { Command::ModeProgrammer, Command::Command5, Command::Command3, Command::CommandNor,
|
||||
Command::Command8, Command::Command3, Command::CommandAnd, Command::CommandNULL };
|
||||
Command commands2[] = { Command::ModeProgrammer, Command::Command5, Command::Command3, Command::CommandNor,
|
||||
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 };
|
||||
|
@ -1014,147 +1016,139 @@ namespace CalculatorManagerTest
|
|||
VERIFY_ARE_EQUAL(result, L"-3.432432e-09");
|
||||
}
|
||||
|
||||
void CalculatorManagerTest::CalculatorManagerTestBinaryOperatorReceived()
|
||||
{
|
||||
CalculatorManagerDisplayTester* pCalculatorDisplay = (CalculatorManagerDisplayTester *)m_calculatorDisplayTester.get();
|
||||
void CalculatorManagerTest::CalculatorManagerTestBinaryOperatorReceived()
|
||||
{
|
||||
CalculatorManagerDisplayTester* pCalculatorDisplay = (CalculatorManagerDisplayTester*)m_calculatorDisplayTester.get();
|
||||
|
||||
VERIFY_ARE_EQUAL(0, pCalculatorDisplay->GetBinaryOperatorReceivedCallCount());
|
||||
VERIFY_ARE_EQUAL(0, pCalculatorDisplay->GetBinaryOperatorReceivedCallCount());
|
||||
|
||||
m_calculatorManager->SetStandardMode();
|
||||
ExecuteCommands({
|
||||
Command::Command1,
|
||||
Command::CommandADD
|
||||
});
|
||||
m_calculatorManager->SetStandardMode();
|
||||
ExecuteCommands({ Command::Command1, Command::CommandADD });
|
||||
|
||||
wstring display = pCalculatorDisplay->GetPrimaryDisplay();
|
||||
VERIFY_ARE_EQUAL(L"1", display);
|
||||
wstring display = pCalculatorDisplay->GetPrimaryDisplay();
|
||||
VERIFY_ARE_EQUAL(L"1", display);
|
||||
|
||||
// Verify BinaryOperatorReceived
|
||||
VERIFY_ARE_EQUAL(1, pCalculatorDisplay->GetBinaryOperatorReceivedCallCount());
|
||||
}
|
||||
// Verify BinaryOperatorReceived
|
||||
VERIFY_ARE_EQUAL(1, pCalculatorDisplay->GetBinaryOperatorReceivedCallCount());
|
||||
}
|
||||
|
||||
void CalculatorManagerTest::CalculatorManagerTestBinaryOperatorReceived_Multiple()
|
||||
{
|
||||
CalculatorManagerDisplayTester* pCalculatorDisplay = (CalculatorManagerDisplayTester *)m_calculatorDisplayTester.get();
|
||||
void CalculatorManagerTest::CalculatorManagerTestBinaryOperatorReceived_Multiple()
|
||||
{
|
||||
CalculatorManagerDisplayTester* pCalculatorDisplay = (CalculatorManagerDisplayTester*)m_calculatorDisplayTester.get();
|
||||
|
||||
VERIFY_ARE_EQUAL(0, pCalculatorDisplay->GetBinaryOperatorReceivedCallCount());
|
||||
VERIFY_ARE_EQUAL(0, pCalculatorDisplay->GetBinaryOperatorReceivedCallCount());
|
||||
|
||||
m_calculatorManager->SetStandardMode();
|
||||
ExecuteCommands({
|
||||
Command::Command1,
|
||||
Command::CommandADD,
|
||||
Command::CommandSUB,
|
||||
Command::CommandMUL
|
||||
});
|
||||
m_calculatorManager->SetStandardMode();
|
||||
ExecuteCommands({ Command::Command1, Command::CommandADD, Command::CommandSUB, Command::CommandMUL });
|
||||
|
||||
wstring display = pCalculatorDisplay->GetPrimaryDisplay();
|
||||
VERIFY_ARE_EQUAL(L"1", display);
|
||||
wstring display = pCalculatorDisplay->GetPrimaryDisplay();
|
||||
VERIFY_ARE_EQUAL(L"1", display);
|
||||
|
||||
// Verify BinaryOperatorReceived
|
||||
VERIFY_ARE_EQUAL(3, pCalculatorDisplay->GetBinaryOperatorReceivedCallCount());
|
||||
}
|
||||
// Verify BinaryOperatorReceived
|
||||
VERIFY_ARE_EQUAL(3, pCalculatorDisplay->GetBinaryOperatorReceivedCallCount());
|
||||
}
|
||||
|
||||
void CalculatorManagerTest::CalculatorManagerTestBinaryOperatorReceived_LongInput()
|
||||
{
|
||||
CalculatorManagerDisplayTester* pCalculatorDisplay = (CalculatorManagerDisplayTester *)m_calculatorDisplayTester.get();
|
||||
void CalculatorManagerTest::CalculatorManagerTestBinaryOperatorReceived_LongInput()
|
||||
{
|
||||
CalculatorManagerDisplayTester* pCalculatorDisplay = (CalculatorManagerDisplayTester*)m_calculatorDisplayTester.get();
|
||||
|
||||
VERIFY_ARE_EQUAL(0, pCalculatorDisplay->GetBinaryOperatorReceivedCallCount());
|
||||
VERIFY_ARE_EQUAL(0, pCalculatorDisplay->GetBinaryOperatorReceivedCallCount());
|
||||
|
||||
m_calculatorManager->SetStandardMode();
|
||||
ExecuteCommands({
|
||||
Command::Command1,
|
||||
Command::CommandADD,
|
||||
Command::Command2,
|
||||
Command::CommandMUL,
|
||||
Command::Command1,
|
||||
Command::Command0,
|
||||
Command::CommandSUB,
|
||||
Command::Command5,
|
||||
Command::CommandDIV,
|
||||
Command::Command5,
|
||||
Command::CommandEQU
|
||||
});
|
||||
m_calculatorManager->SetStandardMode();
|
||||
ExecuteCommands({ Command::Command1,
|
||||
Command::CommandADD,
|
||||
Command::Command2,
|
||||
Command::CommandMUL,
|
||||
Command::Command1,
|
||||
Command::Command0,
|
||||
Command::CommandSUB,
|
||||
Command::Command5,
|
||||
Command::CommandDIV,
|
||||
Command::Command5,
|
||||
Command::CommandEQU });
|
||||
|
||||
wstring display = pCalculatorDisplay->GetPrimaryDisplay();
|
||||
VERIFY_ARE_EQUAL(L"5", display);
|
||||
wstring display = pCalculatorDisplay->GetPrimaryDisplay();
|
||||
VERIFY_ARE_EQUAL(L"5", display);
|
||||
|
||||
// Verify BinaryOperatorReceived
|
||||
VERIFY_ARE_EQUAL(4, pCalculatorDisplay->GetBinaryOperatorReceivedCallCount());
|
||||
}
|
||||
// Verify BinaryOperatorReceived
|
||||
VERIFY_ARE_EQUAL(4, pCalculatorDisplay->GetBinaryOperatorReceivedCallCount());
|
||||
}
|
||||
|
||||
void CalculatorManagerTest::CalculatorManagerTestStandardOrderOfOperations()
|
||||
{
|
||||
Command commands1[] = { Command::Command1, Command::CommandREC, Command::CommandNULL };
|
||||
TestDriver::Test(L"1", L"1/(1)", commands1);
|
||||
void CalculatorManagerTest::CalculatorManagerTestStandardOrderOfOperations()
|
||||
{
|
||||
Command commands1[] = { Command::Command1, Command::CommandREC, Command::CommandNULL };
|
||||
TestDriver::Test(L"1", L"1/(1)", commands1);
|
||||
|
||||
Command commands2[] = { Command::Command4, Command::CommandSQRT, Command::CommandNULL };
|
||||
TestDriver::Test(L"2", L"\x221A(4)", commands2);
|
||||
Command commands2[] = { Command::Command4, Command::CommandSQRT, Command::CommandNULL };
|
||||
TestDriver::Test(L"2", L"\x221A(4)", commands2);
|
||||
|
||||
Command commands3[] = { Command::Command1, Command::CommandADD, Command::Command4, Command::CommandSQRT, Command::CommandNULL };
|
||||
TestDriver::Test(L"2", L"1 + \x221A(4)", commands3);
|
||||
Command commands3[] = { Command::Command1, Command::CommandADD, Command::Command4, Command::CommandSQRT, Command::CommandNULL };
|
||||
TestDriver::Test(L"2", L"1 + \x221A(4)", commands3);
|
||||
|
||||
Command commands4[] = { Command::Command1, Command::CommandADD, Command::Command4, Command::CommandSQRT, Command::CommandSUB, Command::CommandNULL };
|
||||
TestDriver::Test(L"3", L"3 - ", commands4);
|
||||
Command commands4[] = { Command::Command1, Command::CommandADD, Command::Command4, Command::CommandSQRT, Command::CommandSUB, Command::CommandNULL };
|
||||
TestDriver::Test(L"3", L"3 - ", commands4);
|
||||
|
||||
Command commands5[] = { Command::Command2, Command::CommandMUL, Command::Command4, Command::CommandREC, Command::CommandNULL };
|
||||
TestDriver::Test(L"0.25", L"2 \x00D7 1/(4)", commands5);
|
||||
Command commands5[] = { Command::Command2, Command::CommandMUL, Command::Command4, Command::CommandREC, Command::CommandNULL };
|
||||
TestDriver::Test(L"0.25", L"2 \x00D7 1/(4)", commands5);
|
||||
|
||||
Command commands6[] = { Command::Command5, Command::CommandDIV, Command::Command6, Command::CommandPERCENT, Command::CommandNULL};
|
||||
TestDriver::Test(L"0.06", L"5 \x00F7 0.06", commands6);
|
||||
Command commands6[] = { Command::Command5, Command::CommandDIV, Command::Command6, Command::CommandPERCENT, Command::CommandNULL };
|
||||
TestDriver::Test(L"0.06", L"5 \x00F7 0.06", commands6);
|
||||
|
||||
Command commands7[] = { Command::Command4, Command::CommandSQRT, Command::CommandSUB, Command::CommandNULL };
|
||||
TestDriver::Test(L"2", L"\x221A(4) - ", commands7);
|
||||
Command commands7[] = { Command::Command4, Command::CommandSQRT, Command::CommandSUB, Command::CommandNULL };
|
||||
TestDriver::Test(L"2", L"\x221A(4) - ", commands7);
|
||||
|
||||
Command commands8[] = { Command::Command7, Command::CommandSQR, Command::CommandDIV, Command::CommandNULL };
|
||||
TestDriver::Test(L"49", L"sqr(7) \x00F7 ", commands8);
|
||||
Command commands8[] = { Command::Command7, Command::CommandSQR, Command::CommandDIV, Command::CommandNULL };
|
||||
TestDriver::Test(L"49", L"sqr(7) \x00F7 ", commands8);
|
||||
|
||||
Command commands9[] = { Command::Command8, Command::CommandSQR, Command::CommandSQRT, Command::CommandNULL };
|
||||
TestDriver::Test(L"8", L"\x221A(sqr(8))", commands9);
|
||||
Command commands9[] = { Command::Command8, Command::CommandSQR, Command::CommandSQRT, Command::CommandNULL };
|
||||
TestDriver::Test(L"8", L"\x221A(sqr(8))", commands9);
|
||||
|
||||
Command commands10[] = { Command::Command1, Command::Command0, Command::CommandADD, Command::Command2, Command::CommandSUB, Command::CommandNULL };
|
||||
TestDriver::Test(L"12", L"12 - ", commands10);
|
||||
Command commands10[] = { Command::Command1, Command::Command0, Command::CommandADD, Command::Command2, Command::CommandSUB, Command::CommandNULL };
|
||||
TestDriver::Test(L"12", L"12 - ", commands10);
|
||||
|
||||
Command commands11[] = { Command::Command3, Command::CommandMUL, Command::Command4, Command::CommandDIV, Command::CommandNULL };
|
||||
TestDriver::Test(L"12", L"12 \x00F7 ", commands11);
|
||||
Command commands11[] = { Command::Command3, Command::CommandMUL, Command::Command4, Command::CommandDIV, Command::CommandNULL };
|
||||
TestDriver::Test(L"12", L"12 \x00F7 ", commands11);
|
||||
|
||||
Command commands12[] = { Command::Command6, Command::CommandDIV, Command::Command3, Command::CommandSUB, Command::CommandADD, Command::CommandNULL };
|
||||
TestDriver::Test(L"2", L"2 + ", commands12);
|
||||
Command commands12[] = { Command::Command6, Command::CommandDIV, Command::Command3, Command::CommandSUB, Command::CommandADD, Command::CommandNULL };
|
||||
TestDriver::Test(L"2", L"2 + ", commands12);
|
||||
|
||||
Command commands13[] = { Command::Command7, Command::CommandSUB, Command::Command4, Command::CommandDIV, Command::CommandMUL, Command::CommandNULL };
|
||||
TestDriver::Test(L"3", L"3 \x00D7 ", commands13);
|
||||
Command commands13[] = { Command::Command7, Command::CommandSUB, Command::Command4, Command::CommandDIV, Command::CommandMUL, Command::CommandNULL };
|
||||
TestDriver::Test(L"3", L"3 \x00D7 ", commands13);
|
||||
|
||||
Command commands14[] = { Command::Command8, Command::CommandMUL, Command::Command2, Command::CommandADD, Command::CommandSQRT, Command::CommandNULL };
|
||||
TestDriver::Test(L"4", L"16 + \x221A(16)", commands14);
|
||||
Command commands14[] = { Command::Command8, Command::CommandMUL, Command::Command2, Command::CommandADD, Command::CommandSQRT, Command::CommandNULL };
|
||||
TestDriver::Test(L"4", L"16 + \x221A(16)", commands14);
|
||||
|
||||
Command commands15[] = { Command::Command9, Command::CommandADD, Command::Command0, Command::CommandMUL, Command::CommandSIGN, Command::CommandNULL };
|
||||
TestDriver::Test(L"-9", L"9 \x00D7 negate(9)", commands15);
|
||||
Command commands15[] = { Command::Command9, Command::CommandADD, Command::Command0, Command::CommandMUL, Command::CommandSIGN, Command::CommandNULL };
|
||||
TestDriver::Test(L"-9", L"9 \x00D7 negate(9)", commands15);
|
||||
|
||||
Command commands16[] = { Command::Command9, Command::CommandSIGN, Command::Command0, Command::CommandADD, Command::CommandMUL, Command::CommandNULL };
|
||||
TestDriver::Test(L"-90", L"-90 \x00D7 ", commands16);
|
||||
Command commands16[] = { Command::Command9, Command::CommandSIGN, Command::Command0, Command::CommandADD, Command::CommandMUL, Command::CommandNULL };
|
||||
TestDriver::Test(L"-90", L"-90 \x00D7 ", commands16);
|
||||
|
||||
Command commands17[] = { Command::Command1, Command::CommandADD, Command::Command2, Command::CommandEQU, Command::CommandNULL };
|
||||
TestDriver::Test(L"3", L"1 + 2=", commands17);
|
||||
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 };
|
||||
TestDriver::Test(L"40", L"20 \x00D7 2=", commands18);
|
||||
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 };
|
||||
TestDriver::Test(L"3", L"3 + ", commands19);
|
||||
Command commands19[] = { Command::Command1, Command::CommandADD, Command::Command2, Command::CommandADD, Command::CommandBACK, Command::CommandNULL };
|
||||
TestDriver::Test(L"3", L"3 + ", commands19);
|
||||
|
||||
Command commands20[] = { Command::Command1, Command::CommandADD, Command::Command2, Command::CommandADD, Command::CommandCLEAR, Command::CommandNULL };
|
||||
TestDriver::Test(L"0", L"", commands20);
|
||||
Command commands20[] = { Command::Command1, Command::CommandADD, Command::Command2, Command::CommandADD, Command::CommandCLEAR, Command::CommandNULL };
|
||||
TestDriver::Test(L"0", L"", commands20);
|
||||
|
||||
Command commands21[] = { Command::Command1, Command::CommandADD, Command::Command2, Command::CommandADD, Command::CommandCENTR, Command::CommandNULL };
|
||||
TestDriver::Test(L"0", L"3 + ", commands21);
|
||||
Command commands21[] = { Command::Command1, Command::CommandADD, Command::Command2, Command::CommandADD, Command::CommandCENTR, Command::CommandNULL };
|
||||
TestDriver::Test(L"0", L"3 + ", commands21);
|
||||
|
||||
Command commands22[] = { Command::Command1, Command::CommandADD, Command::Command2, Command::CommandCLEAR, Command::CommandNULL };
|
||||
TestDriver::Test(L"0", L"", commands22);
|
||||
Command commands22[] = { Command::Command1, Command::CommandADD, Command::Command2, Command::CommandCLEAR, Command::CommandNULL };
|
||||
TestDriver::Test(L"0", L"", commands22);
|
||||
|
||||
Command commands23[] = { Command::Command1, Command::CommandADD, Command::Command2, Command::CommandCENTR, Command::CommandNULL };
|
||||
TestDriver::Test(L"0", L"1 + ", commands23);
|
||||
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 };
|
||||
TestDriver::Test(L"120", L"120 \x00D7 ", commands24);
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
} /* namespace CalculationManagerUnitTests */
|
||||
|
|
|
@ -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*/,
|
||||
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" };
|
||||
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" };
|
||||
|
||||
ASSERT_POSITIVE_TESTCASES(ValidateScientificPasteExpression, positiveInput);
|
||||
ASSERT_NEGATIVE_TESTCASES(ValidateScientificPasteExpression, negativeInput);
|
||||
|
@ -1221,10 +1199,17 @@ 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= ",
|
||||
L"127%71", L"1777777777777777777777" /*boundary condition: the max allowed number*/ };
|
||||
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",
|
||||
L"1''2",
|
||||
|
@ -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",
|
||||
|
|
|
@ -380,250 +380,250 @@ 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; });
|
||||
}
|
||||
|
||||
TEST_METHOD(Loaded_LoadOrderedUnits)
|
||||
{
|
||||
StandardCacheSetup();
|
||||
CurrencyDataLoader loader(nullptr, L"en-US");
|
||||
|
||||
auto data_loaded_event = task_completion_event<void>();
|
||||
loader.SetViewModelCallback(make_shared<DataLoadedCallback>(data_loaded_event));
|
||||
|
||||
auto data_loaded_task = create_task(data_loaded_event);
|
||||
loader.LoadData();
|
||||
data_loaded_task.wait();
|
||||
|
||||
VERIFY_IS_TRUE(loader.LoadFinished());
|
||||
VERIFY_IS_TRUE(loader.LoadedFromCache());
|
||||
VERIFY_IS_FALSE(loader.LoadedFromWeb());
|
||||
|
||||
vector<UCM::Unit> unitList = loader.GetOrderedUnits(CURRENCY_CATEGORY);
|
||||
VERIFY_ARE_EQUAL(size_t{ 2 }, unitList.size());
|
||||
|
||||
const UCM::Unit usdUnit = GetUnit(unitList, L"USD");
|
||||
const UCM::Unit eurUnit = GetUnit(unitList, L"EUR");
|
||||
|
||||
VERIFY_ARE_EQUAL(wstring(L"United States - Dollar"), usdUnit.name);
|
||||
VERIFY_ARE_EQUAL(wstring(L"USD"), usdUnit.abbreviation);
|
||||
|
||||
VERIFY_ARE_EQUAL(wstring(L"Europe - Euro"), eurUnit.name);
|
||||
VERIFY_ARE_EQUAL(wstring(L"EUR"), eurUnit.abbreviation);
|
||||
}
|
||||
|
||||
TEST_METHOD(Loaded_LoadOrderedRatios)
|
||||
{
|
||||
StandardCacheSetup();
|
||||
|
||||
CurrencyDataLoader loader(nullptr, L"en-US");
|
||||
|
||||
auto data_loaded_event = task_completion_event<void>();
|
||||
loader.SetViewModelCallback(make_shared<DataLoadedCallback>(data_loaded_event));
|
||||
|
||||
auto data_loaded_task = create_task(data_loaded_event);
|
||||
loader.LoadData();
|
||||
data_loaded_task.wait();
|
||||
|
||||
VERIFY_IS_TRUE(loader.LoadFinished());
|
||||
VERIFY_IS_TRUE(loader.LoadedFromCache());
|
||||
VERIFY_IS_FALSE(loader.LoadedFromWeb());
|
||||
|
||||
vector<UCM::Unit> unitList = loader.GetOrderedUnits(CURRENCY_CATEGORY);
|
||||
VERIFY_ARE_EQUAL(size_t{ 2 }, unitList.size());
|
||||
|
||||
const UCM::Unit usdUnit = GetUnit(unitList, L"USD");
|
||||
const UCM::Unit eurUnit = GetUnit(unitList, L"EUR");
|
||||
|
||||
unordered_map<UCM::Unit, UCM::ConversionData, UCM::UnitHash> ratios = loader.LoadOrderedRatios(usdUnit);
|
||||
VERIFY_ARE_EQUAL(size_t{ 2 }, ratios.size());
|
||||
|
||||
UCM::ConversionData usdRatioData = ratios[usdUnit];
|
||||
VERIFY_IS_TRUE((std::abs(1.0 - usdRatioData.ratio) < 1e-1));
|
||||
|
||||
UCM::ConversionData eurRatioData = ratios[eurUnit];
|
||||
VERIFY_IS_TRUE((std::abs(0.920503 - eurRatioData.ratio) < 1e-6));
|
||||
}
|
||||
|
||||
TEST_METHOD(Loaded_GetCurrencySymbols_Valid)
|
||||
{
|
||||
StandardCacheSetup();
|
||||
|
||||
CurrencyDataLoader loader(nullptr, L"en-US");
|
||||
|
||||
auto data_loaded_event = task_completion_event<void>();
|
||||
loader.SetViewModelCallback(make_shared<DataLoadedCallback>(data_loaded_event));
|
||||
|
||||
auto data_loaded_task = create_task(data_loaded_event);
|
||||
loader.LoadData();
|
||||
data_loaded_task.wait();
|
||||
|
||||
VERIFY_IS_TRUE(loader.LoadFinished());
|
||||
VERIFY_IS_TRUE(loader.LoadedFromCache());
|
||||
VERIFY_IS_FALSE(loader.LoadedFromWeb());
|
||||
|
||||
vector<UCM::Unit> unitList = loader.GetOrderedUnits(CURRENCY_CATEGORY);
|
||||
VERIFY_ARE_EQUAL(size_t{ 2 }, unitList.size());
|
||||
|
||||
const UCM::Unit usdUnit = GetUnit(unitList, L"USD");
|
||||
const UCM::Unit eurUnit = GetUnit(unitList, L"EUR");
|
||||
|
||||
const pair<wstring, wstring> symbols = loader.GetCurrencySymbols(usdUnit, eurUnit);
|
||||
|
||||
VERIFY_ARE_EQUAL(wstring(L"$"), symbols.first);
|
||||
VERIFY_ARE_EQUAL(wstring(L"\x20ac"), symbols.second); // €
|
||||
}
|
||||
|
||||
TEST_METHOD(Loaded_GetCurrencySymbols_Invalid)
|
||||
{
|
||||
StandardCacheSetup();
|
||||
|
||||
CurrencyDataLoader loader(nullptr, L"en-US");
|
||||
|
||||
auto data_loaded_event = task_completion_event<void>();
|
||||
loader.SetViewModelCallback(make_shared<DataLoadedCallback>(data_loaded_event));
|
||||
|
||||
auto data_loaded_task = create_task(data_loaded_event);
|
||||
loader.LoadData();
|
||||
data_loaded_task.wait();
|
||||
|
||||
VERIFY_IS_TRUE(loader.LoadFinished());
|
||||
VERIFY_IS_TRUE(loader.LoadedFromCache());
|
||||
VERIFY_IS_FALSE(loader.LoadedFromWeb());
|
||||
|
||||
const UCM::Unit fakeUnit1 = { 1, L"fakeUnit1", L"FUD1", false, false, false };
|
||||
|
||||
const UCM::Unit fakeUnit2 = { 2, L"fakeUnit2", L"FUD2", false, false, false };
|
||||
|
||||
pair<wstring, wstring> symbols = loader.GetCurrencySymbols(fakeUnit1, fakeUnit2);
|
||||
|
||||
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.GetOrderedUnits(CURRENCY_CATEGORY);
|
||||
VERIFY_ARE_EQUAL(size_t{ 2 }, unitList.size());
|
||||
|
||||
const UCM::Unit usdUnit = GetUnit(unitList, L"USD");
|
||||
|
||||
symbols = loader.GetCurrencySymbols(fakeUnit1, usdUnit);
|
||||
|
||||
VERIFY_ARE_EQUAL(wstring(L""), symbols.first);
|
||||
VERIFY_ARE_EQUAL(wstring(L""), symbols.second);
|
||||
|
||||
symbols = loader.GetCurrencySymbols(usdUnit, fakeUnit1);
|
||||
|
||||
VERIFY_ARE_EQUAL(wstring(L""), symbols.first);
|
||||
VERIFY_ARE_EQUAL(wstring(L""), symbols.second);
|
||||
}
|
||||
|
||||
TEST_METHOD(Loaded_GetCurrencyRatioEquality_Valid)
|
||||
{
|
||||
StandardCacheSetup();
|
||||
|
||||
CurrencyDataLoader loader(nullptr, L"en-US");
|
||||
|
||||
auto data_loaded_event = task_completion_event<void>();
|
||||
loader.SetViewModelCallback(make_shared<DataLoadedCallback>(data_loaded_event));
|
||||
|
||||
auto data_loaded_task = create_task(data_loaded_event);
|
||||
loader.LoadData();
|
||||
data_loaded_task.wait();
|
||||
|
||||
VERIFY_IS_TRUE(loader.LoadFinished());
|
||||
VERIFY_IS_TRUE(loader.LoadedFromCache());
|
||||
VERIFY_IS_FALSE(loader.LoadedFromWeb());
|
||||
|
||||
vector<UCM::Unit> unitList = loader.GetOrderedUnits(CURRENCY_CATEGORY);
|
||||
VERIFY_ARE_EQUAL(size_t{ 2 }, unitList.size());
|
||||
|
||||
const UCM::Unit usdUnit = GetUnit(unitList, L"USD");
|
||||
const UCM::Unit eurUnit = GetUnit(unitList, L"EUR");
|
||||
|
||||
const pair<wstring, wstring> ratio = loader.GetCurrencyRatioEquality(usdUnit, eurUnit);
|
||||
|
||||
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)
|
||||
{
|
||||
StandardCacheSetup();
|
||||
|
||||
CurrencyDataLoader loader(nullptr, L"en-US");
|
||||
|
||||
auto data_loaded_event = task_completion_event<void>();
|
||||
loader.SetViewModelCallback(make_shared<DataLoadedCallback>(data_loaded_event));
|
||||
|
||||
auto data_loaded_task = create_task(data_loaded_event);
|
||||
loader.LoadData();
|
||||
data_loaded_task.wait();
|
||||
|
||||
VERIFY_IS_TRUE(loader.LoadFinished());
|
||||
VERIFY_IS_TRUE(loader.LoadedFromCache());
|
||||
VERIFY_IS_FALSE(loader.LoadedFromWeb());
|
||||
|
||||
const UCM::Unit fakeUnit1 = { 1, L"fakeUnit1", L"fakeCountry1", L"FUD1", false, false, false };
|
||||
const UCM::Unit fakeUnit2 = { 2, L"fakeUnit2", L"fakeCountry2", L"FUD2", false, false, false };
|
||||
|
||||
pair<wstring, wstring> ratio = loader.GetCurrencyRatioEquality(fakeUnit1, fakeUnit2);
|
||||
|
||||
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.GetOrderedUnits(CURRENCY_CATEGORY);
|
||||
VERIFY_ARE_EQUAL(size_t{ 2 }, unitList.size());
|
||||
|
||||
const UCM::Unit usdUnit = GetUnit(unitList, L"USD");
|
||||
|
||||
ratio = loader.GetCurrencyRatioEquality(fakeUnit1, usdUnit);
|
||||
|
||||
VERIFY_ARE_EQUAL(wstring(L""), ratio.first);
|
||||
VERIFY_ARE_EQUAL(wstring(L""), ratio.second);
|
||||
|
||||
ratio = loader.GetCurrencyRatioEquality(usdUnit, fakeUnit1);
|
||||
|
||||
VERIFY_ARE_EQUAL(wstring(L""), ratio.first);
|
||||
VERIFY_ARE_EQUAL(wstring(L""), ratio.second);
|
||||
}
|
||||
|
||||
TEST_METHOD(Test_RoundCurrencyRatio)
|
||||
{
|
||||
CurrencyDataLoader loader{ nullptr };
|
||||
VERIFY_ARE_EQUAL(CurrencyDataLoader::RoundCurrencyRatio(1234567), 1234567);
|
||||
VERIFY_ARE_EQUAL(CurrencyDataLoader::RoundCurrencyRatio(0), 0);
|
||||
VERIFY_ARE_EQUAL(CurrencyDataLoader::RoundCurrencyRatio(9999.999), 9999.999);
|
||||
VERIFY_ARE_EQUAL(CurrencyDataLoader::RoundCurrencyRatio(8765.4321), 8765.4321);
|
||||
VERIFY_ARE_EQUAL(CurrencyDataLoader::RoundCurrencyRatio(4815.162342), 4815.1623);
|
||||
VERIFY_ARE_EQUAL(CurrencyDataLoader::RoundCurrencyRatio(4815.162358), 4815.1624);
|
||||
VERIFY_ARE_EQUAL(CurrencyDataLoader::RoundCurrencyRatio(4815.162388934723), 4815.1624);
|
||||
VERIFY_ARE_EQUAL(CurrencyDataLoader::RoundCurrencyRatio(0.12), 0.12);
|
||||
VERIFY_ARE_EQUAL(CurrencyDataLoader::RoundCurrencyRatio(0.123), 0.123);
|
||||
VERIFY_ARE_EQUAL(CurrencyDataLoader::RoundCurrencyRatio(0.1234), 0.1234);
|
||||
VERIFY_ARE_EQUAL(CurrencyDataLoader::RoundCurrencyRatio(0.12343), 0.1234);
|
||||
VERIFY_ARE_EQUAL(CurrencyDataLoader::RoundCurrencyRatio(0.0321), 0.0321);
|
||||
VERIFY_ARE_EQUAL(CurrencyDataLoader::RoundCurrencyRatio(0.03211), 0.03211);
|
||||
VERIFY_ARE_EQUAL(CurrencyDataLoader::RoundCurrencyRatio(0.032119), 0.03212);
|
||||
VERIFY_ARE_EQUAL(CurrencyDataLoader::RoundCurrencyRatio(0.00322119), 0.003221);
|
||||
VERIFY_ARE_EQUAL(CurrencyDataLoader::RoundCurrencyRatio(0.00123269), 0.001233);
|
||||
VERIFY_ARE_EQUAL(CurrencyDataLoader::RoundCurrencyRatio(0.00076269), 0.0007627);
|
||||
VERIFY_ARE_EQUAL(CurrencyDataLoader::RoundCurrencyRatio(0.000069), 0.000069);
|
||||
VERIFY_ARE_EQUAL(CurrencyDataLoader::RoundCurrencyRatio(0.000061), 0.000061);
|
||||
VERIFY_ARE_EQUAL(CurrencyDataLoader::RoundCurrencyRatio(0.000054612), 0.00005461);
|
||||
VERIFY_ARE_EQUAL(CurrencyDataLoader::RoundCurrencyRatio(0.000054616), 0.00005462);
|
||||
VERIFY_ARE_EQUAL(CurrencyDataLoader::RoundCurrencyRatio(0.000005416), 0.000005416);
|
||||
VERIFY_ARE_EQUAL(CurrencyDataLoader::RoundCurrencyRatio(0.0000016134324), 0.000001613);
|
||||
VERIFY_ARE_EQUAL(CurrencyDataLoader::RoundCurrencyRatio(0.0000096134324), 0.000009613);
|
||||
VERIFY_ARE_EQUAL(CurrencyDataLoader::RoundCurrencyRatio(0.0000032169348392), 0.000003217);
|
||||
VERIFY_ARE_EQUAL(CurrencyDataLoader::RoundCurrencyRatio(0.000000002134987218), 0.000000002135);
|
||||
VERIFY_ARE_EQUAL(CurrencyDataLoader::RoundCurrencyRatio(0.000000000000087231445), 0.00000000000008723);
|
||||
}
|
||||
}
|
||||
;
|
||||
}
|
||||
|
||||
TEST_METHOD(Loaded_LoadOrderedUnits)
|
||||
{
|
||||
StandardCacheSetup();
|
||||
CurrencyDataLoader loader(nullptr, L"en-US");
|
||||
|
||||
auto data_loaded_event = task_completion_event<void>();
|
||||
loader.SetViewModelCallback(make_shared<DataLoadedCallback>(data_loaded_event));
|
||||
|
||||
auto data_loaded_task = create_task(data_loaded_event);
|
||||
loader.LoadData();
|
||||
data_loaded_task.wait();
|
||||
|
||||
VERIFY_IS_TRUE(loader.LoadFinished());
|
||||
VERIFY_IS_TRUE(loader.LoadedFromCache());
|
||||
VERIFY_IS_FALSE(loader.LoadedFromWeb());
|
||||
|
||||
vector<UCM::Unit> unitList = loader.GetOrderedUnits(CURRENCY_CATEGORY);
|
||||
VERIFY_ARE_EQUAL(size_t{ 2 }, unitList.size());
|
||||
|
||||
const UCM::Unit usdUnit = GetUnit(unitList, L"USD");
|
||||
const UCM::Unit eurUnit = GetUnit(unitList, L"EUR");
|
||||
|
||||
VERIFY_ARE_EQUAL(wstring(L"United States - Dollar"), usdUnit.name);
|
||||
VERIFY_ARE_EQUAL(wstring(L"USD"), usdUnit.abbreviation);
|
||||
|
||||
VERIFY_ARE_EQUAL(wstring(L"Europe - Euro"), eurUnit.name);
|
||||
VERIFY_ARE_EQUAL(wstring(L"EUR"), eurUnit.abbreviation);
|
||||
}
|
||||
|
||||
TEST_METHOD(Loaded_LoadOrderedRatios)
|
||||
{
|
||||
StandardCacheSetup();
|
||||
|
||||
CurrencyDataLoader loader(nullptr, L"en-US");
|
||||
|
||||
auto data_loaded_event = task_completion_event<void>();
|
||||
loader.SetViewModelCallback(make_shared<DataLoadedCallback>(data_loaded_event));
|
||||
|
||||
auto data_loaded_task = create_task(data_loaded_event);
|
||||
loader.LoadData();
|
||||
data_loaded_task.wait();
|
||||
|
||||
VERIFY_IS_TRUE(loader.LoadFinished());
|
||||
VERIFY_IS_TRUE(loader.LoadedFromCache());
|
||||
VERIFY_IS_FALSE(loader.LoadedFromWeb());
|
||||
|
||||
vector<UCM::Unit> unitList = loader.GetOrderedUnits(CURRENCY_CATEGORY);
|
||||
VERIFY_ARE_EQUAL(size_t{ 2 }, unitList.size());
|
||||
|
||||
const UCM::Unit usdUnit = GetUnit(unitList, L"USD");
|
||||
const UCM::Unit eurUnit = GetUnit(unitList, L"EUR");
|
||||
|
||||
unordered_map<UCM::Unit, UCM::ConversionData, UCM::UnitHash> ratios = loader.LoadOrderedRatios(usdUnit);
|
||||
VERIFY_ARE_EQUAL(size_t{ 2 }, ratios.size());
|
||||
|
||||
UCM::ConversionData usdRatioData = ratios[usdUnit];
|
||||
VERIFY_IS_TRUE((std::abs(1.0 - usdRatioData.ratio) < 1e-1));
|
||||
|
||||
UCM::ConversionData eurRatioData = ratios[eurUnit];
|
||||
VERIFY_IS_TRUE((std::abs(0.920503 - eurRatioData.ratio) < 1e-6));
|
||||
}
|
||||
|
||||
TEST_METHOD(Loaded_GetCurrencySymbols_Valid)
|
||||
{
|
||||
StandardCacheSetup();
|
||||
|
||||
CurrencyDataLoader loader(nullptr, L"en-US");
|
||||
|
||||
auto data_loaded_event = task_completion_event<void>();
|
||||
loader.SetViewModelCallback(make_shared<DataLoadedCallback>(data_loaded_event));
|
||||
|
||||
auto data_loaded_task = create_task(data_loaded_event);
|
||||
loader.LoadData();
|
||||
data_loaded_task.wait();
|
||||
|
||||
VERIFY_IS_TRUE(loader.LoadFinished());
|
||||
VERIFY_IS_TRUE(loader.LoadedFromCache());
|
||||
VERIFY_IS_FALSE(loader.LoadedFromWeb());
|
||||
|
||||
vector<UCM::Unit> unitList = loader.GetOrderedUnits(CURRENCY_CATEGORY);
|
||||
VERIFY_ARE_EQUAL(size_t{ 2 }, unitList.size());
|
||||
|
||||
const UCM::Unit usdUnit = GetUnit(unitList, L"USD");
|
||||
const UCM::Unit eurUnit = GetUnit(unitList, L"EUR");
|
||||
|
||||
const pair<wstring, wstring> symbols = loader.GetCurrencySymbols(usdUnit, eurUnit);
|
||||
|
||||
VERIFY_ARE_EQUAL(wstring(L"$"), symbols.first);
|
||||
VERIFY_ARE_EQUAL(wstring(L"\x20ac"), symbols.second); // €
|
||||
}
|
||||
|
||||
TEST_METHOD(Loaded_GetCurrencySymbols_Invalid)
|
||||
{
|
||||
StandardCacheSetup();
|
||||
|
||||
CurrencyDataLoader loader(nullptr, L"en-US");
|
||||
|
||||
auto data_loaded_event = task_completion_event<void>();
|
||||
loader.SetViewModelCallback(make_shared<DataLoadedCallback>(data_loaded_event));
|
||||
|
||||
auto data_loaded_task = create_task(data_loaded_event);
|
||||
loader.LoadData();
|
||||
data_loaded_task.wait();
|
||||
|
||||
VERIFY_IS_TRUE(loader.LoadFinished());
|
||||
VERIFY_IS_TRUE(loader.LoadedFromCache());
|
||||
VERIFY_IS_FALSE(loader.LoadedFromWeb());
|
||||
|
||||
const UCM::Unit fakeUnit1 = { 1, L"fakeUnit1", L"FUD1", false, false, false };
|
||||
|
||||
const UCM::Unit fakeUnit2 = { 2, L"fakeUnit2", L"FUD2", false, false, false };
|
||||
|
||||
pair<wstring, wstring> symbols = loader.GetCurrencySymbols(fakeUnit1, fakeUnit2);
|
||||
|
||||
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.GetOrderedUnits(CURRENCY_CATEGORY);
|
||||
VERIFY_ARE_EQUAL(size_t{ 2 }, unitList.size());
|
||||
|
||||
const UCM::Unit usdUnit = GetUnit(unitList, L"USD");
|
||||
|
||||
symbols = loader.GetCurrencySymbols(fakeUnit1, usdUnit);
|
||||
|
||||
VERIFY_ARE_EQUAL(wstring(L""), symbols.first);
|
||||
VERIFY_ARE_EQUAL(wstring(L""), symbols.second);
|
||||
|
||||
symbols = loader.GetCurrencySymbols(usdUnit, fakeUnit1);
|
||||
|
||||
VERIFY_ARE_EQUAL(wstring(L""), symbols.first);
|
||||
VERIFY_ARE_EQUAL(wstring(L""), symbols.second);
|
||||
}
|
||||
|
||||
TEST_METHOD(Loaded_GetCurrencyRatioEquality_Valid)
|
||||
{
|
||||
StandardCacheSetup();
|
||||
|
||||
CurrencyDataLoader loader(nullptr, L"en-US");
|
||||
|
||||
auto data_loaded_event = task_completion_event<void>();
|
||||
loader.SetViewModelCallback(make_shared<DataLoadedCallback>(data_loaded_event));
|
||||
|
||||
auto data_loaded_task = create_task(data_loaded_event);
|
||||
loader.LoadData();
|
||||
data_loaded_task.wait();
|
||||
|
||||
VERIFY_IS_TRUE(loader.LoadFinished());
|
||||
VERIFY_IS_TRUE(loader.LoadedFromCache());
|
||||
VERIFY_IS_FALSE(loader.LoadedFromWeb());
|
||||
|
||||
vector<UCM::Unit> unitList = loader.GetOrderedUnits(CURRENCY_CATEGORY);
|
||||
VERIFY_ARE_EQUAL(size_t{ 2 }, unitList.size());
|
||||
|
||||
const UCM::Unit usdUnit = GetUnit(unitList, L"USD");
|
||||
const UCM::Unit eurUnit = GetUnit(unitList, L"EUR");
|
||||
|
||||
const pair<wstring, wstring> ratio = loader.GetCurrencyRatioEquality(usdUnit, eurUnit);
|
||||
|
||||
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)
|
||||
{
|
||||
StandardCacheSetup();
|
||||
|
||||
CurrencyDataLoader loader(nullptr, L"en-US");
|
||||
|
||||
auto data_loaded_event = task_completion_event<void>();
|
||||
loader.SetViewModelCallback(make_shared<DataLoadedCallback>(data_loaded_event));
|
||||
|
||||
auto data_loaded_task = create_task(data_loaded_event);
|
||||
loader.LoadData();
|
||||
data_loaded_task.wait();
|
||||
|
||||
VERIFY_IS_TRUE(loader.LoadFinished());
|
||||
VERIFY_IS_TRUE(loader.LoadedFromCache());
|
||||
VERIFY_IS_FALSE(loader.LoadedFromWeb());
|
||||
|
||||
const UCM::Unit fakeUnit1 = { 1, L"fakeUnit1", L"fakeCountry1", L"FUD1", false, false, false };
|
||||
const UCM::Unit fakeUnit2 = { 2, L"fakeUnit2", L"fakeCountry2", L"FUD2", false, false, false };
|
||||
|
||||
pair<wstring, wstring> ratio = loader.GetCurrencyRatioEquality(fakeUnit1, fakeUnit2);
|
||||
|
||||
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.GetOrderedUnits(CURRENCY_CATEGORY);
|
||||
VERIFY_ARE_EQUAL(size_t{ 2 }, unitList.size());
|
||||
|
||||
const UCM::Unit usdUnit = GetUnit(unitList, L"USD");
|
||||
|
||||
ratio = loader.GetCurrencyRatioEquality(fakeUnit1, usdUnit);
|
||||
|
||||
VERIFY_ARE_EQUAL(wstring(L""), ratio.first);
|
||||
VERIFY_ARE_EQUAL(wstring(L""), ratio.second);
|
||||
|
||||
ratio = loader.GetCurrencyRatioEquality(usdUnit, fakeUnit1);
|
||||
|
||||
VERIFY_ARE_EQUAL(wstring(L""), ratio.first);
|
||||
VERIFY_ARE_EQUAL(wstring(L""), ratio.second);
|
||||
}
|
||||
|
||||
TEST_METHOD(Test_RoundCurrencyRatio)
|
||||
{
|
||||
CurrencyDataLoader loader{ nullptr };
|
||||
VERIFY_ARE_EQUAL(CurrencyDataLoader::RoundCurrencyRatio(1234567), 1234567);
|
||||
VERIFY_ARE_EQUAL(CurrencyDataLoader::RoundCurrencyRatio(0), 0);
|
||||
VERIFY_ARE_EQUAL(CurrencyDataLoader::RoundCurrencyRatio(9999.999), 9999.999);
|
||||
VERIFY_ARE_EQUAL(CurrencyDataLoader::RoundCurrencyRatio(8765.4321), 8765.4321);
|
||||
VERIFY_ARE_EQUAL(CurrencyDataLoader::RoundCurrencyRatio(4815.162342), 4815.1623);
|
||||
VERIFY_ARE_EQUAL(CurrencyDataLoader::RoundCurrencyRatio(4815.162358), 4815.1624);
|
||||
VERIFY_ARE_EQUAL(CurrencyDataLoader::RoundCurrencyRatio(4815.162388934723), 4815.1624);
|
||||
VERIFY_ARE_EQUAL(CurrencyDataLoader::RoundCurrencyRatio(0.12), 0.12);
|
||||
VERIFY_ARE_EQUAL(CurrencyDataLoader::RoundCurrencyRatio(0.123), 0.123);
|
||||
VERIFY_ARE_EQUAL(CurrencyDataLoader::RoundCurrencyRatio(0.1234), 0.1234);
|
||||
VERIFY_ARE_EQUAL(CurrencyDataLoader::RoundCurrencyRatio(0.12343), 0.1234);
|
||||
VERIFY_ARE_EQUAL(CurrencyDataLoader::RoundCurrencyRatio(0.0321), 0.0321);
|
||||
VERIFY_ARE_EQUAL(CurrencyDataLoader::RoundCurrencyRatio(0.03211), 0.03211);
|
||||
VERIFY_ARE_EQUAL(CurrencyDataLoader::RoundCurrencyRatio(0.032119), 0.03212);
|
||||
VERIFY_ARE_EQUAL(CurrencyDataLoader::RoundCurrencyRatio(0.00322119), 0.003221);
|
||||
VERIFY_ARE_EQUAL(CurrencyDataLoader::RoundCurrencyRatio(0.00123269), 0.001233);
|
||||
VERIFY_ARE_EQUAL(CurrencyDataLoader::RoundCurrencyRatio(0.00076269), 0.0007627);
|
||||
VERIFY_ARE_EQUAL(CurrencyDataLoader::RoundCurrencyRatio(0.000069), 0.000069);
|
||||
VERIFY_ARE_EQUAL(CurrencyDataLoader::RoundCurrencyRatio(0.000061), 0.000061);
|
||||
VERIFY_ARE_EQUAL(CurrencyDataLoader::RoundCurrencyRatio(0.000054612), 0.00005461);
|
||||
VERIFY_ARE_EQUAL(CurrencyDataLoader::RoundCurrencyRatio(0.000054616), 0.00005462);
|
||||
VERIFY_ARE_EQUAL(CurrencyDataLoader::RoundCurrencyRatio(0.000005416), 0.000005416);
|
||||
VERIFY_ARE_EQUAL(CurrencyDataLoader::RoundCurrencyRatio(0.0000016134324), 0.000001613);
|
||||
VERIFY_ARE_EQUAL(CurrencyDataLoader::RoundCurrencyRatio(0.0000096134324), 0.000009613);
|
||||
VERIFY_ARE_EQUAL(CurrencyDataLoader::RoundCurrencyRatio(0.0000032169348392), 0.000003217);
|
||||
VERIFY_ARE_EQUAL(CurrencyDataLoader::RoundCurrencyRatio(0.000000002134987218), 0.000000002135);
|
||||
VERIFY_ARE_EQUAL(CurrencyDataLoader::RoundCurrencyRatio(0.000000000000087231445), 0.00000000000008723);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -411,124 +411,149 @@ namespace CalculatorFunctionalTests
|
|||
Cleanup();
|
||||
}
|
||||
|
||||
void HistoryStandardOrderOfOperations_1() {
|
||||
Command commands[] = { Command::Command1, Command::CommandREC };
|
||||
void HistoryStandardOrderOfOperations_1()
|
||||
{
|
||||
Command commands[] = { Command::Command1, Command::CommandREC, Command::CommandNULL };
|
||||
HistoryStandardOrderOfOperationsHelper(L"", L"", commands);
|
||||
}
|
||||
|
||||
void HistoryStandardOrderOfOperations_2() {
|
||||
Command commands[] = { Command::Command4, Command::CommandSQRT };
|
||||
void HistoryStandardOrderOfOperations_2()
|
||||
{
|
||||
Command commands[] = { Command::Command4, Command::CommandSQRT, Command::CommandNULL };
|
||||
HistoryStandardOrderOfOperationsHelper(L"", L"", commands);
|
||||
}
|
||||
|
||||
void HistoryStandardOrderOfOperations_3() {
|
||||
Command commands[] = { Command::Command1, Command::CommandADD, Command::Command4, Command::CommandSQRT };
|
||||
void HistoryStandardOrderOfOperations_3()
|
||||
{
|
||||
Command commands[] = { Command::Command1, Command::CommandADD, Command::Command4, Command::CommandSQRT, Command::CommandNULL };
|
||||
HistoryStandardOrderOfOperationsHelper(L"", L"", commands);
|
||||
}
|
||||
|
||||
void HistoryStandardOrderOfOperations_4() {
|
||||
Command commands[] = { Command::Command1, Command::CommandADD, Command::Command4, Command::CommandSQRT, Command::CommandSUB };
|
||||
void HistoryStandardOrderOfOperations_4()
|
||||
{
|
||||
Command commands[] = { Command::Command1, Command::CommandADD, Command::Command4, Command::CommandSQRT, Command::CommandSUB, Command::CommandNULL };
|
||||
HistoryStandardOrderOfOperationsHelper(L"3", L"1 + \x221A( 4 ) =", commands);
|
||||
}
|
||||
|
||||
void HistoryStandardOrderOfOperations_5() {
|
||||
Command commands[] = { Command::Command2, Command::CommandMUL, Command::Command4, Command::CommandREC };
|
||||
void HistoryStandardOrderOfOperations_5()
|
||||
{
|
||||
Command commands[] = { Command::Command2, Command::CommandMUL, Command::Command4, Command::CommandREC, Command::CommandNULL };
|
||||
HistoryStandardOrderOfOperationsHelper(L"", L"", commands);
|
||||
}
|
||||
|
||||
void HistoryStandardOrderOfOperations_6() {
|
||||
Command commands[] = { Command::Command5, Command::CommandDIV, Command::Command6, Command::CommandPERCENT };
|
||||
void HistoryStandardOrderOfOperations_6()
|
||||
{
|
||||
Command commands[] = { Command::Command5, Command::CommandDIV, Command::Command6, Command::CommandPERCENT, Command::CommandNULL };
|
||||
HistoryStandardOrderOfOperationsHelper(L"", L"", commands);
|
||||
}
|
||||
|
||||
void HistoryStandardOrderOfOperations_7() {
|
||||
Command commands[] = { Command::Command4, Command::CommandSQRT, Command::CommandSUB };
|
||||
void HistoryStandardOrderOfOperations_7()
|
||||
{
|
||||
Command commands[] = { Command::Command4, Command::CommandSQRT, Command::CommandSUB, Command::CommandNULL };
|
||||
HistoryStandardOrderOfOperationsHelper(L"", L"", commands);
|
||||
}
|
||||
|
||||
void HistoryStandardOrderOfOperations_8() {
|
||||
Command commands[] = { Command::Command7, Command::CommandSQR, Command::CommandDIV };
|
||||
void HistoryStandardOrderOfOperations_8()
|
||||
{
|
||||
Command commands[] = { Command::Command7, Command::CommandSQR, Command::CommandDIV, Command::CommandNULL };
|
||||
HistoryStandardOrderOfOperationsHelper(L"", L"", commands);
|
||||
}
|
||||
|
||||
void HistoryStandardOrderOfOperations_9() {
|
||||
Command commands[] = { Command::Command8, Command::CommandSQR, Command::CommandSQRT };
|
||||
void HistoryStandardOrderOfOperations_9()
|
||||
{
|
||||
Command commands[] = { Command::Command8, Command::CommandSQR, Command::CommandSQRT, Command::CommandNULL };
|
||||
HistoryStandardOrderOfOperationsHelper(L"", L"", commands);
|
||||
}
|
||||
|
||||
void HistoryStandardOrderOfOperations_10() {
|
||||
Command commands[] = { Command::Command1, Command::Command0, Command::CommandADD, Command::Command2, Command::CommandSUB };
|
||||
void HistoryStandardOrderOfOperations_10()
|
||||
{
|
||||
Command commands[] = { Command::Command1, Command::Command0, Command::CommandADD, Command::Command2, Command::CommandSUB, Command::CommandNULL };
|
||||
HistoryStandardOrderOfOperationsHelper(L"12", L"10 + 2 =", commands);
|
||||
}
|
||||
|
||||
void HistoryStandardOrderOfOperations_11() {
|
||||
Command commands[] = { Command::Command3, Command::CommandMUL, Command::Command4, Command::CommandDIV };
|
||||
void HistoryStandardOrderOfOperations_11()
|
||||
{
|
||||
Command commands[] = { Command::Command3, Command::CommandMUL, Command::Command4, Command::CommandDIV, Command::CommandNULL };
|
||||
HistoryStandardOrderOfOperationsHelper(L"12", L"3 \x00D7 4 =", commands);
|
||||
}
|
||||
|
||||
void HistoryStandardOrderOfOperations_12() {
|
||||
Command commands[] = { Command::Command6, Command::CommandDIV, Command::Command3, Command::CommandSUB, Command::CommandADD };
|
||||
void HistoryStandardOrderOfOperations_12()
|
||||
{
|
||||
Command commands[] = { Command::Command6, Command::CommandDIV, Command::Command3, Command::CommandSUB, Command::CommandADD, Command::CommandNULL };
|
||||
HistoryStandardOrderOfOperationsHelper(L"2", L"6 \x00F7 3 =", commands);
|
||||
}
|
||||
|
||||
void HistoryStandardOrderOfOperations_13() {
|
||||
Command commands[] = { Command::Command7, Command::CommandSUB, Command::Command4, Command::CommandDIV, Command::CommandMUL };
|
||||
void HistoryStandardOrderOfOperations_13()
|
||||
{
|
||||
Command commands[] = { Command::Command7, Command::CommandSUB, Command::Command4, Command::CommandDIV, Command::CommandMUL, Command::CommandNULL };
|
||||
HistoryStandardOrderOfOperationsHelper(L"3", L"7 - 4 =", commands);
|
||||
}
|
||||
|
||||
void HistoryStandardOrderOfOperations_14() {
|
||||
Command commands[] = { Command::Command8, Command::CommandMUL, Command::Command2, Command::CommandADD, Command::CommandSQRT };
|
||||
void HistoryStandardOrderOfOperations_14()
|
||||
{
|
||||
Command commands[] = { Command::Command8, Command::CommandMUL, Command::Command2, Command::CommandADD, Command::CommandSQRT, Command::CommandNULL };
|
||||
HistoryStandardOrderOfOperationsHelper(L"16", L"8 \x00D7 2 =", commands);
|
||||
}
|
||||
|
||||
void HistoryStandardOrderOfOperations_15() {
|
||||
Command commands[] = { Command::Command9, Command::CommandADD, Command::Command0, Command::CommandMUL, Command::CommandSIGN };
|
||||
void HistoryStandardOrderOfOperations_15()
|
||||
{
|
||||
Command commands[] = { Command::Command9, Command::CommandADD, Command::Command0, Command::CommandMUL, Command::CommandSIGN, Command::CommandNULL };
|
||||
HistoryStandardOrderOfOperationsHelper(L"9", L"9 + 0 =", commands);
|
||||
}
|
||||
|
||||
void HistoryStandardOrderOfOperations_16() {
|
||||
Command commands[] = { Command::Command9, Command::CommandSIGN, Command::Command0, Command::CommandADD, Command::CommandMUL };
|
||||
void HistoryStandardOrderOfOperations_16()
|
||||
{
|
||||
Command commands[] = { Command::Command9, Command::CommandSIGN, Command::Command0, Command::CommandADD, Command::CommandMUL, Command::CommandNULL };
|
||||
HistoryStandardOrderOfOperationsHelper(L"", L"", commands);
|
||||
}
|
||||
|
||||
void HistoryStandardOrderOfOperations_17() {
|
||||
Command commands[] = { Command::Command1, Command::CommandADD, Command::Command2, Command::CommandEQU };
|
||||
void HistoryStandardOrderOfOperations_17()
|
||||
{
|
||||
Command commands[] = { Command::Command1, Command::CommandADD, Command::Command2, Command::CommandEQU, Command::CommandNULL };
|
||||
HistoryStandardOrderOfOperationsHelper(L"3", L"1 + 2 =", commands);
|
||||
}
|
||||
|
||||
void HistoryStandardOrderOfOperations_18() {
|
||||
Command commands[] = { Command::Command2, Command::Command0, Command::CommandMUL, Command::Command0, Command::Command2, Command::CommandEQU };
|
||||
void HistoryStandardOrderOfOperations_18()
|
||||
{
|
||||
Command commands[] = { Command::Command2, Command::Command0, Command::CommandMUL, Command::Command0, Command::Command2, Command::CommandEQU, Command::CommandNULL };
|
||||
HistoryStandardOrderOfOperationsHelper(L"40", L"20 \x00D7 2 =", commands);
|
||||
}
|
||||
|
||||
void HistoryStandardOrderOfOperations_19() {
|
||||
Command commands[] = { Command::Command1, Command::CommandADD, Command::Command2, Command::CommandADD, Command::CommandBACK };
|
||||
void HistoryStandardOrderOfOperations_19()
|
||||
{
|
||||
Command commands[] = { Command::Command1, Command::CommandADD, Command::Command2, Command::CommandADD, Command::CommandBACK, Command::CommandNULL };
|
||||
HistoryStandardOrderOfOperationsHelper(L"3", L"1 + 2 =", commands);
|
||||
}
|
||||
|
||||
void HistoryStandardOrderOfOperations_20() {
|
||||
Command commands[] = { Command::Command1, Command::CommandADD, Command::Command2, Command::CommandADD, Command::CommandCLEAR };
|
||||
void HistoryStandardOrderOfOperations_20()
|
||||
{
|
||||
Command commands[] = { Command::Command1, Command::CommandADD, Command::Command2, Command::CommandADD, Command::CommandCLEAR, Command::CommandNULL };
|
||||
HistoryStandardOrderOfOperationsHelper(L"3", L"1 + 2 =", commands);
|
||||
}
|
||||
|
||||
void HistoryStandardOrderOfOperations_21() {
|
||||
Command commands[] = { Command::Command1, Command::CommandADD, Command::Command2, Command::CommandADD, Command::CommandCENTR };
|
||||
void HistoryStandardOrderOfOperations_21()
|
||||
{
|
||||
Command commands[] = { Command::Command1, Command::CommandADD, Command::Command2, Command::CommandADD, Command::CommandCENTR, Command::CommandNULL };
|
||||
HistoryStandardOrderOfOperationsHelper(L"3", L"1 + 2 =", commands);
|
||||
}
|
||||
|
||||
void HistoryStandardOrderOfOperations_22() {
|
||||
Command commands[] = { Command::Command1, Command::CommandADD, Command::Command2, Command::CommandCLEAR };
|
||||
void HistoryStandardOrderOfOperations_22()
|
||||
{
|
||||
Command commands[] = { Command::Command1, Command::CommandADD, Command::Command2, Command::CommandCLEAR, Command::CommandNULL };
|
||||
HistoryStandardOrderOfOperationsHelper(L"", L"", commands);
|
||||
}
|
||||
|
||||
void HistoryStandardOrderOfOperations_23() {
|
||||
Command commands[] = { Command::Command1, Command::CommandADD, Command::Command2, Command::CommandCENTR };
|
||||
void HistoryStandardOrderOfOperations_23()
|
||||
{
|
||||
Command commands[] = { Command::Command1, Command::CommandADD, Command::Command2, Command::CommandCENTR, Command::CommandNULL };
|
||||
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, Command::CommandNULL };
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,130 +14,70 @@ 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",
|
||||
};
|
||||
|
||||
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()));
|
||||
localizationService->Sort(stringsToSort);
|
||||
VERIFY_IS_TRUE(equal(stringsToSort.begin(), stringsToSort.end(), expectedResult.begin()));
|
||||
}
|
||||
|
||||
TEST_METHOD(TestSortEmptyStrings)
|
||||
{
|
||||
//Verify if LocalizationService::Sort doesn't crash when the vector is empty or null
|
||||
auto localizationService = LocalizationService::GetInstance();
|
||||
vector<String^> stringsToSort = {};
|
||||
localizationService->Sort(stringsToSort);
|
||||
stringsToSort = { L"" };
|
||||
localizationService->Sort(stringsToSort);
|
||||
stringsToSort = { L"",L"",L"" };
|
||||
localizationService->Sort(stringsToSort);
|
||||
stringsToSort = { nullptr,L"",L"" };
|
||||
localizationService->Sort(stringsToSort);
|
||||
}
|
||||
|
||||
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^> 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";
|
||||
};
|
||||
|
||||
VERIFY_ARE_EQUAL(stringsToSort.size(), expectedResult.size());
|
||||
VERIFY_IS_FALSE(equal(stringsToSort.begin(), stringsToSort.end(), expectedResult.begin()));
|
||||
|
||||
auto localizationService = LocalizationService::GetInstance();
|
||||
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",
|
||||
};
|
||||
|
||||
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()));
|
||||
|
||||
}
|
||||
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",
|
||||
};
|
||||
VERIFY_ARE_EQUAL(stringsToSort.size(), expectedResult.size());
|
||||
VERIFY_IS_FALSE(equal(stringsToSort.begin(), stringsToSort.end(), expectedResult.begin()));
|
||||
localizationService->Sort(stringsToSort);
|
||||
VERIFY_IS_TRUE(equal(stringsToSort.begin(), stringsToSort.end(), expectedResult.begin()));
|
||||
}
|
||||
|
||||
TEST_METHOD(TestSortEmptyStrings)
|
||||
{
|
||||
// Verify if LocalizationService::Sort doesn't crash when the vector is empty or null
|
||||
auto localizationService = LocalizationService::GetInstance();
|
||||
vector<String ^> stringsToSort = {};
|
||||
localizationService->Sort(stringsToSort);
|
||||
stringsToSort = { L"" };
|
||||
localizationService->Sort(stringsToSort);
|
||||
stringsToSort = { L"", L"", L"" };
|
||||
localizationService->Sort(stringsToSort);
|
||||
stringsToSort = { nullptr, L"", L"" };
|
||||
localizationService->Sort(stringsToSort);
|
||||
}
|
||||
|
||||
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 ^> 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"; };
|
||||
|
||||
VERIFY_ARE_EQUAL(stringsToSort.size(), expectedResult.size());
|
||||
VERIFY_IS_FALSE(equal(stringsToSort.begin(), stringsToSort.end(), expectedResult.begin()));
|
||||
|
||||
auto localizationService = LocalizationService::GetInstance();
|
||||
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",
|
||||
};
|
||||
|
||||
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()));
|
||||
}
|
||||
}
|
||||
;
|
||||
}
|
||||
|
|
|
@ -18,76 +18,72 @@ static Windows::Globalization::NumberFormatting::DecimalFormatter ^ CreateDecima
|
|||
|
||||
namespace CalculatorUnitTests
|
||||
{
|
||||
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());
|
||||
}
|
||||
|
||||
TEST_METHOD(TestIsDigitEnUsSetting)
|
||||
{
|
||||
auto arabicFormatter = CreateDecimalFormatter(L"ar-AE", L"AE");
|
||||
LocalizationSettings arabicSettings(arabicFormatter);
|
||||
VERIFY_IS_FALSE(arabicSettings.IsDigitEnUsSetting());
|
||||
|
||||
auto englishFormatter = CreateDecimalFormatter(L"en-US", L"US");
|
||||
LocalizationSettings englishSettings(englishFormatter);
|
||||
VERIFY_IS_TRUE(englishSettings.IsDigitEnUsSetting());
|
||||
}
|
||||
|
||||
TEST_METHOD(TestLocalizeDisplayValue)
|
||||
{
|
||||
auto formatter = CreateDecimalFormatter(L"ar-AE", L"AE");
|
||||
LocalizationSettings settings(formatter);
|
||||
std::wstring input(L"A123");
|
||||
settings.LocalizeDisplayValue(&input);
|
||||
VERIFY_ARE_EQUAL(L"A١٢٣", input);
|
||||
}
|
||||
|
||||
TEST_METHOD(TestGetEnglishValueFromLocalizedDigits)
|
||||
{
|
||||
auto formatter = CreateDecimalFormatter(L"ar-AE", L"AE");
|
||||
LocalizationSettings settings(formatter);
|
||||
VERIFY_ARE_EQUAL(L"A123", settings.GetEnglishValueFromLocalizedDigits(L"A١٢٣"));
|
||||
}
|
||||
|
||||
TEST_METHOD(TestIsEnUsDigit)
|
||||
{
|
||||
auto& settings = LocalizationSettings::GetInstance();
|
||||
VERIFY_IS_FALSE(settings.IsEnUsDigit(L'/'));
|
||||
VERIFY_IS_TRUE(settings.IsEnUsDigit(L'0'));
|
||||
VERIFY_IS_TRUE(settings.IsEnUsDigit(L'1'));
|
||||
VERIFY_IS_TRUE(settings.IsEnUsDigit(L'8'));
|
||||
VERIFY_IS_TRUE(settings.IsEnUsDigit(L'9'));
|
||||
VERIFY_IS_FALSE(settings.IsEnUsDigit(L':'));
|
||||
}
|
||||
|
||||
TEST_METHOD(TestIsLocalizedDigit)
|
||||
{
|
||||
auto formatter = CreateDecimalFormatter(L"en-US", L"US");
|
||||
LocalizationSettings settings(formatter);
|
||||
VERIFY_IS_TRUE(settings.IsLocalizedDigit(L'0'));
|
||||
VERIFY_IS_FALSE(settings.IsLocalizedDigit(L'A'));
|
||||
}
|
||||
|
||||
TEST_METHOD(TestIsLocalizedHexDigit)
|
||||
{
|
||||
auto formatter = CreateDecimalFormatter(L"en-US", L"US");
|
||||
LocalizationSettings settings(formatter);
|
||||
VERIFY_IS_TRUE(settings.IsLocalizedHexDigit(L'0'));
|
||||
VERIFY_IS_TRUE(settings.IsLocalizedHexDigit(L'A'));
|
||||
VERIFY_IS_FALSE(settings.IsLocalizedHexDigit(L'G'));
|
||||
}
|
||||
|
||||
TEST_METHOD(TestRemoveGroupSeparators)
|
||||
{
|
||||
auto formatter = CreateDecimalFormatter(L"en-US", L"US");
|
||||
LocalizationSettings settings(formatter);
|
||||
VERIFY_ARE_EQUAL(L"1000000", settings.RemoveGroupSeparators(L"1,000 000"));
|
||||
}
|
||||
};
|
||||
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());
|
||||
}
|
||||
|
||||
TEST_METHOD(TestIsDigitEnUsSetting)
|
||||
{
|
||||
auto arabicFormatter = CreateDecimalFormatter(L"ar-AE", L"AE");
|
||||
LocalizationSettings arabicSettings(arabicFormatter);
|
||||
VERIFY_IS_FALSE(arabicSettings.IsDigitEnUsSetting());
|
||||
|
||||
auto englishFormatter = CreateDecimalFormatter(L"en-US", L"US");
|
||||
LocalizationSettings englishSettings(englishFormatter);
|
||||
VERIFY_IS_TRUE(englishSettings.IsDigitEnUsSetting());
|
||||
}
|
||||
|
||||
TEST_METHOD(TestLocalizeDisplayValue)
|
||||
{
|
||||
auto formatter = CreateDecimalFormatter(L"ar-AE", L"AE");
|
||||
LocalizationSettings settings(formatter);
|
||||
std::wstring input(L"A123");
|
||||
settings.LocalizeDisplayValue(&input);
|
||||
VERIFY_ARE_EQUAL(L"A١٢٣", input);
|
||||
}
|
||||
|
||||
TEST_METHOD(TestGetEnglishValueFromLocalizedDigits)
|
||||
{
|
||||
auto formatter = CreateDecimalFormatter(L"ar-AE", L"AE");
|
||||
LocalizationSettings settings(formatter);
|
||||
VERIFY_ARE_EQUAL(L"A123", settings.GetEnglishValueFromLocalizedDigits(L"A١٢٣"));
|
||||
}
|
||||
|
||||
TEST_METHOD(TestIsEnUsDigit)
|
||||
{
|
||||
auto& settings = LocalizationSettings::GetInstance();
|
||||
VERIFY_IS_FALSE(settings.IsEnUsDigit(L'/'));
|
||||
VERIFY_IS_TRUE(settings.IsEnUsDigit(L'0'));
|
||||
VERIFY_IS_TRUE(settings.IsEnUsDigit(L'1'));
|
||||
VERIFY_IS_TRUE(settings.IsEnUsDigit(L'8'));
|
||||
VERIFY_IS_TRUE(settings.IsEnUsDigit(L'9'));
|
||||
VERIFY_IS_FALSE(settings.IsEnUsDigit(L':'));
|
||||
}
|
||||
|
||||
TEST_METHOD(TestIsLocalizedDigit)
|
||||
{
|
||||
auto formatter = CreateDecimalFormatter(L"en-US", L"US");
|
||||
LocalizationSettings settings(formatter);
|
||||
VERIFY_IS_TRUE(settings.IsLocalizedDigit(L'0'));
|
||||
VERIFY_IS_FALSE(settings.IsLocalizedDigit(L'A'));
|
||||
}
|
||||
|
||||
TEST_METHOD(TestIsLocalizedHexDigit)
|
||||
{
|
||||
auto formatter = CreateDecimalFormatter(L"en-US", L"US");
|
||||
LocalizationSettings settings(formatter);
|
||||
VERIFY_IS_TRUE(settings.IsLocalizedHexDigit(L'0'));
|
||||
VERIFY_IS_TRUE(settings.IsLocalizedHexDigit(L'A'));
|
||||
VERIFY_IS_FALSE(settings.IsLocalizedHexDigit(L'G'));
|
||||
}
|
||||
|
||||
TEST_METHOD(TestRemoveGroupSeparators)
|
||||
{
|
||||
auto formatter = CreateDecimalFormatter(L"en-US", L"US");
|
||||
LocalizationSettings settings(formatter);
|
||||
VERIFY_ARE_EQUAL(L"1000000", settings.RemoveGroupSeparators(L"1,000 000"));
|
||||
}
|
||||
}
|
||||
;
|
||||
}
|
||||
|
|
|
@ -460,7 +460,7 @@ TEST_METHOD(MultipleStandardModesHistoryAddItemTest)
|
|||
{
|
||||
VERIFY_IS_TRUE(2 == viewModels[i]->HistoryVM->ItemsCount);
|
||||
|
||||
for (int j = 0; j < 2 ; j++)
|
||||
for (int j = 0; j < 2; j++)
|
||||
{
|
||||
auto item = static_cast<HistoryItemViewModel ^>(viewModels[i]->HistoryVM->Items->GetAt(j));
|
||||
|
||||
|
@ -490,19 +490,19 @@ TEST_METHOD(MultipleScientificModesHistoryAddItemTest)
|
|||
// Perform Calculations on both the instances and check that the History items work independently
|
||||
|
||||
TESTITEM scientificModeTestItems[2][8] = { { { NumbersAndOperatorsEnum::IsScientificMode, L"0", L"" },
|
||||
{ NumbersAndOperatorsEnum::One, L"1", L"" },
|
||||
{ NumbersAndOperatorsEnum::Add, L"1", L"1 + " },
|
||||
{ NumbersAndOperatorsEnum::Two, L"2", L"1 + " },
|
||||
{ NumbersAndOperatorsEnum::Equals, L"3", L"" },
|
||||
{ NumbersAndOperatorsEnum::None, L"", L"" } },
|
||||
{ { NumbersAndOperatorsEnum::IsScientificMode, L"0", L"" },
|
||||
{ NumbersAndOperatorsEnum::One, L"1", L"" },
|
||||
{ NumbersAndOperatorsEnum::Add, L"1", L"1 + " },
|
||||
{ NumbersAndOperatorsEnum::Two, L"2", L"1 + " },
|
||||
{ NumbersAndOperatorsEnum::Multiply, L"2", L"1 + 2 * " },
|
||||
{ NumbersAndOperatorsEnum::Three, L"3", L"1 + 2 * " },
|
||||
{ NumbersAndOperatorsEnum::Equals, L"7", L"" },
|
||||
{ NumbersAndOperatorsEnum::None, L"", L"" } } };
|
||||
{ NumbersAndOperatorsEnum::One, L"1", L"" },
|
||||
{ NumbersAndOperatorsEnum::Add, L"1", L"1 + " },
|
||||
{ NumbersAndOperatorsEnum::Two, L"2", L"1 + " },
|
||||
{ NumbersAndOperatorsEnum::Equals, L"3", L"" },
|
||||
{ NumbersAndOperatorsEnum::None, L"", L"" } },
|
||||
{ { NumbersAndOperatorsEnum::IsScientificMode, L"0", L"" },
|
||||
{ NumbersAndOperatorsEnum::One, L"1", L"" },
|
||||
{ NumbersAndOperatorsEnum::Add, L"1", L"1 + " },
|
||||
{ NumbersAndOperatorsEnum::Two, L"2", L"1 + " },
|
||||
{ NumbersAndOperatorsEnum::Multiply, L"2", L"1 + 2 * " },
|
||||
{ NumbersAndOperatorsEnum::Three, L"3", L"1 + 2 * " },
|
||||
{ NumbersAndOperatorsEnum::Equals, L"7", L"" },
|
||||
{ NumbersAndOperatorsEnum::None, L"", L"" } } };
|
||||
|
||||
// Run the commands
|
||||
for (int i = 0; i < 2; i++)
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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()
|
||||
{
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -82,7 +82,6 @@ public enum class GraphViewChangedReason
|
|||
void ZoomFromCenter(double scale);
|
||||
void ResetGrid();
|
||||
|
||||
|
||||
property Windows::Foundation::Point TraceLocation
|
||||
{
|
||||
Windows::Foundation::Point get()
|
||||
|
|
|
@ -254,15 +254,14 @@ 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)
|
||||
{
|
||||
// If the device was removed for any reason, a new device and swap chain will need to be created.
|
||||
HandleDeviceLost();
|
||||
|
||||
// Everything is set up now. Do not continue execution of this method. HandleDeviceLost will reenter this method
|
||||
// Everything is set up now. Do not continue execution of this method. HandleDeviceLost will reenter this method
|
||||
// and correctly set up the new device.
|
||||
return;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -620,7 +618,7 @@ namespace GraphControl::DX
|
|||
m_deviceNotify = deviceNotify;
|
||||
}
|
||||
|
||||
// Call this method when the app suspends. It provides a hint to the driver that the app
|
||||
// Call this method when the app suspends. It provides a hint to the driver that the app
|
||||
// is entering an idle state and that temporary buffers can be reclaimed for use by other apps.
|
||||
void DeviceResources::Trim()
|
||||
{
|
||||
|
@ -647,7 +645,7 @@ namespace GraphControl::DX
|
|||
// Discard the contents of the depth stencil.
|
||||
m_d3dContext->DiscardView1(m_d3dDepthStencilView.Get(), nullptr, 0);
|
||||
|
||||
// If the device was removed either by a disconnection or a driver upgrade, we
|
||||
// If the device was removed either by a disconnection or a driver upgrade, we
|
||||
// must recreate all device resources.
|
||||
if (hr == DXGI_ERROR_DEVICE_REMOVED || hr == DXGI_ERROR_DEVICE_RESET)
|
||||
{
|
||||
|
|
|
@ -15,19 +15,19 @@ namespace GraphControl::DX
|
|||
void CreateDeviceDependentResources();
|
||||
void ReleaseDeviceDependentResources();
|
||||
void Render(const Windows::Foundation::Point& location);
|
||||
|
||||
|
||||
void SetColor(const D2D1::ColorF& color);
|
||||
void SetRadius(float radius);
|
||||
|
||||
|
||||
private:
|
||||
void CreateBrush();
|
||||
|
||||
|
||||
private:
|
||||
DeviceResources* const m_deviceResources;
|
||||
|
||||
|
||||
D2D1::ColorF m_color;
|
||||
D2D1_ELLIPSE m_ellipse;
|
||||
|
||||
|
||||
// Resources related to rendering.
|
||||
Microsoft::WRL::ComPtr<ID2D1SolidColorBrush> m_brush;
|
||||
};
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace GraphControl::DX
|
|||
: m_deviceResources{ panel }
|
||||
, m_nearestPointRenderer{ &m_deviceResources }
|
||||
, m_backgroundColor{ {} }
|
||||
, m_swapChainPanel{ panel }
|
||||
, m_swapChainPanel{ panel }
|
||||
, m_TraceLocation(Point(0, 0))
|
||||
, m_Tracing(false)
|
||||
{
|
||||
|
@ -159,10 +159,10 @@ namespace GraphControl::DX
|
|||
double outNearestPointValueX, outNearestPointValueY;
|
||||
float outNearestPointLocationX, outNearestPointLocationY;
|
||||
double rhoValueOut, thetaValueOut, tValueOut;
|
||||
|
||||
|
||||
double xAxisMin, xAxisMax, yAxisMin, yAxisMax;
|
||||
m_graph->GetRenderer()->GetDisplayRanges(xAxisMin, xAxisMax, yAxisMin, yAxisMax);
|
||||
double precision = this->GetPrecision(xAxisMax, xAxisMin);
|
||||
double precision = this->GetPrecision(xAxisMax, xAxisMin);
|
||||
|
||||
m_Tracing = m_graph->GetRenderer()->GetClosePointData(
|
||||
trackPoint.X,
|
||||
|
@ -201,7 +201,7 @@ namespace GraphControl::DX
|
|||
double exponent = static_cast<double>(floor(log10(maxAxis - minAxis)) - 3);
|
||||
double precision = pow(10, exponent);
|
||||
return precision;
|
||||
}
|
||||
}
|
||||
|
||||
void RenderMain::SetPointRadius(float radius)
|
||||
{
|
||||
|
@ -319,12 +319,12 @@ namespace GraphControl::DX
|
|||
}
|
||||
|
||||
int formulaId = -1;
|
||||
double outNearestPointValueX, outNearestPointValueY;
|
||||
double outNearestPointValueX, outNearestPointValueY;
|
||||
double rhoValueOut, thetaValueOut, tValueOut;
|
||||
float outNearestPointLocationX, outNearestPointLocationY;
|
||||
double xAxisMin, xAxisMax, yAxisMin, yAxisMax;
|
||||
renderer->GetDisplayRanges(xAxisMin, xAxisMax, yAxisMin, yAxisMax);
|
||||
double precision = this->GetPrecision(xAxisMax, xAxisMin);
|
||||
double precision = this->GetPrecision(xAxisMax, xAxisMin);
|
||||
if (renderer->GetClosePointData(
|
||||
trackPoint.X,
|
||||
trackPoint.Y,
|
||||
|
@ -352,7 +352,7 @@ namespace GraphControl::DX
|
|||
m_TraceLocation = Point(outNearestPointLocationX, outNearestPointLocationY);
|
||||
m_nearestPointRenderer.Render(m_TraceLocation);
|
||||
m_Tracing = true;
|
||||
m_TraceLocation = Point(outNearestPointLocationX, outNearestPointLocationY);
|
||||
m_TraceLocation = Point(outNearestPointLocationX, outNearestPointLocationY);
|
||||
m_XTraceValue = outNearestPointValueX;
|
||||
m_YTraceValue = outNearestPointValueY;
|
||||
}
|
||||
|
|
|
@ -150,8 +150,9 @@ namespace GraphControl::DX
|
|||
// Other event handlers.
|
||||
void OnCompositionScaleChanged(Windows::UI::Xaml::Controls::SwapChainPanel ^ sender, Object ^ args);
|
||||
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;
|
||||
|
@ -186,12 +187,11 @@ namespace GraphControl::DX
|
|||
|
||||
// Track our independent input on a background worker thread.
|
||||
Windows::Foundation::IAsyncAction ^ m_inputLoopWorker = nullptr;
|
||||
Windows::UI::Core::CoreIndependentInputSource ^ m_coreInput = nullptr;
|
||||
Windows::UI::Core::CoreIndependentInputSource ^ m_coreInput = nullptr;
|
||||
|
||||
double m_XTraceValue;
|
||||
double m_YTraceValue;
|
||||
|
||||
|
||||
// And where is it located on screen
|
||||
Windows::Foundation::Point m_TraceLocation;
|
||||
|
||||
|
@ -200,10 +200,10 @@ namespace GraphControl::DX
|
|||
|
||||
Concurrency::critical_section m_criticalSection;
|
||||
|
||||
Windows::Foundation::IAsyncAction ^ m_renderPass = nullptr;
|
||||
Windows::Foundation::IAsyncAction ^ m_renderPass = nullptr;
|
||||
|
||||
bool m_isRenderPassSuccesful;
|
||||
bool m_isRenderPassSuccesful;
|
||||
|
||||
HRESULT m_HResult;
|
||||
HRESULT m_HResult;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -154,11 +154,12 @@ public
|
|||
event EquationChangedEventHandler ^ EquationLineEnabledChanged;
|
||||
|
||||
private:
|
||||
void OnEquationPropertyChanged(Object^ sender, Windows::UI::Xaml::Data::PropertyChangedEventArgs ^ args)
|
||||
void OnEquationPropertyChanged(Object ^ sender, Windows::UI::Xaml::Data::PropertyChangedEventArgs ^ args)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -168,7 +168,7 @@ public:
|
|||
Windows::UI::Xaml::Input::ICommand^ get() {\
|
||||
if (!donotuse_##p) {\
|
||||
donotuse_##p = CalculatorApp::Common::MakeDelegate(this, &m);\
|
||||
} return donotuse_##p; }} private: Windows::UI::Xaml::Input::ICommand^ donotuse_##p; \
|
||||
} return donotuse_##p; }} private: Windows::UI::Xaml::Input::ICommand^ donotuse_##p; \
|
||||
\
|
||||
public:
|
||||
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include <map>
|
||||
#include <type_traits>
|
||||
|
||||
|
||||
// DirectX headers
|
||||
#include <d2d1_3.h>
|
||||
#include <d3d11_4.h>
|
||||
|
|
|
@ -71,7 +71,7 @@ namespace MockGraphingImpl
|
|||
virtual HRESULT ChangeRange(Graphing::Renderer::ChangeRangeAction action)
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
virtual HRESULT MoveRangeByRatio(double ratioX, double ratioY)
|
||||
{
|
||||
return S_OK;
|
||||
|
@ -109,7 +109,6 @@ namespace MockGraphingImpl
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
double m_xMin;
|
||||
double m_xMax;
|
||||
|
|
|
@ -54,7 +54,7 @@ namespace Graphing
|
|||
{
|
||||
virtual ~IExpressible() = default;
|
||||
|
||||
virtual std::shared_ptr< IExpression > GetExpression() const = 0;
|
||||
virtual std::shared_ptr<IExpression> GetExpression() const = 0;
|
||||
};
|
||||
|
||||
class Color
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
|
||||
namespace Graphing
|
||||
{
|
||||
struct IBitmap
|
||||
{
|
||||
virtual const std::vector<BYTE>& GetData() const = 0;
|
||||
};
|
||||
struct IBitmap
|
||||
{
|
||||
virtual const std::vector<BYTE>& GetData() const = 0;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -30,6 +30,6 @@ namespace Graphing
|
|||
|
||||
virtual bool TryResetSelection() = 0;
|
||||
|
||||
virtual std::shared_ptr< Graphing::Analyzer::IGraphAnalyzer > GetAnalyzer() const = 0;
|
||||
virtual std::shared_ptr<Graphing::Analyzer::IGraphAnalyzer> GetAnalyzer() const = 0;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -11,14 +11,14 @@
|
|||
|
||||
namespace Graphing::Analyzer
|
||||
{
|
||||
typedef unsigned int NativeAnalysisType; // PerformAnalysisType
|
||||
typedef unsigned int NativeAnalysisType; // PerformAnalysisType
|
||||
|
||||
struct IGraphAnalyzer : public NonCopyable, public NonMoveable
|
||||
{
|
||||
struct IGraphAnalyzer : public NonCopyable, public NonMoveable
|
||||
{
|
||||
virtual ~IGraphAnalyzer() = default;
|
||||
virtual bool CanFunctionAnalysisBePerformed(bool& variableIsNotX) = 0;
|
||||
virtual HRESULT PerformFunctionAnalysis(NativeAnalysisType analysisType) = 0;
|
||||
virtual HRESULT GetAnalysisTypeCaption(const AnalysisType type, std::wstring& captionOut) const = 0;
|
||||
virtual HRESULT GetMessage(const GraphAnalyzerMessage msg, std::wstring& msgOut) const = 0;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -10,29 +10,40 @@ struct ID2D1RenderTarget;
|
|||
|
||||
namespace Graphing
|
||||
{
|
||||
struct IBitmap;
|
||||
struct IBitmap;
|
||||
}
|
||||
|
||||
namespace Graphing::Renderer
|
||||
{
|
||||
struct IGraphRenderer : public NonCopyable, public NonMoveable
|
||||
{
|
||||
virtual ~IGraphRenderer() = default;
|
||||
struct IGraphRenderer : public NonCopyable, public NonMoveable
|
||||
{
|
||||
virtual ~IGraphRenderer() = default;
|
||||
|
||||
virtual HRESULT SetGraphSize(unsigned int width, unsigned int height) = 0;
|
||||
virtual HRESULT SetDpi(float dpiX, float dpiY) = 0;
|
||||
virtual HRESULT SetGraphSize(unsigned int width, unsigned int height) = 0;
|
||||
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 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 ScaleRange(double centerX, double centerY, double scale) = 0;
|
||||
virtual HRESULT ChangeRange(ChangeRangeAction action) = 0;
|
||||
virtual HRESULT MoveRangeByRatio(double ratioX, double ratioY) = 0;
|
||||
virtual HRESULT ResetRange() = 0;
|
||||
virtual HRESULT GetDisplayRanges(double& xMin, double& xMax, double& yMin, double& yMax) = 0;
|
||||
virtual HRESULT SetDisplayRanges(double xMin, double xMax, double yMin, double yMax) = 0;
|
||||
virtual HRESULT PrepareGraph() = 0;
|
||||
virtual HRESULT ScaleRange(double centerX, double centerY, double scale) = 0;
|
||||
virtual HRESULT ChangeRange(ChangeRangeAction action) = 0;
|
||||
virtual HRESULT MoveRangeByRatio(double ratioX, double ratioY) = 0;
|
||||
virtual HRESULT ResetRange() = 0;
|
||||
virtual HRESULT GetDisplayRanges(double& xMin, double& xMax, double& yMin, double& yMax) = 0;
|
||||
virtual HRESULT SetDisplayRanges(double xMin, double xMax, double yMin, double yMax) = 0;
|
||||
virtual HRESULT PrepareGraph() = 0;
|
||||
|
||||
virtual HRESULT GetBitmap(std::shared_ptr<Graphing::IBitmap>& bitmapOut, bool& hasSomeMissingDataOut) = 0;
|
||||
};
|
||||
virtual HRESULT GetBitmap(std::shared_ptr<Graphing::IBitmap>& bitmapOut, bool& hasSomeMissingDataOut) = 0;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -10,24 +10,24 @@
|
|||
|
||||
namespace Graphing
|
||||
{
|
||||
struct IGraphFunctionAnalysisData
|
||||
{
|
||||
std::wstring Domain;
|
||||
std::wstring Range;
|
||||
int Parity;
|
||||
int PeriodicityDirection;
|
||||
std::wstring PeriodicityExpression;
|
||||
std::wstring Zeros;
|
||||
std::wstring YIntercept;
|
||||
std::vector<std::wstring> Minima;
|
||||
std::vector<std::wstring> Maxima;
|
||||
std::vector<std::wstring> InflectionPoints;
|
||||
std::vector<std::wstring> VerticalAsymptotes;
|
||||
std::vector<std::wstring> HorizontalAsymptotes;
|
||||
std::vector<std::wstring> ObliqueAsymptotes;
|
||||
std::map<std::wstring, int> MonotoneIntervals;
|
||||
int TooComplexFeatures; // to-do: refactor to remove bitwise flag
|
||||
};
|
||||
struct IGraphFunctionAnalysisData
|
||||
{
|
||||
std::wstring Domain;
|
||||
std::wstring Range;
|
||||
int Parity;
|
||||
int PeriodicityDirection;
|
||||
std::wstring PeriodicityExpression;
|
||||
std::wstring Zeros;
|
||||
std::wstring YIntercept;
|
||||
std::vector<std::wstring> Minima;
|
||||
std::vector<std::wstring> Maxima;
|
||||
std::vector<std::wstring> InflectionPoints;
|
||||
std::vector<std::wstring> VerticalAsymptotes;
|
||||
std::vector<std::wstring> HorizontalAsymptotes;
|
||||
std::vector<std::wstring> ObliqueAsymptotes;
|
||||
std::map<std::wstring, int> MonotoneIntervals;
|
||||
int TooComplexFeatures; // to-do: refactor to remove bitwise flag
|
||||
};
|
||||
|
||||
struct IParsingOptions : public NonCopyable, public NonMoveable
|
||||
{
|
||||
|
@ -73,6 +73,6 @@ namespace Graphing
|
|||
|
||||
virtual std::wstring Serialize(const IExpression* expression) = 0;
|
||||
|
||||
virtual Graphing::IGraphFunctionAnalysisData Analyze(const Graphing::Analyzer::IGraphAnalyzer* analyzer) = 0;
|
||||
virtual Graphing::IGraphFunctionAnalysisData Analyze(const Graphing::Analyzer::IGraphAnalyzer* analyzer) = 0;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
@ -39,9 +39,9 @@ TraceLoggingCommon::TraceLoggingCommon()
|
|||
CoCreateGuid(&sessionGuid);
|
||||
}
|
||||
|
||||
TraceLoggingCommon ^ TraceLoggingCommon::GetInstance()
|
||||
TraceLoggingCommon ^ TraceLoggingCommon::GetInstance()
|
||||
{
|
||||
static TraceLoggingCommon ^ s_selfInstance = ref new TraceLoggingCommon();
|
||||
static TraceLoggingCommon ^ s_selfInstance = ref new TraceLoggingCommon();
|
||||
return s_selfInstance;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@ namespace TraceLogging
|
|||
private:
|
||||
TraceLoggingCommon();
|
||||
|
||||
|
||||
Windows::Foundation::Diagnostics::LoggingChannel ^ g_calculatorProvider;
|
||||
Windows::Foundation::Diagnostics::LoggingActivity ^ m_appLaunchActivity;
|
||||
GUID sessionGuid;
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
<packageSources>
|
||||
<clear />
|
||||
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
|
||||
<add key="EEApps" value="https://eeapps.blob.core.windows.net/eeapps/index.json" />
|
||||
</packageSources>
|
||||
<disabledPackageSources>
|
||||
<clear />
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue