Updating comments per the C++ core guidelines and removing trailing whitespace (#194)
Fixed comments that were inconsistent with the style guidelines described in C++ core guidelines and the modern C++/WinRT language projections and removed trailing whitespace. Inserted a space after the beginning of the comment so the text wasn't touching the // on all occurrences. Removed all occurrences of trailing whitespace
This commit is contained in:
@@ -526,7 +526,7 @@ namespace CalculatorManagerTest
|
||||
|
||||
Command commands22[] = { Command::Command0, Command::CommandSQRT, Command::CommandNULL };
|
||||
TestDriver::Test(L"0", L"\x221A(0)", commands22);
|
||||
|
||||
|
||||
Command commands23[] = { Command::Command1, Command::Command0, Command::Command2, Command::Command4,
|
||||
Command::CommandSQRT, Command::CommandSUB, Command::Command3, Command::Command2,
|
||||
Command::CommandADD, Command::CommandNULL };
|
||||
@@ -593,11 +593,11 @@ namespace CalculatorManagerTest
|
||||
Command commands17[] = { Command::Command5, Command::CommandPWR, Command::Command0,
|
||||
Command::CommandADD, Command::CommandNULL };
|
||||
TestDriver::Test(L"1", L"5 ^ 0 + ", commands17);
|
||||
|
||||
|
||||
Command commands18[] = { Command::Command0, Command::CommandPWR, Command::Command0,
|
||||
Command::CommandADD, Command::CommandNULL };
|
||||
TestDriver::Test(L"1", L"0 ^ 0 + ", commands18);
|
||||
|
||||
|
||||
Command commands19[] = { Command::Command2, Command::Command7, Command::CommandSIGN, Command::CommandROOT,
|
||||
Command::Command3, Command::CommandADD, Command::CommandNULL };
|
||||
TestDriver::Test(L"-3", L"-27 yroot 3 + ", commands19, true, true);
|
||||
@@ -859,7 +859,7 @@ namespace CalculatorManagerTest
|
||||
memorizedNumbers = pCalculatorDisplay->GetMemorizedNumbers();
|
||||
VERIFY_ARE_EQUAL(wstring(L"2"), memorizedNumbers.at(0));
|
||||
|
||||
// Test for trying to memorize invalid value
|
||||
// Test for trying to memorize invalid value
|
||||
m_calculatorManager->SendCommand(Command::Command2);
|
||||
m_calculatorManager->SendCommand(Command::CommandSIGN);
|
||||
m_calculatorManager->SendCommand(Command::CommandSQRT);
|
||||
|
@@ -264,7 +264,7 @@ namespace CalculatorUnitTests
|
||||
VERIFY_IS_FALSE(loader.LoadFinished());
|
||||
VERIFY_IS_FALSE(loader.LoadedFromCache());
|
||||
}
|
||||
|
||||
|
||||
TEST_METHOD(LoadFromCache_Fail_ResponseLanguageChanged)
|
||||
{
|
||||
DateTime now = Utils::GetUniversalSystemTime();
|
||||
|
@@ -354,7 +354,7 @@ namespace CalculatorUnitTests
|
||||
{ NumbersAndOperatorsEnum::HexButton, L"0", L"" },
|
||||
{ NumbersAndOperatorsEnum::None, L"", L"" }
|
||||
};
|
||||
|
||||
|
||||
ValidateViewModelByCommands(programmerViewModel1, programmerModeInitializeItems1, false);
|
||||
|
||||
// Bit Length: Word & Radix Type: Oct
|
||||
@@ -369,7 +369,7 @@ namespace CalculatorUnitTests
|
||||
TESTITEM programmerModeTestItems1[] = {
|
||||
{ NumbersAndOperatorsEnum::F, L"F", L"" },
|
||||
{ NumbersAndOperatorsEnum::F, L"FF", L"" },
|
||||
// One more F shouldn't have any effect, testing for precision
|
||||
// One more F shouldn't have any effect, testing for precision
|
||||
{ NumbersAndOperatorsEnum::F, L"FF", L"" },
|
||||
{ NumbersAndOperatorsEnum::None, L"", L"" }
|
||||
};
|
||||
@@ -663,7 +663,7 @@ namespace CalculatorUnitTests
|
||||
// needs to be updated with correct expected value and viewmodel needs
|
||||
// to be updated to calculate correct value.
|
||||
|
||||
//DateCalculatorViewModel^ viewModels[4];
|
||||
// DateCalculatorViewModel^ viewModels[4];
|
||||
|
||||
//// Initialize the view models
|
||||
//for (int i = 0; i < 4; i++)
|
||||
@@ -776,7 +776,7 @@ namespace CalculatorUnitTests
|
||||
VERIFY_IS_TRUE(CAT1 == viewModels[0]->CurrentCategory->GetModelCategory());
|
||||
VERIFY_IS_TRUE(CAT2 == viewModels[1]->CurrentCategory->GetModelCategory());
|
||||
VERIFY_IS_TRUE(CAT3 == viewModels[2]->CurrentCategory->GetModelCategory());
|
||||
|
||||
|
||||
VERIFY_IS_TRUE(UNIT1 == viewModels[0]->Unit1->GetModelUnit());
|
||||
VERIFY_IS_TRUE(UNIT2 == viewModels[0]->Unit2->GetModelUnit());
|
||||
|
||||
@@ -925,7 +925,7 @@ namespace CalculatorUnitTests
|
||||
VERIFY_ARE_EQUAL(GetStringValue(standardViewModel->DisplayValue), StringReference(L"1"));
|
||||
|
||||
// Again perform calculations on Standard Calc instance and validate that the Converter remains unaffected
|
||||
|
||||
|
||||
// Standard Mode: Expression 1+2=
|
||||
TESTITEM standardModeTestItems2[] = {
|
||||
{ NumbersAndOperatorsEnum::One, L"1", L"" },
|
||||
@@ -978,7 +978,7 @@ namespace CalculatorUnitTests
|
||||
};
|
||||
ValidateViewModelByCommands(viewModels[0], standardModeTestItems, false /*doReset*/);
|
||||
|
||||
//Launch a new instance in standard mode
|
||||
// Launch a new instance in standard mode
|
||||
viewModels[2] = ref new StandardCalculatorViewModel();
|
||||
ChangeMode(viewModels[2], 0);
|
||||
|
||||
@@ -994,7 +994,7 @@ namespace CalculatorUnitTests
|
||||
};
|
||||
ValidateViewModelByCommands(viewModels[2], standardModeTestItemsNew, false /*doReset*/);
|
||||
|
||||
//Radix in the programmer mode launched should still be hex.
|
||||
// Radix in the programmer mode launched should still be hex.
|
||||
// A + 1 = B
|
||||
TESTITEM programmerModeTestItemsNew[] = {
|
||||
{ NumbersAndOperatorsEnum::A, L"A", L"" },
|
||||
|
@@ -779,7 +779,7 @@ namespace CalculatorUnitTests
|
||||
VERIFY_ARE_EQUAL(viewModel->IsOperatorCommand, false);
|
||||
}
|
||||
|
||||
//When memory button is pressed - verify if display value is being stored in vector
|
||||
// When memory button is pressed - verify if display value is being stored in vector
|
||||
TEST_METHOD(OnMemoryButtonPressed)
|
||||
{
|
||||
StandardCalculatorViewModel^ viewModel = ref new StandardCalculatorViewModel();
|
||||
@@ -790,7 +790,7 @@ namespace CalculatorUnitTests
|
||||
VERIFY_ARE_EQUAL((int)viewModel->MemorizedNumbers->Size, 2);
|
||||
}
|
||||
|
||||
//when memory list is empty and M+ is pressed
|
||||
// When memory list is empty and M+ is pressed
|
||||
TEST_METHOD(OnMemoryAddWhenMemoryEmpty)
|
||||
{
|
||||
m_viewModel->IsStandard = true;
|
||||
@@ -808,7 +808,7 @@ namespace CalculatorUnitTests
|
||||
}
|
||||
|
||||
|
||||
//when memory list is empty and M- is pressed
|
||||
// When memory list is empty and M- is pressed
|
||||
TEST_METHOD(OnMemorySubtractWhenMemoryEmpty)
|
||||
{
|
||||
m_viewModel->IsStandard = true;
|
||||
@@ -825,7 +825,7 @@ namespace CalculatorUnitTests
|
||||
VERIFY_ARE_EQUAL(Platform::StringReference(L"-1,001"), m_viewModel->DisplayValue);
|
||||
}
|
||||
|
||||
//when negative number is saved in memory
|
||||
// When negative number is saved in memory
|
||||
TEST_METHOD(OnNegativeEntryInMemory)
|
||||
{
|
||||
ChangeMode(m_viewModel, 0/*Standard*/);
|
||||
@@ -851,7 +851,7 @@ namespace CalculatorUnitTests
|
||||
VERIFY_ARE_EQUAL(Platform::StringReference(L"-1,001"), Utils::GetStringValue(memorySlotProgrammer->Value));
|
||||
}
|
||||
|
||||
//when decimal number is saved in memory
|
||||
// When decimal number is saved in memory
|
||||
TEST_METHOD(OnDecimalEntryInMemory)
|
||||
{
|
||||
ChangeMode(m_viewModel, 0/*Standard*/);
|
||||
@@ -878,7 +878,7 @@ namespace CalculatorUnitTests
|
||||
VERIFY_ARE_EQUAL(Platform::StringReference(L"1,001"), Utils::GetStringValue(memorySlotProgrammer->Value));
|
||||
}
|
||||
|
||||
//when negative decimal number is saved in memory
|
||||
// When negative decimal number is saved in memory
|
||||
TEST_METHOD(OnNegativeDecimalInMemory)
|
||||
{
|
||||
m_viewModel->IsStandard = true;
|
||||
@@ -898,7 +898,7 @@ namespace CalculatorUnitTests
|
||||
VERIFY_ARE_EQUAL(Platform::StringReference(L"-1,001.1"), m_viewModel->DisplayValue);
|
||||
}
|
||||
|
||||
//when decimal number is added to the memory
|
||||
// When decimal number is added to the memory
|
||||
TEST_METHOD(OnDecimalAddedToMemory)
|
||||
{
|
||||
m_viewModel->IsStandard = true;
|
||||
@@ -928,7 +928,7 @@ namespace CalculatorUnitTests
|
||||
VERIFY_ARE_EQUAL(Platform::StringReference(L"2,002.1"), m_viewModel->DisplayValue);
|
||||
}
|
||||
|
||||
//when memory is saved in programmer as Hex value and then we switch to standard mode, test to see that memory gets converted to decimal
|
||||
// When memory is saved in programmer as Hex value and then we switch to standard mode, test to see that memory gets converted to decimal
|
||||
TEST_METHOD(OnMemorySavedInHexRadixAndSwitchedToStandardMode)
|
||||
{
|
||||
ChangeMode(m_viewModel, 2/*programmer*/);
|
||||
@@ -971,8 +971,8 @@ namespace CalculatorUnitTests
|
||||
|
||||
}
|
||||
|
||||
//When memory button is pressed more than max number of slots allowed,
|
||||
//the MemorizedNumbers vector size should not increase.
|
||||
// When memory button is pressed more than max number of slots allowed,
|
||||
// the MemorizedNumbers vector size should not increase.
|
||||
TEST_METHOD(OnMemoryButtonPressedMaxTimes)
|
||||
{
|
||||
StandardCalculatorViewModel^ viewModel = ref new StandardCalculatorViewModel();
|
||||
@@ -1014,7 +1014,7 @@ namespace CalculatorUnitTests
|
||||
VERIFY_ARE_EQUAL(Platform::StringReference(L"1,001"), m_viewModel->DisplayValue);
|
||||
}
|
||||
|
||||
// verify nothing happens if there is no memory and the memory slot pressed action is taken
|
||||
// Verify nothing happens if there is no memory and the memory slot pressed action is taken
|
||||
TEST_METHOD(OnMemoryItemPressedNoMemory)
|
||||
{
|
||||
TESTITEM items[] = {
|
||||
|
@@ -76,7 +76,7 @@ namespace UnitConverterUnitTests
|
||||
SetConversionDataParams(&conversion4, 0.453592, 0, false);
|
||||
SetConversionDataParams(&conversion5, 2.20462, 0, false);
|
||||
|
||||
//Setting the conversion ratios for testing
|
||||
// Setting the conversion ratios for testing
|
||||
unit1Map[u1] = conversion1;
|
||||
unit1Map[u2] = conversion2;
|
||||
|
||||
@@ -95,7 +95,7 @@ namespace UnitConverterUnitTests
|
||||
m_ratioMaps[u3] = unit3Map;
|
||||
m_ratioMaps[u4] = unit4Map;
|
||||
}
|
||||
|
||||
|
||||
void LoadData()
|
||||
{
|
||||
m_loadDataCallCount++;
|
||||
@@ -105,12 +105,12 @@ namespace UnitConverterUnitTests
|
||||
{
|
||||
return m_categories;
|
||||
}
|
||||
|
||||
|
||||
vector<Unit> LoadOrderedUnits(const Category& c)
|
||||
{
|
||||
return m_units[c];
|
||||
}
|
||||
|
||||
|
||||
unordered_map<Unit, ConversionData, UnitHash> LoadOrderedRatios(const Unit& u)
|
||||
{
|
||||
return m_ratioMaps[u];
|
||||
|
@@ -286,7 +286,7 @@ namespace CalculatorUnitTests
|
||||
VM::UnitConverterViewModel^ vm = ref new UnitConverterViewModel(make_shared<UnitConversionManager::UnitConverter>(make_shared<UnitConverterDataLoader>(ref new GeographicRegion()), nullptr));
|
||||
IObservableVector<Category^>^ categoryList = vm->Categories;
|
||||
ResourceLoader^ m_resLoader = ResourceLoader::GetForViewIndependentUse("Test");
|
||||
double epsilon = 0.1; //Could be more precise like 0.001 except atm to pascal conversion
|
||||
double epsilon = 0.1; // Could be more precise like 0.001 except atm to pascal conversion
|
||||
|
||||
for (unsigned int k = 0; k < categoryList->Size; k++)
|
||||
{
|
||||
@@ -302,7 +302,7 @@ namespace CalculatorUnitTests
|
||||
vm->Value1Active = false;
|
||||
vm->Unit2 = unitList->GetAt(j);
|
||||
wstring unit2Name = vm->Unit2->Name->Data();
|
||||
//change value2 as 1.
|
||||
// Change value2 as 1.
|
||||
vm->ButtonPressed->Execute(NumbersAndOperatorsEnum::One);
|
||||
String^ expectedResult = m_resLoader->GetString(ref new String((unit1Name + L"-" + unit2Name).c_str()));
|
||||
|
||||
@@ -315,10 +315,10 @@ namespace CalculatorUnitTests
|
||||
double actualConversion = GetDoubleFromWstring(GetStringValue(vm->Value1)->Data());
|
||||
double diff = abs(expectedConversion - actualConversion);
|
||||
|
||||
// assert for diff less than epsilonth fraction of expected conversion result
|
||||
// Assert for diff less than epsilonth fraction of expected conversion result
|
||||
VERIFY_IS_LESS_THAN_OR_EQUAL(diff, epsilon*expectedConversion);
|
||||
}
|
||||
//clearing the value1
|
||||
// Clearing the value1
|
||||
vm->ButtonPressed->Execute(NumbersAndOperatorsEnum::Clear);
|
||||
}
|
||||
}
|
||||
@@ -356,7 +356,7 @@ namespace CalculatorUnitTests
|
||||
VERIFY_ARE_EQUAL((UINT)1, mock->m_setVMCallbackCallCount);
|
||||
}
|
||||
|
||||
// Test that we've set up all categories on load and that the first
|
||||
// Test that we've set up all categories on load and that the first
|
||||
// category is selected.
|
||||
TEST_METHOD(TestUnitConverterLoadSetsUpCategories)
|
||||
{
|
||||
@@ -393,7 +393,7 @@ namespace CalculatorUnitTests
|
||||
shared_ptr<UnitConverterMock> mock = make_shared<UnitConverterMock>();
|
||||
VM::UnitConverterViewModel vm(mock);
|
||||
vm.Unit1 = vm.Units->GetAt(1); // Change from u4 to u5
|
||||
// count will be 2 here since it was already called once at init
|
||||
// Count will be 2 here since it was already called once at init
|
||||
VERIFY_ARE_EQUAL((UINT)2, mock->m_setCurUnitTypesCallCount);
|
||||
VERIFY_IS_TRUE(UNIT5 == mock->m_curFrom);
|
||||
VERIFY_IS_TRUE(UNIT6 == mock->m_curTo);
|
||||
@@ -409,7 +409,7 @@ namespace CalculatorUnitTests
|
||||
shared_ptr<UnitConverterMock> mock = make_shared<UnitConverterMock>();
|
||||
VM::UnitConverterViewModel vm(mock);
|
||||
vm.CurrentCategory = vm.Categories->GetAt(2); // Change from cat1 to cat3
|
||||
// counts will be 2 here since the first call should have happened during init
|
||||
// Counts will be 2 here since the first call should have happened during init
|
||||
VERIFY_IS_GREATER_THAN_OR_EQUAL(2u, mock->m_setCurrentCategoryCallCount);
|
||||
VERIFY_ARE_EQUAL((UINT)3, vm.Units->Size);
|
||||
VERIFY_IS_TRUE(UNIT7 == vm.Units->GetAt(0)->GetModelUnit());
|
||||
@@ -424,7 +424,7 @@ namespace CalculatorUnitTests
|
||||
shared_ptr<UnitConverterMock> mock = make_shared<UnitConverterMock>();
|
||||
VM::UnitConverterViewModel vm(mock);
|
||||
vm.CurrentCategory = vm.Categories->GetAt(2); // Change from cat1 to cat3
|
||||
// counts will be 2 here since the first call should have happened during init
|
||||
// Counts will be 2 here since the first call should have happened during init
|
||||
VERIFY_IS_GREATER_THAN_OR_EQUAL(2u, mock->m_setCurrentCategoryCallCount);
|
||||
VERIFY_IS_TRUE(UNIT9 == vm.Unit1->GetModelUnit());
|
||||
VERIFY_IS_TRUE(UNIT7 == vm.Unit2->GetModelUnit());
|
||||
@@ -451,7 +451,7 @@ namespace CalculatorUnitTests
|
||||
shared_ptr<UnitConverterMock> mock = make_shared<UnitConverterMock>();
|
||||
VM::UnitConverterViewModel vm(mock);
|
||||
|
||||
// Call count is being set to 1 because we send 'CE' command as the first call
|
||||
// Call count is being set to 1 because we send 'CE' command as the first call
|
||||
UINT callCount = 1;
|
||||
|
||||
vm.ButtonPressed->Execute(CalculatorApp::NumbersAndOperatorsEnum::Zero);
|
||||
@@ -1045,7 +1045,7 @@ namespace CalculatorUnitTests
|
||||
VERIFY_ARE_EQUAL((UCM::EMPTY_UNIT).id, (vm.Units->GetAt(0)->GetModelUnit()).id);
|
||||
}
|
||||
|
||||
// Test that a valid model unit list vuilds
|
||||
// Test that a valid model unit list vuilds
|
||||
TEST_METHOD(TestUnitsListBuildsFromValidModelUnitList)
|
||||
{
|
||||
shared_ptr<UnitConverterMock> mock = make_shared<UnitConverterMock>();
|
||||
|
@@ -76,7 +76,7 @@ void App::OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEvent
|
||||
// Place the frame in the current Window
|
||||
Window::Current->Content = rootFrame;
|
||||
}
|
||||
|
||||
|
||||
Microsoft::VisualStudio::TestPlatform::TestExecutor::WinRTCore::UnitTestClient::CreateDefaultUI();
|
||||
|
||||
Window::Current->Activate();
|
||||
@@ -96,7 +96,7 @@ void App::OnSuspending(Object^ sender, SuspendingEventArgs^ e)
|
||||
(void) sender; // Unused parameter
|
||||
(void) e; // Unused parameter
|
||||
|
||||
//TODO: Save application state and stop any background activity
|
||||
// TODO: Save application state and stop any background activity
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@@ -73,7 +73,7 @@ namespace StandardPeers = Windows::UI::Xaml::Automation::Peers;
|
||||
namespace CalculatorApp::Common::Automation {}
|
||||
namespace CustomPeers = CalculatorApp::Common::Automation;
|
||||
|
||||
//CalcManager Headers
|
||||
// CalcManager Headers
|
||||
#include "CalcManager/CalculatorVector.h"
|
||||
#include "CalcManager/ExpressionCommand.h"
|
||||
#include "CalcManager/CalculatorResource.h"
|
||||
|
@@ -3,7 +3,7 @@
|
||||
// Used by CalculatorUnitTests_VS.rc
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 101
|
||||
|
Reference in New Issue
Block a user