Cleaning up some UnitConverter code and making some of it more efficient. (#875)
This commit is contained in:
@@ -327,12 +327,12 @@ namespace UnitConverterUnitTests
|
||||
// Test input escaping
|
||||
void UnitConverterTest::UnitConverterTestQuote()
|
||||
{
|
||||
wstring input1 = L"Weight";
|
||||
wstring output1 = L"Weight";
|
||||
wstring input2 = L"{p}Weig;[ht|";
|
||||
wstring output2 = L"{lb}p{rb}Weig{sc}{lc}ht{p}";
|
||||
wstring input3 = L"{{{t;s}}},:]";
|
||||
wstring output3 = L"{lb}{lb}{lb}t{sc}s{rb}{rb}{rb}{cm}{co}{rc}";
|
||||
constexpr wstring_view input1 = L"Weight";
|
||||
constexpr wstring_view output1 = L"Weight";
|
||||
constexpr wstring_view input2 = L"{p}Weig;[ht|";
|
||||
constexpr wstring_view output2 = L"{lb}p{rb}Weig{sc}{lc}ht{p}";
|
||||
constexpr wstring_view input3 = L"{{{t;s}}},:]";
|
||||
constexpr wstring_view output3 = L"{lb}{lb}{lb}t{sc}s{rb}{rb}{rb}{cm}{co}{rc}";
|
||||
VERIFY_IS_TRUE(UnitConverter::Quote(input1) == output1);
|
||||
VERIFY_IS_TRUE(UnitConverter::Quote(input2) == output2);
|
||||
VERIFY_IS_TRUE(UnitConverter::Quote(input3) == output3);
|
||||
@@ -341,9 +341,9 @@ namespace UnitConverterUnitTests
|
||||
// Test output unescaping
|
||||
void UnitConverterTest::UnitConverterTestUnquote()
|
||||
{
|
||||
wstring input1 = L"Weight";
|
||||
wstring input2 = L"{p}Weig;[ht|";
|
||||
wstring input3 = L"{{{t;s}}},:]";
|
||||
constexpr wstring_view input1 = L"Weight";
|
||||
constexpr wstring_view input2 = L"{p}Weig;[ht|";
|
||||
constexpr wstring_view input3 = L"{{{t;s}}},:]";
|
||||
VERIFY_IS_TRUE(UnitConverter::Unquote(input1) == input1);
|
||||
VERIFY_IS_TRUE(UnitConverter::Unquote(UnitConverter::Quote(input1)) == input1);
|
||||
VERIFY_IS_TRUE(UnitConverter::Unquote(UnitConverter::Quote(input2)) == input2);
|
||||
|
@@ -227,7 +227,7 @@ void UnitConverterMock::SwitchActive(const std::wstring& newValue)
|
||||
return L"TEST";
|
||||
};
|
||||
|
||||
void UnitConverterMock::RestoreUserPreferences(_In_ const std::wstring& /*userPreferences*/){};
|
||||
void UnitConverterMock::RestoreUserPreferences(_In_ std::wstring_view /*userPreferences*/){};
|
||||
|
||||
void UnitConverterMock::SendCommand(UCM::Command command)
|
||||
{
|
||||
|
@@ -35,7 +35,7 @@ namespace CalculatorUnitTests
|
||||
void SetCurrentUnitTypes(const UCM::Unit& fromType, const UCM::Unit& toType) override;
|
||||
void SwitchActive(const std::wstring& newValue);
|
||||
std::wstring SaveUserPreferences() override;
|
||||
void RestoreUserPreferences(_In_ const std::wstring& userPreferences) override;
|
||||
void RestoreUserPreferences(_In_ std::wstring_view userPreferences) override;
|
||||
void SendCommand(UCM::Command command) override;
|
||||
void SetViewModelCallback(const std::shared_ptr<UCM::IUnitConverterVMCallback>& newCallback) override;
|
||||
void SetViewModelCurrencyCallback(_In_ const std::shared_ptr<UCM::IViewModelCurrencyCallback>& /*newCallback*/) override
|
||||
|
Reference in New Issue
Block a user