示例#1
0
void PerfQuery::OnCommandBufferExecuted(VkFence fence)
{
  // Need to save these since ProcessResults will modify them.
  u32 query_read_pos = m_query_read_pos;
  u32 query_count = m_query_count;

  // Flush as many queries as are bound to this fence.
  u32 flush_start_index = 0;
  u32 flush_count = 0;
  for (u32 i = 0; i < query_count; i++)
  {
    u32 index = (query_read_pos + i) % PERF_QUERY_BUFFER_SIZE;
    if (m_query_buffer[index].pending_fence != fence)
    {
      // These should be grouped together, at the end.
      break;
    }

    // If this wrapped around, we need to flush the entries before the end of the buffer.
    if (index < flush_start_index)
    {
      ProcessResults(flush_start_index, flush_count);
      flush_start_index = index;
      flush_count = 0;
    }
    else if (flush_count == 0)
    {
      flush_start_index = index;
    }
    flush_count++;
  }

  if (flush_count > 0)
    ProcessResults(flush_start_index, flush_count);
}
void FAutomationControllerManager::ProcessAvailableTasks()
{
	// Distribute tasks
	if( ClusterDistributionMask != 0)
	{
		// For each device cluster
		for( int32 ClusterIndex = 0; ClusterIndex < DeviceClusterManager.GetNumClusters(); ++ClusterIndex )
		{
			bool bAllTestsComplete = true;

			// If any of the devices were valid
			if( ( ClusterDistributionMask & ( 1<< ClusterIndex ) ) && DeviceClusterManager.GetNumDevicesInCluster( ClusterIndex ) > 0 )
			{
				ExecuteNextTask( ClusterIndex, bAllTestsComplete );
			}

			//if we're all done running our tests
			if ( bAllTestsComplete )
			{
				//we don't need to test this cluster anymore
				ClusterDistributionMask &= ~( 1<<ClusterIndex );

				if ( ClusterDistributionMask == 0 )
				{
					ProcessResults();

					//Notify the graphical layout we are done processing results.
					TestsCompleteDelegate.ExecuteIfBound();
				}
			}
		}
	}

	if (bIsLocalSession == false)
	{
		// Update the test status for timeouts if this is not a local session
		UpdateTests();
	}
}
示例#3
0
/****
 * ParseEventLogInternal
 *
 * DESC:
 *     Gets the most recent event log record
 *
 * ARGS:
 *     server - IP or host to connect to
 *     domain - domain within the host (empty string for none)
 *     username - username within the domain
 *     password - password for above user
 *     logName - event log to open (default to "Application" if NULL)
 *     query - XPath query to retrieve (see remarks)
 *     outputFormat - set to 0 (JSON) otherwise XML
 *     debug - set to 0 (none) 1 (basic) or 2 (verbose)
 *     mode - mode to run the parser (see remarks)
 *
 * REMARKS:
 *     XPath:
 * 
 *     The Windows Event log is structurally an XML document. You
 *     may therefore use XPath queries to retrieve the information 
 *     you want. Pre-defined XPath queries have been built into the
 *     supplementary Perl module. However, you are free to modify
 *     that module to include newer queries, based on your requirements
 *
 *     mode:
 *
 *     Can be set to either MODE_FETCH_LAST_RECORD or MODE_DEFAULT. The
 *     former will simply return the Event Log Record ID of the topmost
 *     (i.e. the latest) event record. The latter will do the actual
 *     processing of parsing an event log record to the screen.
 *
 *     Note: As per previous discussions, output format is forced as
 *     JSON here. To re-allow XML, simply replace OUTPUT_FORMAT_JSON
 *     with outputFormat, in the line of code, below
 */
DWORD64 ParseEventLogInternal(LPWSTR server, LPWSTR domain, LPWSTR username, LPWSTR password, LPWSTR logName, LPWSTR query, INT outputFormat, INT debug, INT mode) {	
	bool getLastRecord = false;
	DWORD64 result = 0;

	if( debug > DEBUG_L1 ) {
		wprintf(L"[ParseEventLogInternal]: Attempting to connect to '%s' on domain '%s' using %s:%s...\n", server, domain, username, password);
	}

	// If no domain was supplied
	if( wcslen(domain) == 0 ) {
		// Official MSDN specs request NULL instead of an empty string
		domain = NULL;

		if( debug >= DEBUG_L1 ) {
			wprintf(L"[ParseEventLogInternal]: Empty domain supplied. Default to NULL\n");
		}		
	}
		
	// If a blank query was supplied, assume no query (NULL)
	if( lstrlen(query) == 0 )
		query = NULL;

	// If the supplied query is our special token that retrieves the last record
	if( lstrcmpW( query, L"LAST_RECORD") == 0 ) {
		if( debug >= DEBUG_L1 ) {
			wprintf(L"[ParseEventLogInternal]: Mode is last record fetch\n");
		}

		// Flag the processing routine to only fetch the lastest record
		getLastRecord = true;

		// Force an empty query so that the last record is not affected by query filters
		// An empty query means it will get ALL records, in which case we are guaranteed
		// the latest record (i.e. the record ID we want) is the first to be retrieved
		query = NULL;
	} else {
		if( debug >= DEBUG_L1 ) {
			if( query == NULL ) {
				wprintf(L"[ParseEventLogInternal]: (no query specified)\n");
			} else {
				wprintf(L"[ParseEventLogInternal]: Using query: %s\n", query);
			}
		}
	}

	// Create a remote context to the external server
    EVT_HANDLE hRemote = CreateRemoteSession(server, domain, username, password);

    if (hRemote != NULL)
    {
		// NOTE: Reaching here does not mean the connection succeeded. It merely 
		// means that we successfully created the remote context

		if( debug >= DEBUG_L1 ) {
			wprintf(L"[ParseEventLogInternal]: Attempting to query the EventLog...\n\n", hRemote);
		}

		// Attempt to query event log in reverse chronological order (newest to oldest)
		EVT_HANDLE hResults = EvtQuery( hRemote, logName, query, EvtQueryChannelPath | EvtQueryReverseDirection);

		// If the query was successful
		if (hResults != NULL) 
		{
			// Process the first event found
			DumpEventInfo(hRemote, hResults, outputFormat, getLastRecord ? MODE_FETCH_LAST_RECORD : 0, debug);

			// Process subsequent events
			result = ProcessResults(hRemote, hResults, outputFormat, getLastRecord ? MODE_FETCH_LAST_RECORD : 0, debug);
		}
		else
		{
			// Query was not successful. Get the error code
			DWORD dwError = GetLastError();

			if (dwError == ERROR_EVT_CHANNEL_NOT_FOUND) 
			{
				fwprintf(stderr, L"[Error][ParseEventLog]: Could not open the '%s' log on this machine.\n", logName);
			}
			else if (dwError == ERROR_EVT_INVALID_QUERY)
			{
				// You can call the EvtGetExtendedStatus function to try to get 
				// additional information as to what is wrong with the query.
				fwprintf(stderr, L"[Error][ParseEventLog]: The specified search query is not valid.\n");
			}
			else
			{
				fwprintf(stderr, L"[Error][ParseEventLog]: Could not read event logs due to the following Windows error: %lu.\n", dwError);
			}
		}

		// Close the handle to the query we opened
		EvtClose(hRemote);
    }
	else 
	{
        fwprintf(stderr, L"[Error][ParseEventLog]: Failed to connect to remote computer. Error code is %d.\n", GetLastError());
	}

	return result;
}
void
SegmentationManager::WantsProcessResults()
{
	emit ProcessResults( ResultsInfo( GetInputImage(), GetOutputGeometry() ) );
}
void UAblTargetingBox::FindTargets(UAblAbilityContext& Context) const
{
	AActor* SourceActor = m_Location.GetSourceActor(Context);
	check(SourceActor);
	UWorld* World = SourceActor->GetWorld();
	FTransform QueryTransform;

	if (IsUsingAsync() && UAbleSettings::IsAsyncEnabled())
	{
		// Check if we have a valid Async handle already. 
		if (!Context.HasValidAsyncHandle())
		{
			FCollisionShape BoxShape = FCollisionShape::MakeBox(m_HalfExtents);

			m_Location.GetTransform(Context, QueryTransform);

			// Push our query out by our half extents so we aren't centered in the box.
			FQuat Rotation = QueryTransform.GetRotation();

			FVector HalfExtentsOffset = Rotation.GetForwardVector() * m_HalfExtents.X;

			QueryTransform *= FTransform(HalfExtentsOffset);

			FTraceHandle AsyncHandle = World->AsyncOverlapByChannel(QueryTransform.GetLocation(), QueryTransform.GetRotation(), GetCollisionChannel(), BoxShape);
			Context.SetAsyncHandle(AsyncHandle);
		}
		else // Poll and see if our query is done, if so - process it.
		{
			FOverlapDatum Datum;
			if (World->QueryOverlapData(Context.GetAsyncHandle(), Datum))
			{
				ProcessResults(Context, Datum.OutOverlaps);

				FTraceHandle Empty;
				Context.SetAsyncHandle(Empty); // Reset our handle.
			}

			return;
		}
	}
	else // Normal Sync Query
	{
		FCollisionShape BoxShape = FCollisionShape::MakeBox(m_HalfExtents);

		m_Location.GetTransform(Context, QueryTransform);

		// Push our query out by our half extents so we aren't centered in the box.
		FQuat Rotation = QueryTransform.GetRotation();

		FVector HalfExtentsOffset = Rotation.GetForwardVector() * m_HalfExtents.X;

		QueryTransform *= FTransform(HalfExtentsOffset);

		TArray<FOverlapResult> Results;
		if (World->OverlapMultiByChannel(Results, QueryTransform.GetLocation(), QueryTransform.GetRotation(), GetCollisionChannel(), BoxShape))
		{
			ProcessResults(Context, Results);
		}
	}

#if !UE_BUILD_SHIPPING
	if (FAblAbilityDebug::ShouldDrawQueries())
	{
		// Nope, go ahead and fire off our Async query.
		FVector AlignedBox = GetAlignedBox(Context, QueryTransform);

		FAblAbilityDebug::DrawBoxQuery(World, QueryTransform, AlignedBox);
	}
#endif // UE_BUILD_SHIPPING
}
示例#6
0
void CTest::RunTests()
{
	/*Enter tests in following manner:
	 *testname = Description of what is being tested for
	 *alphabet = alphabet with which to build the tree
	 *mutations = mutations with which to build the tree
	 *desiredOutputString = What should end up being printed to console or returned as string
	 *
	 *Run test with following steps:
	 *1. InitializeTest();
	 *2. Perform test actions. Store results to be checked in actualOutputString.
	 *3. ProcessResults();
	*/

	//Test 1: Test InorderPrint for tree with no rotations
	testname = "InorderPrint on tree with no rotations";
	alphabet = "abcdefghijklmnopqrstuvwxyz .,?";
	mutations = "";
	desiredOutputString = " 10  15  20  25  30  35  40  45  50  55  60  65  70  75  80  85  90  95  100  105  110  115  120  125  130  135  140  145  150  155  160  165  170  175  180  185  190  195  200  205  210  215  220  225  230  235  240  245  250  255  260  265  270  275  280  285  300  305  310 ";
	InitializeTest();
	actualOutputString = s.InorderPrint();
	ProcessResults();

	//Test 2: Test InorderPrintLeaves for tree with no rotations
	testname = "InorderPrintLeaves on tree with no rotations";
	alphabet = "abcdefghijklmnopqrstuvwxyz .,?";
	mutations = "";
	desiredOutputString = " a  b  c  d  e  f  g  h  i  j  k  l  m  n  o  p  q  r  s  t  u  v  w  x  y  z     .  ,  ? ";
	InitializeTest();
	actualOutputString = s.InorderPrintLeafLetters();
	ProcessResults();

	//Test 3: Test InorderPrint for tree with non-root rotation
	testname = "InorderPrint on tree with non-root rotation";
	alphabet = "abcdefghijklmnopqrstuvwxyz .,?";
	mutations = "265L";
	desiredOutputString = " 10  15  20  25  30  35  40  45  50  55  60  65  70  75  80  85  90  95  100  105  110  115  120  125  130  135  140  145  150  155  160  165  170  175  180  185  190  195  200  205  210  215  220  225  230  235  240  245  250  255  260  265  270  275  280  285  300  305  310 ";
	InitializeTest();
	actualOutputString = s.InorderPrint();
	ProcessResults();

	//Test 4: Test InorderPrintLeaves for tree with non-root rotation
	testname = "InorderPrintLeaves on tree with non-root rotation";
	alphabet = "abcdefghijklmnopqrstuvwxyz .,?";
	mutations = "265L";
	desiredOutputString = " a  b  c  d  e  f  g  h  i  j  k  l  m  n  o  p  q  r  s  t  u  v  w  x  y  z     .  ,  ? ";
	InitializeTest();
	actualOutputString = s.InorderPrintLeafLetters();
	ProcessResults();

	//Test 5: Test InorderPrint for tree with root rotation
	testname = "InorderPrint on tree with root rotation";
	alphabet = "abcdefghijklmnopqrstuvwxyz .,?";
	mutations = "165R";
	desiredOutputString = " 10  15  20  25  30  35  40  45  50  55  60  65  70  75  80  85  90  95  100  105  110  115  120  125  130  135  140  145  150  155  160  165  170  175  180  185  190  195  200  205  210  215  220  225  230  235  240  245  250  255  260  265  270  275  280  285  300  305  310 ";
	InitializeTest();
	actualOutputString = s.InorderPrint();
	ProcessResults();

	//Test 6: Test InorderPrintLeaves for tree with root rotations
	testname = "InorderPrintLeaves on tree with root rotations";
	alphabet = "abcdefghijklmnopqrstuvwxyz .,?";
	mutations = "165R";
	desiredOutputString = " a  b  c  d  e  f  g  h  i  j  k  l  m  n  o  p  q  r  s  t  u  v  w  x  y  z     .  ,  ? ";
	InitializeTest();
	actualOutputString = s.InorderPrintLeafLetters();
	ProcessResults();

	//Test 7: Test GetCode for tree without rotations
	testname = "GetCode on tree with root rotations";
	alphabet = "abcdefghijklmnopqrstuvwxyz .,?";
	mutations = "";
	desiredOutputString = "11011";
	InitializeTest();
	actualOutputString = s.GetCode(".");
	cout << actualOutputString;
	ProcessResults();

	//Test 8: Test GetCode for tree with non-root rotation
	testname = "GetCode on tree with root rotations";
	alphabet = "abcdefghijklmnopqrstuvwxyz .,?";
	mutations = "265L";
	desiredOutputString = "1101";
	InitializeTest();
	actualOutputString = s.GetCode(".");
	cout << actualOutputString;
	ProcessResults();

	//Test 9: Test GetCode for tree with root rotation
	testname = "GetCode on tree with root rotations";
	alphabet = "abcdefghijklmnopqrstuvwxyz .,?";
	mutations = "165R";
	desiredOutputString = "111011";
	InitializeTest();
	actualOutputString = s.GetCode(".");
	cout << actualOutputString;
	ProcessResults();

	//Test 10: Encode enitre alphabet for tree with no rotations
	testname = "Encode alphabet on tree with no rotations";
	alphabet = "abcdefghijklmnopqrstuvwxyz .,?";
	mutations = "";
	desiredOutputString = "0000000001000100001100100001010011000111010000100101010010110110001101011100111110000100011001010011101001010110110101111100011001110101101111101111";
	InitializeTest();
	actualOutputString = s.Encode(alphabet);
	cout << actualOutputString;
	ProcessResults();

	//Test 11: Decode enitre alphabet for tree with no rotations
	testname = "Decode alphabet on tree with no rotations";
	alphabet = "abcdefghijklmnopqrstuvwxyz .,?";
	mutations = "";
	desiredOutputString = "abcdefghijklmnopqrstuvwxyz .,?";
	InitializeTest();
	actualOutputString = s.Decode("0000000001000100001100100001010011000111010000100101010010110110001101011100111110000100011001010011101001010110110101111100011001110101101111101111");
	cout << actualOutputString;
	ProcessResults();

	//Test 12: Encode and decode alphabet for tree with no rotations
	testname = "Encode and decode alphabet on tree with no rotations";
	alphabet = "abcdefghijklmnopqrstuvwxyz .,?";
	mutations = "";
	desiredOutputString = "abcdefghijklmnopqrstuvwxyz .,?";
	InitializeTest();
	actualOutputString = s.Decode(s.Encode(alphabet));
	cout << actualOutputString;
	ProcessResults();

	//Test 13: Encode phrase with entire alphabet for tree with no rotations
	testname = "Encode phrase with entire alphabet on tree with no rotations";
	alphabet = "abcdefghijklmnopqrstuvwxyz .,?";
	mutations = "";
	desiredOutputString = "0000001011010111101001011001001001110011001001000110010111111010100111000111000111011010100110011100100110101000010100010000001001010110100000110001011101011001101110100010101110101111101001001101000110001111100101101001110101010010010001110101001100111001001101001011000001100111000110100001101110001101101111010";
	InitializeTest();
	actualOutputString = s.Encode("all letters? try, the quick brown fox jumps over the lazy dog. ");
	cout << actualOutputString;
	ProcessResults();

	//Test 14: Decode enitre phrase with entire alphabet for tree with no rotations
	testname = "Decode phrase with entire alphabet on tree with no rotations";
	alphabet = "abcdefghijklmnopqrstuvwxyz .,?";
	mutations = "";
	desiredOutputString = "all letters? try, the quick brown fox jumps over the lazy dog. ";
	InitializeTest();
	actualOutputString = s.Decode("0000001011010111101001011001001001110011001001000110010111111010100111000111000111011010100110011100100110101000010100010000001001010110100000110001011101011001101110100010101110101111101001001101000110001111100101101001110101010010010001110101001100111001001101001011000001100111000110100001101110001101101111010");
	cout << actualOutputString;
	ProcessResults();

	//Test 15: Encode and decode phrase with entire alphabet for tree with no rotations
	testname = "Encode and decode phrase with entire alphabet on tree with no rotations";
	alphabet = "abcdefghijklmnopqrstuvwxyz .,?";
	mutations = "";
	desiredOutputString = "all letters? try, the quick brown fox jumps over the lazy dog. ";
	InitializeTest();
	actualOutputString = s.Decode(s.Encode("all letters? try, the quick brown fox jumps over the lazy dog. "));
	cout << actualOutputString;
	ProcessResults();

	//Test 16: Encode enitre alphabet for tree with rotation
	testname = "Encode alphabet on tree with rotation";
	alphabet = "abcdefghijklmnopqrstuvwxyz .,?";
	mutations = "265L";
	desiredOutputString = "00000000010001000011001000010100110001110100001001010100101101100011010111001111100001000110010100111010010101101101011111000011000111001110111101111";
	InitializeTest();
	actualOutputString = s.Encode(alphabet);
	cout << actualOutputString;
	ProcessResults();

	//Test 17: Decode enitre alphabet for tree with rotation
	testname = "Decode alphabet on tree with rotation";
	alphabet = "abcdefghijklmnopqrstuvwxyz .,?";
	mutations = "265L";
	desiredOutputString = "abcdefghijklmnopqrstuvwxyz .,?";
	InitializeTest();
	actualOutputString = s.Decode("00000000010001000011001000010100110001110100001001010100101101100011010111001111100001000110010100111010010101101101011111000011000111001110111101111");
	cout << actualOutputString;
	ProcessResults();

	//Test 18: Encode and decode alphabet for tree with rotation
	testname = "Encode and decode alphabet on tree with rotation";
	alphabet = "abcdefghijklmnopqrstuvwxyz .,?";
	mutations = "265L";
	desiredOutputString = "abcdefghijklmnopqrstuvwxyz .,?";
	InitializeTest();
	actualOutputString = s.Decode(s.Encode(alphabet));
	cout << actualOutputString;
	ProcessResults();

	//Test 19: Encode phrase with entire alphabet for tree with rotation
	testname = "Encode phrase with entire alphabet on tree with rotation";
	alphabet = "abcdefghijklmnopqrstuvwxyz .,?";
	mutations = "265L";
	desiredOutputString = "000000101101011110010101100100100111001100100100011001011111100110011100011100001110110011001100111001001100110000101000100000010010101100100001100010111010110011011100100101011101011111001010011010001100011111001011001011101010100100100011100110011001110010011001010110000011000111000011001000110111000110110111001";
	InitializeTest();
	actualOutputString = s.Encode("all letters? try, the quick brown fox jumps over the lazy dog. ");
	cout << actualOutputString;
	ProcessResults();

	//Test 20: Decode enitre phrase with entire alphabet for tree with rotation
	testname = "Decode phrase with entire alphabet on tree with rotation";
	alphabet = "abcdefghijklmnopqrstuvwxyz .,?";
	mutations = "265L";
	desiredOutputString = "all letters? try, the quick brown fox jumps over the lazy dog. ";
	InitializeTest();
	actualOutputString = s.Decode("000000101101011110010101100100100111001100100100011001011111100110011100011100001110110011001100111001001100110000101000100000010010101100100001100010111010110011011100100101011101011111001010011010001100011111001011001011101010100100100011100110011001110010011001010110000011000111000011001000110111000110110111001");
	cout << actualOutputString;
	ProcessResults();

	//Test 21: Encode and decode phrase with entire alphabet for tree with rotation
	testname = "Encode and decode phrase with entire alphabet on tree with rotation";
	alphabet = "abcdefghijklmnopqrstuvwxyz .,?";
	mutations = "265L";
	desiredOutputString = "all letters? try, the quick brown fox jumps over the lazy dog. ";
	InitializeTest();
	actualOutputString = s.Decode(s.Encode("all letters? try, the quick brown fox jumps over the lazy dog. "));
	cout << actualOutputString;
	ProcessResults();

	//Test 22: Encode enitre alphabet for tree with rotations on non-existent nodes
	testname = "Encode alphabet on tree with rotations on non-existent nodes";
	alphabet = "abcdefghijklmnopqrstuvwxyz .,?";
	mutations = "064R";
	desiredOutputString = "0000000001000100001100100001010011000111010000100101010010110110001101011100111110000100011001010011101001010110110101111100011001110101101111101111";
	InitializeTest();
	actualOutputString = s.Encode(alphabet);
	cout << actualOutputString;
	ProcessResults();

	//Test 23: Decode enitre alphabet for tree with rotations on non-existent nodes
	testname = "Decode alphabet on tree with rotations on non-existent nodes";
	alphabet = "abcdefghijklmnopqrstuvwxyz .,?";
	mutations = "064R";
	desiredOutputString = "abcdefghijklmnopqrstuvwxyz .,?";
	InitializeTest();
	actualOutputString = s.Decode("0000000001000100001100100001010011000111010000100101010010110110001101011100111110000100011001010011101001010110110101111100011001110101101111101111");
	cout << actualOutputString;
	ProcessResults();

	//Test 24: Encode and decode alphabet for tree with rotations on non-existent nodes
	testname = "Encode and decode alphabet on tree with rotations on non-existent nodes";
	alphabet = "abcdefghijklmnopqrstuvwxyz .,?";
	mutations = "064R";
	desiredOutputString = "abcdefghijklmnopqrstuvwxyz .,?";
	InitializeTest();
	actualOutputString = s.Decode(s.Encode(alphabet));
	cout << actualOutputString;
	ProcessResults();

	//Test 25: Encode phrase with entire alphabet for tree with rotations on non-existent nodes
	testname = "Encode phrase with entire alphabet on tree with rotations on non-existent nodes";
	alphabet = "abcdefghijklmnopqrstuvwxyz .,?";
	mutations = "064R";
	desiredOutputString = "0000001011010111101001011001001001110011001001000110010111111010100111000111000111011010100110011100100110101000010100010000001001010110100000110001011101011001101110100010101110101111101001001101000110001111100101101001110101010010010001110101001100111001001101001011000001100111000110100001101110001101101111010";
	InitializeTest();
	actualOutputString = s.Encode("all letters? try, the quick brown fox jumps over the lazy dog. ");
	cout << actualOutputString;
	ProcessResults();

	//Test 26: Decode enitre phrase with entire alphabet for tree with rotations on non-existent nodes
	testname = "Decode phrase with entire alphabet on tree with rotations on non-existent nodes";
	alphabet = "abcdefghijklmnopqrstuvwxyz .,?";
	mutations = "064R";
	desiredOutputString = "all letters? try, the quick brown fox jumps over the lazy dog. ";
	InitializeTest();
	actualOutputString = s.Decode("0000001011010111101001011001001001110011001001000110010111111010100111000111000111011010100110011100100110101000010100010000001001010110100000110001011101011001101110100010101110101111101001001101000110001111100101101001110101010010010001110101001100111001001101001011000001100111000110100001101110001101101111010");
	cout << actualOutputString;
	ProcessResults();

	//Test 27: Encode and decode phrase with entire alphabet for tree with rotations on non-existent nodes
	testname = "Encode and decode phrase with entire alphabet on tree with rotations on non-existent nodes";
	alphabet = "abcdefghijklmnopqrstuvwxyz .,?";
	mutations = "064R";
	desiredOutputString = "all letters? try, the quick brown fox jumps over the lazy dog. ";
	InitializeTest();
	actualOutputString = s.Decode(s.Encode("all letters? try, the quick brown fox jumps over the lazy dog. "));
	cout << actualOutputString;
	ProcessResults();

	//Test 28: Encode enitre alphabet for tree with rotation on leaf node
	testname = "Encode alphabet on tree with rotation on leaf node";
	alphabet = "abcdefghijklmnopqrstuvwxyz .,?";
	mutations = "010R";
	desiredOutputString = "0000000001000100001100100001010011000111010000100101010010110110001101011100111110000100011001010011101001010110110101111100011001110101101111101111";
	InitializeTest();
	actualOutputString = s.Encode(alphabet);
	cout << actualOutputString;
	ProcessResults();

	//Test 29: Decode enitre alphabet for tree with rotation on leaf node
	testname = "Decode alphabet on tree with rotation on leaf node";
	alphabet = "abcdefghijklmnopqrstuvwxyz .,?";
	mutations = "010R";
	desiredOutputString = "abcdefghijklmnopqrstuvwxyz .,?";
	InitializeTest();
	actualOutputString = s.Decode("0000000001000100001100100001010011000111010000100101010010110110001101011100111110000100011001010011101001010110110101111100011001110101101111101111");
	cout << actualOutputString;
	ProcessResults();

	//Test 30: Encode and decode alphabet for tree with rotation on leaf node
	testname = "Encode and decode alphabet on tree with rotation on leaf node";
	alphabet = "abcdefghijklmnopqrstuvwxyz .,?";
	mutations = "010R";
	desiredOutputString = "abcdefghijklmnopqrstuvwxyz .,?";
	InitializeTest();
	actualOutputString = s.Decode(s.Encode(alphabet));
	cout << actualOutputString;
	ProcessResults();

	//Test 31: Encode phrase with entire alphabet for tree with rotation on leaf node
	testname = "Encode phrase with entire alphabet on tree with rotation on leaf node";
	alphabet = "abcdefghijklmnopqrstuvwxyz .,?";
	mutations = "010R";
	desiredOutputString = "0000001011010111101001011001001001110011001001000110010111111010100111000111000111011010100110011100100110101000010100010000001001010110100000110001011101011001101110100010101110101111101001001101000110001111100101101001110101010010010001110101001100111001001101001011000001100111000110100001101110001101101111010";
	InitializeTest();
	actualOutputString = s.Encode("all letters? try, the quick brown fox jumps over the lazy dog. ");
	cout << actualOutputString;
	ProcessResults();

	//Test 32: Decode enitre phrase with entire alphabet for tree with rotation on leaf node
	testname = "Decode phrase with entire alphabet on tree with rotation on leaf node";
	alphabet = "abcdefghijklmnopqrstuvwxyz .,?";
	mutations = "010R";
	desiredOutputString = "all letters? try, the quick brown fox jumps over the lazy dog. ";
	InitializeTest();
	actualOutputString = s.Decode("0000001011010111101001011001001001110011001001000110010111111010100111000111000111011010100110011100100110101000010100010000001001010110100000110001011101011001101110100010101110101111101001001101000110001111100101101001110101010010010001110101001100111001001101001011000001100111000110100001101110001101101111010");
	cout << actualOutputString;
	ProcessResults();

	//Test 33: Encode and decode phrase with entire alphabet for tree with rotation on leaf node
	testname = "Encode and decode phrase with entire alphabet on tree with rotation on leaf node";
	alphabet = "abcdefghijklmnopqrstuvwxyz .,?";
	mutations = "010R";
	desiredOutputString = "all letters? try, the quick brown fox jumps over the lazy dog. ";
	InitializeTest();
	actualOutputString = s.Decode(s.Encode("all letters? try, the quick brown fox jumps over the lazy dog. "));
	cout << actualOutputString;
	ProcessResults();

	//Test 34: Encode enitre alphabet for tree with rotation on root node
	testname = "Encode alphabet on tree with rotation on root node";
	alphabet = "abcdefghijklmnopqrstuvwxyz .,?";
	mutations = "165R";
	desiredOutputString = "0000000100100011010001010110011110000100011001010011101001010110110101111100001100011100101100111101001101011101101101111110001110011110101110111111011111";
	InitializeTest();
	actualOutputString = s.Encode(alphabet);
	cout << actualOutputString;
	ProcessResults();

	//Test 35: Decode enitre alphabet for tree with rotation on root node
	testname = "Decode alphabet on tree with rotation on root node";
	alphabet = "abcdefghijklmnopqrstuvwxyz .,?";
	mutations = "165R";
	desiredOutputString = "abcdefghijklmnopqrstuvwxyz .,?";
	InitializeTest();
	actualOutputString = s.Decode("0000000100100011010001010110011110000100011001010011101001010110110101111100001100011100101100111101001101011101101101111110001110011110101110111111011111");
	cout << actualOutputString;
	ProcessResults();

	//Test 36: Encode and decode alphabet for tree with rotation on root node
	testname = "Encode and decode alphabet on tree with rotation on root node";
	alphabet = "abcdefghijklmnopqrstuvwxyz .,?";
	mutations = "165R";
	desiredOutputString = "abcdefghijklmnopqrstuvwxyz .,?";
	InitializeTest();
	actualOutputString = s.Decode(s.Encode(alphabet));
	cout << actualOutputString;
	ProcessResults();

	//Test 37: Encode phrase with entire alphabet for tree with rotation on root node
	testname = "Encode phrase with entire alphabet on tree with rotation on root node";
	alphabet = "abcdefghijklmnopqrstuvwxyz .,?";
	mutations = "165R";
	desiredOutputString = "0000100111001111101010011010011001111001101001100011100101111111101011001111000111100011110111010110011011101001110101100001101001000000101001011101000011100011011011011010101111010010110110110111111010100011101001010010111110010111010101101101010100110001111010110011011101001110101001100001110011110001110100011101100110111011111010";
	InitializeTest();
	actualOutputString = s.Encode("all letters? try, the quick brown fox jumps over the lazy dog. ");
	cout << actualOutputString;
	ProcessResults();

	//Test 38: Decode enitre phrase with entire alphabet for tree with rotation on root node
	testname = "Decode phrase with entire alphabet on tree with rotation on root node";
	alphabet = "abcdefghijklmnopqrstuvwxyz .,?";
	mutations = "165R";
	desiredOutputString = "all letters? try, the quick brown fox jumps over the lazy dog. ";
	InitializeTest();
	actualOutputString = s.Decode("0000100111001111101010011010011001111001101001100011100101111111101011001111000111100011110111010110011011101001110101100001101001000000101001011101000011100011011011011010101111010010110110110111111010100011101001010010111110010111010101101101010100110001111010110011011101001110101001100001110011110001110100011101100110111011111010");
	cout << actualOutputString;
	ProcessResults();

	//Test 39: Encode and decode phrase with entire alphabet for tree with rotation on root node
	testname = "Encode and decode phrase with entire alphabet on tree with rotation on root node";
	alphabet = "abcdefghijklmnopqrstuvwxyz .,?";
	mutations = "165R";
	desiredOutputString = "all letters? try, the quick brown fox jumps over the lazy dog. ";
	InitializeTest();
	actualOutputString = s.Decode(s.Encode("all letters? try, the quick brown fox jumps over the lazy dog. "));
	cout << actualOutputString;
	ProcessResults();

	//Test 40: Encode enitre alphabet for tree with all types of rotations
	testname = "Encode alphabet on tree with all types of rotations";
	alphabet = "abcdefghijklmnopqrstuvwxyz .,?";
	mutations = "065R023L310R025L165R";
	desiredOutputString = "000000000100010010100110011100111110000100011001010011101001010110110101111100001100011100101100111101001101011101101101111110001110011110101110111111011111";
	InitializeTest();
	actualOutputString = s.Encode(alphabet);
	cout << actualOutputString;
	ProcessResults();

	//Test 41: Decode enitre alphabet for tree with all types of rotations
	testname = "Decode alphabet on tree with all types of rotations";
	alphabet = "abcdefghijklmnopqrstuvwxyz .,?";
	mutations = "065R023L310R025L165R";
	desiredOutputString = "abcdefghijklmnopqrstuvwxyz .,?";
	InitializeTest();
	actualOutputString = s.Decode("000000000100010010100110011100111110000100011001010011101001010110110101111100001100011100101100111101001101011101101101111110001110011110101110111111011111");
	cout << actualOutputString;
	ProcessResults();

	//Test 42: Encode and decode alphabet for tree with all types of rotations
	testname = "Encode and decode alphabet on tree with all types of rotations";
	alphabet = "abcdefghijklmnopqrstuvwxyz .,?";
	mutations = "065R023L310R025L165R";
	desiredOutputString = "abcdefghijklmnopqrstuvwxyz .,?";
	InitializeTest();
	actualOutputString = s.Decode(s.Encode(alphabet));
	cout << actualOutputString;
	ProcessResults();

	//Test 43: Encode phrase with entire alphabet for tree with all types of rotations
	testname = "Encode phrase with entire alphabet on tree with all types of rotations";
	alphabet = "abcdefghijklmnopqrstuvwxyz .,?";
	mutations = "065R023L310R025L165R";
	desiredOutputString = "0000010011100111110101001101011001111001101011000111001011111111010110011110001111000111101110101100110111101011101011000011010010000000110010111010000011100011011011011010101111010011010110110111111010100011101001010010111110010111010101101101010101100011110101100110111101011101010011000001110011110001110100011011001110111011111010";
	InitializeTest();
	actualOutputString = s.Encode("all letters? try, the quick brown fox jumps over the lazy dog. ");
	cout << actualOutputString;
	ProcessResults();

	//Test 44: Decode enitre phrase with entire alphabet for tree with all types of rotations
	testname = "Decode phrase with entire alphabet on tree with all types of rotations";
	alphabet = "abcdefghijklmnopqrstuvwxyz .,?";
	mutations = "065R023L310R025L165R";
	desiredOutputString = "all letters? try, the quick brown fox jumps over the lazy dog. ";
	InitializeTest();
	actualOutputString = s.Decode("0000010011100111110101001101011001111001101011000111001011111111010110011110001111000111101110101100110111101011101011000011010010000000110010111010000011100011011011011010101111010011010110110111111010100011101001010010111110010111010101101101010101100011110101100110111101011101010011000001110011110001110100011011001110111011111010");
	cout << actualOutputString;
	ProcessResults();

	//Test 45: Encode and decode phrase with entire alphabet for tree with all types of rotations
	testname = "Encode and decode phrase with entire alphabet on tree with all types of rotations";
	alphabet = "abcdefghijklmnopqrstuvwxyz .,?";
	mutations = "065R023L310R025L165R";
	desiredOutputString = "all letters? try, the quick brown fox jumps over the lazy dog. ";
	InitializeTest();
	actualOutputString = s.Decode(s.Encode("all letters? try, the quick brown fox jumps over the lazy dog. "));
	cout << actualOutputString;
	ProcessResults();

	GetTestResults();
}
void CT_KeypadDriverData::RunL(CActive* aActive, TInt aIndex)
	{
	DecOutstanding();
	TBool	straySignal		= EFalse;
	TBool	furtherRequest	= EFalse;

	TBool	isCombination	= EFalse;
	TBool	isPrompt		= EFalse;

	if( aActive == iActiveKey )
		{
		INFO_PRINTF1(_L("RunL called"));

		isCombination			= EFalse;
		isPrompt				= EFalse;
		TInt	eventType		= iKey.Type();
		TInt	scanCode		= iKey.Code();

		if( eventType == TRawEvent::EKeyDown || eventType == TRawEvent::EKeyUp)
			{
			INFO_PRINTF2(_L("Raw Event: %d"), eventType);

			iActualStore.AppendL(eventType);
			iActualStore.AppendL(scanCode);

			INFO_PRINTF2(_L("Expected scancode string: %S"), &iAllPossibleKeysStrStore[iKeyCount]);
			INFO_PRINTF2(_L("Actual scancode: %d"), scanCode);

			if (eventType == TRawEvent::EKeyUp)
				{
				if(iKeyCount < iAllPossibleKeysStore.Count() - 1)
					{
					furtherRequest = ETrue;
					iKeyCount++;
					}
				else
					{
					furtherRequest = EFalse;
					}
				}
			else
				{
				furtherRequest = ETrue;
				}
			}
		else
			{
			ERR_PRINTF2(_L("Unexpected Raw Event: %d"), eventType);
			SetBlockResult(EFail);
			furtherRequest = ETrue;
			}
		}
	else if( aActive == iActiveCombination )
		{
		INFO_PRINTF1(_L("RunL called"));

		isCombination				= ETrue;
		isPrompt					= EFalse;
		TInt 	eventType			= iKey.Type();
		TInt	scanCode			= iKey.Code();

		if( eventType == TRawEvent::EKeyDown )
			{
			INFO_PRINTF2(_L("Raw Event: %d"), eventType);

			iActualStore.AppendL(eventType);
			iActualStore.AppendL(scanCode);

			INFO_PRINTF2(_L("Expected scancode string: %S"), &iCombinationStrStore[iCombinationCount]);
			INFO_PRINTF2(_L("Actual scancode: %d"), scanCode);

			iCombinationKeyCount++;

			furtherRequest = ETrue;
			}
		else if ( eventType == TRawEvent::EKeyUp )
			{
			INFO_PRINTF2(_L("Raw Event: %d"), eventType);

			iActualStore.AppendL(eventType);
			iActualStore.AppendL(scanCode);

			INFO_PRINTF2(_L("Actual scancode: %d"), scanCode);

			iCombinationKeyCount--;

			if(iCombinationCount < iCombinationStrStore.Count() - 1 && iCombinationKeyCount == 0)
				{
				furtherRequest = ETrue;
				iCombinationCount++;
				}
			else if (iCombinationKeyCount != 0)
				{
				furtherRequest = ETrue;
				}
			else
				{
				furtherRequest = EFalse;
				}
			}
		else
			{
			ERR_PRINTF2(_L("Unexpected Raw Event: %d"), eventType);
			SetBlockResult(EFail);
			furtherRequest = ETrue;
			}
		}
	else if( aActive == iActiveKeypadState )
		{
		INFO_PRINTF1(_L("RunL called"));

		TInt eventType = iKey.Type();
		TInt scanCode  = iKey.Code();

		if(eventType == TRawEvent::EKeyDown && scanCode != 0)
			{
			iActiveKeypadState->KillTimer();
			DecOutstanding();

			if(iExpectedState == 0)
				{
				ERR_PRINTF1(_L("Key press detected. Expected state is 0 (off)"));
				SetBlockResult(EFail);
				}
			else
				{
				INFO_PRINTF2(_L("Key press result is corresponding to the expected state: %d"), iExpectedState);
				}
			}
		}
	else if ( aActive == iActivePrompt )
		{
		INFO_PRINTF1(_L("Prompt RunL called"));

		isCombination		= EFalse;
		isPrompt			= ETrue;
		TInt	eventType	= iKey.Type();
		TInt	scanCode	= iKey.Code();

		if (iFailTest)
			{
			if(eventType == TRawEvent::EKeyDown && scanCode != iPassKey)
				{
				ERR_PRINTF1(_L("Test failed - User verifies that the result is not as expected"));
				SetBlockResult(EFail);
				furtherRequest = EFalse;
				}
			else if (eventType == TRawEvent::EKeyDown && scanCode == iPassKey)
				{
				INFO_PRINTF1(_L("Test passed - User verifies that the result is as expected"));
				furtherRequest = EFalse;
				}
			else if (eventType == TRawEvent::EKeyUp)
				{
				furtherRequest = ETrue;
				}
			else
				{
				ERR_PRINTF2(_L("Unexpected Raw Event: %d"), eventType);
				SetBlockResult(EFail);
				furtherRequest = ETrue;
				}
			}
		else
			{
			if(eventType == TRawEvent::EKeyDown)
				{
				INFO_PRINTF1(_L("Continuing..."));
				furtherRequest = EFalse;
				}
			else if (eventType == TRawEvent::EKeyUp)
				{
				furtherRequest = ETrue;
				}
			else
				{
				ERR_PRINTF2(_L("Unexpected Raw Event: %d"), eventType);
				SetBlockResult(EFail);
				furtherRequest = ETrue;
				}
			}
		}
	else
		{
		ERR_PRINTF1(_L("An unchecked active object completed"));
		SetBlockResult(EFail);
		straySignal = ETrue;
		}

	if( !straySignal )
		{
		TInt	err = aActive->iStatus.Int();
		if( err != KErrNone )
			{
			if(aActive == iActiveKeypadState && err == KErrCancel)
				{
				if(iExpectedState == 1)
					{
					ERR_PRINTF1(_L("No key press detected. Expected state is 1 (on)"));
					SetBlockResult(EFail);
					}
				else
					{
					INFO_PRINTF2(_L("Key press result is corresponding to the expected state: %d"), iExpectedState);
					}
				}
			else
				{
				ERR_PRINTF2(_L("RunL Error %d"), err);
				SetAsyncError( aIndex, err );
				}
			}
		else
			{
			if(furtherRequest)// check if re-issue required
				{
				iConsole.ClearScreen();
				INFO_PRINTF1(_L("Re-issuing Read"));

				if(!isCombination && !isPrompt)
					{
					iConsole.Write(_L("Press the key corresponding to the "));
					iConsole.Write(iAllPossibleKeysStrStore[iKeyCount]);

					iConsole.Read(iKey, iActiveKey->iStatus);
					iActiveKey->Activate(aIndex);
					IncOutstanding();
					}
				else if (!isPrompt)
					{
					iConsole.Write(_L("Press the following keys in the same sequence as displayed:\n"));
					iConsole.Write(iCombinationStrStore[iCombinationCount]);
					iConsole.Write(_L("\n"));
					iConsole.Write(_L("and release them in the same sequence."));

					iConsole.Read(iKey, iActiveCombination->iStatus);
					iActiveCombination->Activate(aIndex);
					IncOutstanding();
					}
				else{
					iConsole.Write(iUserPromptStr);

					if(iFailTest)
						{
						iConsole.Write(_L("Press "));
						iConsole.Write(iPassKeyStr);
						iConsole.Write(_L(" to pass the test or any other key to fail->>>"));
						}
					else
						{
						iConsole.Write(_L("Press any key to continue->>>"));
						}

					iConsole.Read(iKey, iActivePrompt->iStatus);
					iActivePrompt->Activate( aIndex );
					IncOutstanding();
					}
				}
			else
				{
				if(aActive == iActiveKeypadState)
					{
					if ( iExpectedState == 0 )
						{
						ERR_PRINTF1(_L("Expected state is 0 (off). Verifying keypad state should have been cancelled."));
						SetBlockResult(EFail);
						}
					else
						{
						INFO_PRINTF2(_L("Key press result is corresponding to the expected state: %d"), iExpectedState);
						}
					}
				else
					{
					INFO_PRINTF1(_L("RunL call completed successfully"));
					ProcessResults();	//process results
					}
				}
			}
		}
	}