Ejemplo n.º 1
0
bool TestOptimizations::doTest()
{
	typedef std::deque<unsigned int> TestSet;
	
	StringVector testVector = enumerateTests(getPTXFiles(path),
		getOptimizations(optimizations));
	
	status << " Enumerated " << testVector.size() << " tests\n";
	
	TestSet tests;
	
	for(auto test = testVector.begin(); test != testVector.end(); ++test)
	{
		tests.push_back(std::distance(testVector.begin(), test));
	}
	
	hydrazine::Timer timer;
	timer.start();
	
	unsigned int count = 0;
	
	for(unsigned int i = 0, e = tests.size(); i != e; ++i)
	{
		if(timer.seconds() > timeLimit) break;
		
		unsigned int index = random() % tests.size();
	
		TestSet::iterator testPosition = tests.begin() + index;
	
		std::string test = testVector[*testPosition];
	
		status << " Running test '" << test << "'\n";
	
		if(!runTest(test)) return false;
	
		tests.erase(testPosition);
	
		++count;
	}
	
	status << "Finished running " << count << " tests...\n";
	
	return true;
}
Ejemplo n.º 2
0
bool
tStrSet( LibTest & tester )
{
  {
    TestSet    t;
    
    const char * string[] = {"one","two","three","four", 0};

    for( size_t f = 0; string[f]; f++ )
      {
	cout << f << endl;
	t.insert( string[f] );
      }
    
    for( TestSet::iterator  them = t.begin();
	 them != t.end();
	 them++ )
      {
	cout << (*them) << endl;
      }
    
  }
  return( true );
}