Code cleaning: Remove all properties/functions not used in CalculationResult (#649)

This commit is contained in:
Rudy Huyn 2020-01-07 11:03:47 -08:00 committed by Matt Cooley
parent f1863c0eb2
commit 712bdb1b7c
6 changed files with 28 additions and 65 deletions

View file

@ -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