Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

90 lines
1.6 KiB

  1. //
  2. // A very simple test based on parser base classes
  3. // It understands only two commands 1 and 2 in first column.
  4. // 2's are simply ignored.
  5. // on execution of 1's I just loop for the id of current command
  6. // which is increased by 1 with every command encounterd, starting with 0.
  7. //
  8. //
  9. // t-vadims
  10. //
  11. #include <headers.cxx>
  12. #pragma hdrstop
  13. #include <bmp_test.hxx>
  14. SCODE CSimpleTest::SetParserObject ()
  15. {
  16. m_pParser = new CParserTest;
  17. return S_OK;
  18. }
  19. SCODE CSimpleTest::DeleteParserObject ()
  20. {
  21. delete m_pParser;
  22. return S_OK;
  23. }
  24. WCHAR* CSimpleTest::Name ()
  25. {
  26. return L"ParserTest";
  27. }
  28. WCHAR* CSimpleTest::SectionHeader()
  29. {
  30. return L"Simple test of interpreting files";
  31. }
  32. SCODE CParserTest::Setup (CTestInput *pInput)
  33. {
  34. /* do any neccessary setup staff */
  35. m_iInstrID = 0;
  36. return S_OK;
  37. }
  38. SCODE CParserTest::Cleanup ()
  39. {
  40. /* do any neccessary clean up */
  41. return S_OK;
  42. }
  43. ULONG CParserTest::ParseNewInstruction(LPWSTR pwszInstr)
  44. {
  45. ULONG ulID;
  46. if (pwszInstr[0] == L'1')
  47. {
  48. m_iInstrID ++;
  49. ulID = m_iInstrID;
  50. }
  51. else if (pwszInstr[0] == L'2')
  52. ulID = NOT_INSTRUCTION;
  53. else
  54. ulID = INVALID_INSTRUCTION;
  55. return ulID;
  56. }
  57. ULONG CParserTest::ExecuteInstruction(ULONG ulID)
  58. {
  59. CStopWatch sw;
  60. sw.Reset();
  61. for (ULONG i =0; i <=ulID; i++)
  62. /* empty loop */;
  63. return sw.Read();
  64. }
  65. WCHAR* CParserTest::InstructionName(ULONG ulID)
  66. {
  67. wsprintf(m_wszBuf, L"Instruction %ld", ulID);
  68. return m_wszBuf;
  69. }