mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-22 06:13:14 -07:00
Add unit tests to test white space characters
This commit is contained in:
parent
9c47642515
commit
07c874b7af
2 changed files with 14 additions and 1 deletions
|
@ -38,7 +38,7 @@ static const wstring c_binProgrammerChars = L"[0-1]+([_'`][0-1]+)*";
|
|||
static const wstring c_uIntSuffixes = L"[uU]?[lL]{0,2}";
|
||||
|
||||
// Regex used to format the string coming from the clipboard
|
||||
static const wstring c_formatSpaces = L"[\\s\\x85]+";
|
||||
static const wstring c_formatSpaces = L"\\s+";
|
||||
static const wstring c_formatTrimAndRemoveUselessChars = L"^ | $|,|\"";
|
||||
|
||||
// RegEx Patterns used by various modes
|
||||
|
|
|
@ -82,6 +82,19 @@ namespace CalculatorUnitTests
|
|||
VERIFY_IS_FALSE(m_CopyPasteManager.ValidatePasteExpression(StringReference(L"123"), ViewMode::None, CategoryGroupType::None, -1, -1), L"Verify pasting without a ViewMode or Category is invalid");
|
||||
};
|
||||
|
||||
TEST_METHOD(ValidatePasteWhiteSpacesStates)
|
||||
{
|
||||
VERIFY_IS_TRUE(m_CopyPasteManager.ValidatePasteExpression(StringReference(L"\t123\t+\t\t124\t"), ViewMode::Standard, CategoryGroupType::None, -1, -1), L"Verify pasting with tabs");
|
||||
VERIFY_IS_TRUE(m_CopyPasteManager.ValidatePasteExpression(StringReference(L" 123 + 124 "), ViewMode::Standard, CategoryGroupType::None, -1, -1), L"Verify pasting with spaces");
|
||||
VERIFY_IS_TRUE(m_CopyPasteManager.ValidatePasteExpression(StringReference(L"\n\n\n\n\n\n123\n\n\n+\n\n124\n\n\n\n\n\n\n\n\n\n\n\n\n\n"), ViewMode::Standard, CategoryGroupType::None, -1, -1), L"Verify pasting with new line");
|
||||
VERIFY_IS_TRUE(m_CopyPasteManager.ValidatePasteExpression(StringReference(L"\r\r\r123\r\r\r\r+124\r\r"), ViewMode::Standard, CategoryGroupType::None, -1, -1), L"Verify pasting with carriage return");
|
||||
VERIFY_IS_TRUE(m_CopyPasteManager.ValidatePasteExpression(StringReference(L"\u0020\u0020 123\u0020\u0020\u0020\u0020+\u0020\u0020 124\u0020\u0020"), ViewMode::Standard, CategoryGroupType::None, -1, -1), L"Verify pasting with no-break space");
|
||||
VERIFY_IS_TRUE(m_CopyPasteManager.ValidatePasteExpression(StringReference(L"\f\f\f123+\f\f124\f\f\f"), ViewMode::Standard, CategoryGroupType::None, -1, -1), L"Verify pasting with feeds");
|
||||
VERIFY_IS_TRUE(m_CopyPasteManager.ValidatePasteExpression(StringReference(L"\t123\t+\t\t124\t"), ViewMode::Standard, CategoryGroupType::None, -1, -1), L"Verify pasting with tabs");
|
||||
VERIFY_IS_TRUE(m_CopyPasteManager.ValidatePasteExpression(StringReference(L"\x85 123\x85+\x85\x85\x85 124"), ViewMode::Standard, CategoryGroupType::None, -1, -1), L"Verify pasting with tabs");
|
||||
VERIFY_IS_TRUE(m_CopyPasteManager.ValidatePasteExpression(StringReference(L"\t\x85\r\t \n\u0020\n123\t\n+\t \t124\r\n"), ViewMode::Standard, CategoryGroupType::None, -1, -1), L"Verify pasting with tabs");
|
||||
};
|
||||
|
||||
TEST_METHOD(ValidateExtractOperands)
|
||||
{
|
||||
vector<wstring> results = {};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue