Ejemplo n.º 1
0
void HashMapTest::HashMapInsertRemoveGetTest(PerfFuncData * data)
{
	const int sz = 20000;
	DAVA::int32 i;
	DAVA::Vector<DAVA::uint32> vect;
	DAVA::HashMap<DAVA::int32, DAVA::uint32> map;
	
	vect.resize(sz);

	for(i = 0; i < sz; ++i)
	{
		DAVA::uint32 v = (i + 1); // any value
		vect[i] = v;
		map.Insert(i, v);
	}

	// Get test
	for(i = 0; i < sz; ++i)
	{
		TEST_VERIFY(vect[i] == map[i]);
	}

	// remove some items
	for (int i = 0; i < sz/10; i++)
	{
		int index = DAVA::Random::Instance()->Rand(sz);
		vect[i] = 0;
		map.Remove(i);
	}

	// check get after remove
	for (int i = 0; i < sz; i++)
	{
		if(0 != vect[i])
		{
			TEST_VERIFY(vect[i] == map[i]);
		}
	}

	// iterator test
	DAVA::HashMap<DAVA::int32, DAVA::uint32>::Iterator iter = map.Begin();
	for(; iter != map.End(); ++iter)
	{
		TEST_VERIFY(vect[iter.GetKey()] == iter.GetValue());
	}

	// 0-size hash map iterator test
	DAVA::HashMap<DAVA::int32, DAVA::uint32> map0;
	iter = map0.Begin();
	for (; iter != map0.End(); ++iter)
	{}
}
Ejemplo n.º 2
0
DAVA::Vector<String> RecentFilesManager::GetRecentFiles()
{
	DAVA::Vector<String> retVector;
	VariantType recentFilesVariant = SettingsManager::GetValue(Settings::Internal_RecentFiles);
	if(recentFilesVariant.GetType() == DAVA::VariantType::TYPE_KEYED_ARCHIVE)
	{
		KeyedArchive* archiveRecentFiles = recentFilesVariant.AsKeyedArchive();
		DAVA::uint32 size = archiveRecentFiles->Count();
		retVector.resize(size);
		for (DAVA::uint32 i = 0; i < size; ++i)
		{
			retVector[i] = archiveRecentFiles->GetString(Format("%d", i));
		}
		
	}
	return retVector;
}