mirror of
https://github.com/Microsoft/calculator.git
synced 2025-07-16 02:02:51 -07:00
Code cleaning: Remove all properties/functions not used in CalculationResult (#649)
This commit is contained in:
parent
f1863c0eb2
commit
712bdb1b7c
6 changed files with 28 additions and 65 deletions
|
@ -103,10 +103,6 @@ namespace CalculatorUnitTests
|
|||
{
|
||||
VERIFY_ARE_EQUAL(Platform::StringReference(currentItem->expectedPrimaryDisplay.c_str()), viewModel->DisplayValue);
|
||||
}
|
||||
if (currentItem->expectedExpressions != L"N/A" && viewModel->DisplayStringExpression != nullptr)
|
||||
{
|
||||
VERIFY_ARE_EQUAL(Platform::StringReference(currentItem->expectedExpressions.c_str()), viewModel->DisplayStringExpression);
|
||||
}
|
||||
currentItem++;
|
||||
}
|
||||
}
|
||||
|
@ -122,19 +118,13 @@ namespace CalculatorUnitTests
|
|||
m_decimalSeparator = ref new Platform::String(m_engineResourceProvider->GetCEngineString(L"sDecimal").c_str());
|
||||
}
|
||||
|
||||
void ValidateViewModelValueAndExpression(String ^ value, String ^ expression = nullptr)
|
||||
void ValidateViewModelValue(String ^ value)
|
||||
{
|
||||
String ^ displayValue = m_viewModel->DisplayValue;
|
||||
String ^ displayExpression = m_viewModel->DisplayStringExpression;
|
||||
if (value != nullptr)
|
||||
{
|
||||
VERIFY_ARE_EQUAL(value, displayValue);
|
||||
}
|
||||
|
||||
if (expression != nullptr)
|
||||
{
|
||||
VERIFY_ARE_EQUAL(expression, displayExpression);
|
||||
}
|
||||
}
|
||||
|
||||
void ValidateViewModelValueAndSecondaryExpression(String ^ value, String ^ expression = nullptr)
|
||||
|
@ -167,7 +157,6 @@ namespace CalculatorUnitTests
|
|||
StandardCalculatorViewModel ^ vmconstructortest = ref new StandardCalculatorViewModel();
|
||||
vmconstructortest->IsStandard = true;
|
||||
String ^ displayValue = vmconstructortest->DisplayValue;
|
||||
String ^ displayExpression = vmconstructortest->DisplayStringExpression;
|
||||
String ^ calculationResultAutomationName = vmconstructortest->CalculationResultAutomationName;
|
||||
|
||||
VERIFY_ARE_EQUAL(StringReference(L"0"), displayValue);
|
||||
|
@ -401,18 +390,18 @@ namespace CalculatorUnitTests
|
|||
m_viewModel->IsScientific = false;
|
||||
|
||||
m_viewModel->OnPaste("-0.99");
|
||||
ValidateViewModelValueAndExpression("-0" + m_decimalSeparator + "99", "");
|
||||
ValidateViewModelValue("-0" + m_decimalSeparator + "99");
|
||||
|
||||
m_viewModel->OnPaste("1+1=");
|
||||
ValidateViewModelValueAndExpression("2", "");
|
||||
ValidateViewModelValue("2");
|
||||
|
||||
// This result is not obvious: it's the result of the previous operation
|
||||
m_viewModel->OnPaste("0=");
|
||||
ValidateViewModelValueAndExpression("1", "");
|
||||
ValidateViewModelValue("1");
|
||||
|
||||
// Negative value
|
||||
m_viewModel->OnPaste("-1");
|
||||
ValidateViewModelValueAndExpression("-1", "");
|
||||
ValidateViewModelValue("-1");
|
||||
|
||||
// Negated expression
|
||||
m_viewModel->OnPaste("-(1+1)");
|
||||
|
@ -429,24 +418,24 @@ namespace CalculatorUnitTests
|
|||
|
||||
//// Positive exponent
|
||||
m_viewModel->OnPaste("1.23e+10");
|
||||
ValidateViewModelValueAndExpression("1" + m_decimalSeparator + "23e+10", "");
|
||||
ValidateViewModelValue("1" + m_decimalSeparator + "23e+10");
|
||||
|
||||
m_viewModel->OnPaste("1.23e10");
|
||||
ValidateViewModelValueAndExpression("1" + m_decimalSeparator + "23e+10", "");
|
||||
ValidateViewModelValue("1" + m_decimalSeparator + "23e+10");
|
||||
|
||||
m_viewModel->OnPaste("135e10");
|
||||
ValidateViewModelValueAndExpression("135" + m_decimalSeparator + "e+10", "");
|
||||
ValidateViewModelValue("135" + m_decimalSeparator + "e+10");
|
||||
|
||||
//// Negative exponent
|
||||
m_viewModel->OnPaste("1.23e-10");
|
||||
ValidateViewModelValueAndExpression("1" + m_decimalSeparator + "23e-10", "");
|
||||
ValidateViewModelValue("1" + m_decimalSeparator + "23e-10");
|
||||
|
||||
//// Uppercase E (for exponent)
|
||||
m_viewModel->OnPaste("1.23E-10");
|
||||
ValidateViewModelValueAndExpression("1" + m_decimalSeparator + "23e-10", "");
|
||||
ValidateViewModelValue("1" + m_decimalSeparator + "23e-10");
|
||||
|
||||
m_viewModel->OnPaste("135E10");
|
||||
ValidateViewModelValueAndExpression("135" + m_decimalSeparator + "e+10", "");
|
||||
ValidateViewModelValue("135" + m_decimalSeparator + "e+10");
|
||||
}
|
||||
|
||||
// Verify Calculator CalculationResultAutomationName is set correctly
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue