Skip to content

Commit

Permalink
refactor test
Browse files Browse the repository at this point in the history
  • Loading branch information
tusharsnx committed Jul 12, 2023
1 parent 8ffebd1 commit d7aa1d7
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/terminal/parser/ut_parser/OutputEngineTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -456,10 +456,10 @@ class Microsoft::Console::VirtualTerminal::OutputEngineTest final
VERIFY_ARE_EQUAL(mach._state, StateMachine::VTStates::Ground);
mach.ProcessCharacter(AsciiChars::ESC);
VERIFY_ARE_EQUAL(mach._state, StateMachine::VTStates::Escape);
mach.ProcessCharacter(L'[');
VERIFY_ARE_EQUAL(mach._state, StateMachine::VTStates::CsiEntry);
for (size_t nParam = 0; nParam < 2; nParam++)
{
mach.ProcessCharacter(L'[');
VERIFY_ARE_EQUAL(mach._state, StateMachine::VTStates::CsiEntry);
mach.ProcessCharacter(L'3');
VERIFY_ARE_EQUAL(mach._state, StateMachine::VTStates::CsiParam);
for (size_t i = 0; i < 100; i++)
Expand All @@ -471,21 +471,24 @@ class Microsoft::Console::VirtualTerminal::OutputEngineTest final
}
Log::Comment(L"Receiving 100 sub parameters should set the overflow flag");
VERIFY_IS_TRUE(mach._subParameterLimitOverflowed);
mach.ProcessCharacter(L';');
VERIFY_ARE_EQUAL(mach._state, StateMachine::VTStates::CsiParam);
VERIFY_IS_FALSE(mach._subParameterLimitOverflowed);
}
mach.ProcessCharacter(L'J');
VERIFY_ARE_EQUAL(mach._state, StateMachine::VTStates::Ground);

Log::Comment(L"Only MAX_SUBPARAMETER_COUNT (6) sub parameters should be stored for each parameter");
VERIFY_ARE_EQUAL(mach._subParameters.size(), 12u);

for (size_t nParam = 0; nParam < 2; nParam++)
// Verify that first 6 sub parameters are stored for each parameter.
// subParameters = { 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5 }
for (size_t i = 0; i < 12 ; i++)
{
for (size_t i = nParam * MAX_SUBPARAMETER_COUNT; i < (nParam + 1) * MAX_SUBPARAMETER_COUNT; i++)
{
VERIFY_IS_TRUE(mach._subParameters.at(i).has_value());
VERIFY_ARE_EQUAL(mach._subParameters.at(i).value(), gsl::narrow_cast<VTInt>(i % 10));
}
VERIFY_IS_TRUE(mach._subParameters.at(i).has_value());
VERIFY_ARE_EQUAL(mach._subParameters.at(i).value(), gsl::narrow_cast<VTInt>(i % 6));
}

auto firstRange = mach._subParameterRanges.at(0);
auto secondRange = mach._subParameterRanges.at(1);
VERIFY_ARE_EQUAL(firstRange.first, 0);
Expand Down

0 comments on commit d7aa1d7

Please sign in to comment.